diff options
| author | Thomas Bauereiss | 2018-01-23 19:51:39 +0000 |
|---|---|---|
| committer | Thomas Bauereiss | 2018-01-23 19:53:17 +0000 |
| commit | 4ec26c81830b26957dfac205eb60b522890fb007 (patch) | |
| tree | bb862e4d9a08999ff96e360803e3630a5964624c /test/lem | |
| parent | c5db705ca228421b4035b4361aba9823750fd67c (diff) | |
Run tests for Lem shallow embedding
Uses the typechecker tests for now. Also fix two minor bugs in pretty-printer
and rewriter uncovered by the tests.
Diffstat (limited to 'test/lem')
| -rwxr-xr-x | test/lem/run_tests.sh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/lem/run_tests.sh b/test/lem/run_tests.sh new file mode 100755 index 00000000..5d435950 --- /dev/null +++ b/test/lem/run_tests.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SAILDIR="$DIR/../.." +TESTSDIR="$DIR/../typecheck/pass" + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' + +rm -f $DIR/tests.xml + +pass=0 +fail=0 + +XML="" + +function green { + (( pass += 1 )) + printf "$1: ${GREEN}$2${NC}\n" + XML+=" <testcase name=\"$1\"/>\n" +} + +function yellow { + (( fail += 1 )) + printf "$1: ${YELLOW}$2${NC}\n" + XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" +} + +function red { + (( fail += 1 )) + printf "$1: ${RED}$2${NC}\n" + XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" +} + +function finish_suite { + printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" + XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" + printf "$XML" >> $DIR/tests.xml + XML="" + pass=0 + fail=0 +} + +printf "<testsuites>\n" >> $DIR/tests.xml + +for i in `ls $TESTSDIR/ | grep sail`; +do + if $SAILDIR/sail -lem -lem_sequential -o out $TESTSDIR/$i &>/dev/null; + then + if lem -lib $SAILDIR/src/lem_interp -lib $SAILDIR/src/gen_lib out_embed_types_sequential.lem out_embed_sequential.lem &>/dev/null; + then + green "tested $i expecting pass" "pass" + else + yellow "tested $i expecting pass" "failed to typecheck generated Lem" + fi + else + red "tested $i expecting pass" "failed to generate Lem" + fi +done + +finish_suite "Expecting pass" + +printf "</testsuites>\n" >> $DIR/tests.xml |
