summaryrefslogtreecommitdiff
path: root/15_tests_subseq/run_all.sh
blob: 33e763dc4ecfc24961a67e7bddb4f607fd856df1 (plain)
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
28
29
30
31
32
33
34
35
36
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