scanner/parser: offizielle test{faelle,skripten} sind da :)
authorBernhard Urban <lewurm@gmail.com>
Mon, 22 Mar 2010 21:14:26 +0000 (22:14 +0100)
committerBernhard Urban <lewurm@gmail.com>
Mon, 22 Mar 2010 21:14:26 +0000 (22:14 +0100)
parser/09test.sh [deleted file]
parser/Makefile
scanner/Makefile
scanner/test/1test [deleted file]
scanner/test/2test [deleted file]
test/scanner/a.0 [new file with mode: 0644]
test/scanner/a.out [new file with mode: 0644]
test/scanner/b.0 [new file with mode: 0644]
test/scanner/b.out [new file with mode: 0644]

diff --git a/parser/09test.sh b/parser/09test.sh
deleted file mode 100755 (executable)
index ab33935..0000000
+++ /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"
index 6a9ff6f314409532d72c88b692b0e1202ff457e4..057281a755454de0388a0f0d8d2435ec5b632f40 100644 (file)
@@ -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
index e29faecd9d4e16e97043460a61d56bb9f78cd42b..50a3dddcd3f153d71c95cde442f5f7c066d0e387 100755 (executable)
@@ -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 (file)
index 9ab5ac8..0000000
+++ /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 (file)
index 8e1597a..0000000
+++ /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 (file)
index 0000000..9ab5ac8
--- /dev/null
@@ -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 (file)
index 0000000..ad769d9
--- /dev/null
@@ -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 (file)
index 0000000..8e1597a
--- /dev/null
@@ -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 (file)
index 0000000..ad769d9
--- /dev/null
@@ -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