summaryrefslogtreecommitdiff
path: root/test.sh
blob: 635fe714f83e59f5045e6bd906d5c5cad0935773 (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/sh

##################################################
# A test script that uses ./runner.sh to run all #
# tests for a given phase.                       #
##################################################

testdir="./output"
case "$1" in
    "typecheck")
        ext="java"
        ;;
    "boil")
        ext="java"
        ;;
    "vaporize")
        ext="vapor"
        ;;
    "condense")
        ext="vaporm"
        ;;
    *)
        echo "usage $0 [typecheck|boil|vaporize|condense]"
        exit 1
        ;;
esac

echo "$testdir/*.$ext"

for file in $testdir/*.$ext; do
    [ -f "$file" ] || break
    base=${file%.*}
    echo -n "Processing file: $base "
    expected=$(bash runner.sh java "${base}.java")
    actual=$(bash runner.sh $1 $file 2>/dev/null)
    [[ $expected == $actual ]] && echo 'PASSED' || echo -e "FAILED"
done