summaryrefslogtreecommitdiff
path: root/test/solver.sh
blob: 20dc23202e7200b832270b06e43db4fbaeaf1544 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

APK_TEST=../src/apk_test

fail=0
for test in *.test; do
	bn=$(basename $test .test)
	(
		read options
		read world
		$APK_TEST $options "$world" &> $bn.got
	) < $bn.test
	if ! cmp $bn.expect $bn.got &> /dev/null; then
		fail=$((fail+1))
		echo "FAIL: $test"
		diff -ru $bn.expect $bn.got
	else
		echo "OK: $test"
	fi
done

if [ "$fail" != "0" ]; then
	echo "FAIL: $fail failed test cases"
fi

exit $fail