summaryrefslogtreecommitdiff
path: root/26_tests_matrix_input/run_all.sh
blob: f13fdf07de1873d3095ffdafeb8eb5693cc7ed56 (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
#!/bin/bash
run_test() {
    prog="$1"
    testfile="$2"
    IFS=$'\n'
    for line in `cat $testfile | sed 's/^$/ /'`
    do
        IFS=" " correct=`/usr/local/l2p/rot_matrix/rotateMatrix $line 2>&1`
        IFS=" " broken=`$prog $line 2>&1`
        if [ "$broken" != "$correct" ]
        then
            return 0
        fi
    done
    return 1
}

for i in /usr/local/l2p/rot_matrix/rotateMatrix*
do
    if [ "$i" != "/usr/local/l2p/rot_matrix/rotateMatrix" ]
       then
           echo "Checking `basename $i`"
           run_test $i tests.txt
           x="$?"
           if [ "$x" != "0" ]
           then
               echo "***Your tests failed to show that `basename $i` was broken!"
           fi
    fi
done