summaryrefslogtreecommitdiff
path: root/test/solver.sh
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-23 22:02:11 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-23 22:05:02 +0200
commit64e5a64442194a73e75ef11039f7d1e18d60c15e (patch)
treeab8f11613158d54302cc04bcab99cc4af3036af4 /test/solver.sh
parent082ffbd3d6e713ba8c24b428c46af30c799aac6b (diff)
downloadapk-tools-64e5a64442194a73e75ef11039f7d1e18d60c15e.tar.gz
apk-tools-64e5a64442194a73e75ef11039f7d1e18d60c15e.tar.bz2
apk-tools-64e5a64442194a73e75ef11039f7d1e18d60c15e.tar.xz
apk-tools-64e5a64442194a73e75ef11039f7d1e18d60c15e.zip
test: rewrite the testing framework to use the real applets
also merge the expected output to the *.test files.
Diffstat (limited to 'test/solver.sh')
-rwxr-xr-xtest/solver.sh22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/solver.sh b/test/solver.sh
index 20dc232..aa9ffc5 100755
--- a/test/solver.sh
+++ b/test/solver.sh
@@ -1,26 +1,26 @@
#!/bin/sh
-APK_TEST=../src/apk_test
+APK_TEST=../src/apk-test
fail=0
+pass=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
+ awk '/^@ARGS/{p=1;next} /^@/{p=0} p{print}' < $test | xargs $APK_TEST &> .$test.got
+
+ if ! awk '/^@EXPECT/{p=1;next} /^@/{p=0} p{print}' < $test | cmp .$test.got &> /dev/null; then
fail=$((fail+1))
echo "FAIL: $test"
- diff -ru $bn.expect $bn.got
+ awk '/^@EXPECT/{p=1;next} /^@/{p=0} p{print}' < $test | diff -ru - .$test.got
else
- echo "OK: $test"
+ pass=$((pass+1))
fi
done
+total=$((fail+pass))
if [ "$fail" != "0" ]; then
- echo "FAIL: $fail failed test cases"
+ echo "FAIL: $fail of $total test cases failed"
+else
+ echo "OK: all $total solver test cases passed"
fi
exit $fail