34 lines
553 B
Bash
Raw Normal View History

2016-07-23 18:54:58 -04:00
#! /bin/bash
function testExample() {
N=$1
INPUT=$2
APP=$3
echo "Example $N"
$APP &> /dev/null &
sleep 2
tmsp-cli --verbose batch < $INPUT > "${INPUT}.out.new"
2016-09-10 20:10:59 -04:00
killall "$APP"
2016-07-23 18:54:58 -04:00
pre=`shasum < "${INPUT}.out"`
post=`shasum < "${INPUT}.out.new"`
if [[ "$pre" != "$post" ]]; then
echo "You broke the tutorial"
2016-09-10 20:10:59 -04:00
echo "Got:"
cat "${INPUT}.out.new"
echo "Expected:"
cat "${INPUT}.out"
2016-07-23 18:54:58 -04:00
exit 1
fi
rm "${INPUT}".out.new
}
testExample 1 tests/test_cli/ex1.tmsp dummy
testExample 2 tests/test_cli/ex2.tmsp counter
echo ""
echo "PASS"