#!/bin/sh # if test -z "$1" then PROGRAM=./headlines else PROGRAM="$1" fi test -x "$PROGRAM" || { echo "Could not find executable $PROGRAM" && exit 1; } run_test() { echo Running test "$@" "$@" < test.in | tee test.out || { echo "headlines returns FAILURE. Check test.in and test.out." && exit 1; } diff -q test.out test.expected || { echo "Bad output from headlines FAILURE. Check test.in, test.out, and test.expected." && exit 1; } echo PASSED. } cat > test.in < test.expected < test.expected < test.in < test.expected <