box-o-sand/test_ex19.sh

78 lines
531 B
Bash
Raw Normal View History

#!/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