summaryrefslogtreecommitdiff
path: root/15_tests_subseq/run_all.sh
diff options
context:
space:
mode:
Diffstat (limited to '15_tests_subseq/run_all.sh')
-rwxr-xr-x15_tests_subseq/run_all.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/15_tests_subseq/run_all.sh b/15_tests_subseq/run_all.sh
new file mode 100755
index 0000000..33e763d
--- /dev/null
+++ b/15_tests_subseq/run_all.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+for i in /usr/local/l2p/subseq/subseq*.o
+do
+ test=`basename $i | sed 's/subseq//' | sed 's/.o//'`
+ if [ "$test" == "" ]
+ then
+ echo "**Testing correct implementation **"
+ else
+ echo "**Testing broken implementation ${test} **"
+ fi
+ echo "-------------------------------------"
+ echo ""
+
+ gcc -o test-subseq test-subseq.c $i
+ if [ "$?" != "0" ]
+ then
+ echo "Could not compile test-subseq.c with $i" > /dev/stderr
+ exit 1
+ fi
+ ./test-subseq
+ if [ "$?" != 0 ]
+ then
+ if [ "$test" == "" ]
+ then
+ echo "Your test program falsely failed the correct implementation!" > /dev/stderr
+ exit 1
+ fi
+ else
+ if [ "$test" != "" ]
+ then
+ echo "Your test program did not identify $i as broken!" > /dev/stderr
+ exit 1
+ fi
+ fi
+ echo ""
+done