From: Bernhard Urban Date: Mon, 22 Mar 2010 21:14:26 +0000 (+0100) Subject: scanner/parser: offizielle test{faelle,skripten} sind da :) X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=uebersetzerbau-ss10.git;a=commitdiff_plain;h=0f6d6951027b3db28444beb0d7d0ecbcff7f77e8 scanner/parser: offizielle test{faelle,skripten} sind da :) --- diff --git a/parser/09test.sh b/parser/09test.sh deleted file mode 100755 index ab33935..0000000 --- a/parser/09test.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -beispiel=parser -allow_null_glob_expansion=1 -shopt -s nullglob -PROGRAM=./$beispiel -errnum=0 -prgnum=0 - -LOC=~/test/$beispiel/ - -for i in $LOC/*.[012] -do - echo "---------------------------------------------------------------------" - echo "Test file: $i" - echo "Input:" - echo "======" - echo - cat $i - echo - let prgnum=prgnum+1 - $PROGRAM <$i >/dev/null 2>/dev/null - retval=$? - if test $retval -eq ${i##*.} - then - echo "Correct exit status." - else - echo "[Error] Status is $retval but ${i##*.} was expected!" - echo - let errnum=errnum+1 - fi -done -echo "---------------------------------------------------------------------" -echo -let corrnum=prgnum-errnum -echo "Statistics:" -echo "===========" -echo " $prgnum Tests total" -echo " $corrnum Tests passed" -echo " $errnum Tests failed" diff --git a/parser/Makefile b/parser/Makefile index 6a9ff6f..057281a 100644 --- a/parser/Makefile +++ b/parser/Makefile @@ -33,8 +33,7 @@ $(PARSER).h: $(PARSER).c clean: rm -f $(PARSER){,.o,.c,.h,.output} $(SCANNER).{c,o} -1test: clean $(NAME) - @./09test.sh +1test: 2test 2test: /usr/ftp/pub/ublu/test/$(NAME)/test 2>&1 diff --git a/scanner/Makefile b/scanner/Makefile index e29faec..50a3ddd 100755 --- a/scanner/Makefile +++ b/scanner/Makefile @@ -11,13 +11,7 @@ $(NAME): $(NAME).lex clean: rm -f $(NAME).o $(NAME) $(NAME).c -1test: $(NAME) - @echo "execute cat test/1test | ./$(NAME)" - @cat test/1test | ./$(NAME) > tmp1 - @echo "execute cat test/2test | ./$(NAME)" - @cat test/2test | ./$(NAME) > tmp2 - -@diff tmp{1,2} - @rm tmp{1,2} +1test: 2test 2test: /usr/ftp/pub/ublu/test/$(NAME)/test 2>&1 diff --git a/scanner/test/1test b/scanner/test/1test deleted file mode 100644 index 9ab5ac8..0000000 --- a/scanner/test/1test +++ /dev/null @@ -1,11 +0,0 @@ -method blabb -var foo := 5; -if foo < 0x0F3 then - /* hier - kommt komm - mentar - */ - foo := foo - 0x3; -else - foo := foo * 4; -end diff --git a/scanner/test/2test b/scanner/test/2test deleted file mode 100644 index 8e1597a..0000000 --- a/scanner/test/2test +++ /dev/null @@ -1,7 +0,0 @@ -method blabb -var foo := 5; -if foo < 0x0F3 then - foo := foo - 0x3; -else - foo := foo * 4; -end diff --git a/test/scanner/a.0 b/test/scanner/a.0 new file mode 100644 index 0000000..9ab5ac8 --- /dev/null +++ b/test/scanner/a.0 @@ -0,0 +1,11 @@ +method blabb +var foo := 5; +if foo < 0x0F3 then + /* hier + kommt komm + mentar + */ + foo := foo - 0x3; +else + foo := foo * 4; +end diff --git a/test/scanner/a.out b/test/scanner/a.out new file mode 100644 index 0000000..ad769d9 --- /dev/null +++ b/test/scanner/a.out @@ -0,0 +1,26 @@ +method +ident blabb +var +ident foo +:= +num 5 +; +if +ident foo +< +num f3 +then +ident foo +:= +ident foo +- +num 3 +; +else +ident foo +:= +ident foo +* +num 4 +; +end diff --git a/test/scanner/b.0 b/test/scanner/b.0 new file mode 100644 index 0000000..8e1597a --- /dev/null +++ b/test/scanner/b.0 @@ -0,0 +1,7 @@ +method blabb +var foo := 5; +if foo < 0x0F3 then + foo := foo - 0x3; +else + foo := foo * 4; +end diff --git a/test/scanner/b.out b/test/scanner/b.out new file mode 100644 index 0000000..ad769d9 --- /dev/null +++ b/test/scanner/b.out @@ -0,0 +1,26 @@ +method +ident blabb +var +ident foo +:= +num 5 +; +if +ident foo +< +num f3 +then +ident foo +:= +ident foo +- +num 3 +; +else +ident foo +:= +ident foo +* +num 4 +; +end