box-o-sand/lcthw-remnants/test_ex19.sh
Dan Buch f2380eef05 Add 'lcthw-remnants/' from commit 'e172f73c8297b22a579c94558f0c171ca74a0e5c'
git-subtree-dir: lcthw-remnants
git-subtree-mainline: 4107485591
git-subtree-split: e172f73c82
2013-01-09 23:42:19 -05:00

78 lines
531 B
Bash
Executable File

#!/bin/bash
EXIT_CODE=0
run_test()
{
echo -n " $1"
cat "$2" | ./ex19 >/dev/null
if [[ "$?" -eq "0" ]]
then
echo " ... OK"
else
echo " ... FAIL"
EXIT_CODE=1
fi
rm -f "$2"
}
tmp_01="`mktemp`"
cat > "$tmp_01" <<EOF
l
n
w
n
w
n
w
e
w
e
e
e
s
s
w
w
n
a
a
a
a
a
a
a
a
a
a
a
a
EOF
tmp_02="`mktemp`"
cat > "$tmp_02" <<EOF
l
a
a
a
a
a
n
hutesoahutesohas
999999999999
l
n
n
n
e
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
EOF
run_test '01' "$tmp_01"
run_test '02' "$tmp_02"
exit $EXIT_CODE