From 4ec26c81830b26957dfac205eb60b522890fb007 Mon Sep 17 00:00:00 2001 From: Thomas Bauereiss Date: Tue, 23 Jan 2018 19:51:39 +0000 Subject: 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. --- test/lem/run_tests.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 test/lem/run_tests.sh (limited to 'test/lem') 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+=" \n" +} + +function yellow { + (( fail += 1 )) + printf "$1: ${YELLOW}$2${NC}\n" + XML+=" \n $2\n \n" +} + +function red { + (( fail += 1 )) + printf "$1: ${RED}$2${NC}\n" + XML+=" \n $2\n \n" +} + +function finish_suite { + printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" + XML=" \n$XML \n" + printf "$XML" >> $DIR/tests.xml + XML="" + pass=0 + fail=0 +} + +printf "\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 "\n" >> $DIR/tests.xml -- cgit v1.2.3