summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile6
-rw-r--r--test/invalid-hence/empty-1.hence0
-rw-r--r--test/invalid-hence/empty-1.hence.expected1
-rw-r--r--test/invalid-hence/empty-2.hence1
-rw-r--r--test/invalid-hence/empty-2.hence.expected1
-rw-r--r--test/invalid-hence/empty-3.hence2
-rw-r--r--test/invalid-hence/empty-3.hence.expected1
-rw-r--r--test/invalid-hence/empty-4.hence1
-rw-r--r--test/invalid-hence/empty-4.hence.expected1
-rw-r--r--test/invalid-hence/empty-5.hence1
-rw-r--r--test/invalid-hence/empty-5.hence.expected1
-rw-r--r--test/invalid-hence/empty-6.hence1
-rw-r--r--test/invalid-hence/empty-6.hence.expected1
-rw-r--r--test/invalid-hence/empty-7.hence1
-rw-r--r--test/invalid-hence/empty-7.hence.expected1
-rw-r--r--test/invalid-hence/empty-8.hence4
-rw-r--r--test/invalid-hence/empty-8.hence.expected1
-rw-r--r--test/invalid-hence/empty-9.hence2
-rw-r--r--test/invalid-hence/empty-9.hence.expected1
-rw-r--r--test/old/test-duplicate-input.c (renamed from test/test-duplicate-input.c)0
-rw-r--r--test/old/test-short-keyword.c (renamed from test/test-short-keyword.c)0
-rw-r--r--test/old/test-whitespace-input.c (renamed from test/test-whitespace-input.c)0
-rwxr-xr-xtest/run-lang-tests.sh28
23 files changed, 52 insertions, 4 deletions
diff --git a/test/Makefile b/test/Makefile
index 44d4969..1c99ced 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,9 +1,6 @@
CFLAGS += -I../
TESTS = \
- bin/test-whitespace-input \
- bin/test-short-keyword \
- bin/test-duplicate-input \
bin/test-logic-and \
bin/test-logic-or \
bin/test-logic-nand \
@@ -14,7 +11,7 @@ TESTS = \
all: $(TESTS)
-bin/test-%: test-%.c ../gate.o ../parser.o ../logic.o
+bin/test-%: test-%.c ../gate.o ../logic.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
.PHONY: clean
@@ -28,3 +25,4 @@ clean:
.PHONY: test
test:
./test.sh
+ ./run-lang-tests.sh
diff --git a/test/invalid-hence/empty-1.hence b/test/invalid-hence/empty-1.hence
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/invalid-hence/empty-1.hence
diff --git a/test/invalid-hence/empty-1.hence.expected b/test/invalid-hence/empty-1.hence.expected
new file mode 100644
index 0000000..bb92112
--- /dev/null
+++ b/test/invalid-hence/empty-1.hence.expected
@@ -0,0 +1 @@
+invalid-hence/empty-1.hence: Error: Expected module declaration, got end of file
diff --git a/test/invalid-hence/empty-2.hence b/test/invalid-hence/empty-2.hence
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/test/invalid-hence/empty-2.hence
@@ -0,0 +1 @@
+
diff --git a/test/invalid-hence/empty-2.hence.expected b/test/invalid-hence/empty-2.hence.expected
new file mode 100644
index 0000000..17a6d80
--- /dev/null
+++ b/test/invalid-hence/empty-2.hence.expected
@@ -0,0 +1 @@
+invalid-hence/empty-2.hence: Error: Expected module declaration, got end of file
diff --git a/test/invalid-hence/empty-3.hence b/test/invalid-hence/empty-3.hence
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/test/invalid-hence/empty-3.hence
@@ -0,0 +1,2 @@
+
+
diff --git a/test/invalid-hence/empty-3.hence.expected b/test/invalid-hence/empty-3.hence.expected
new file mode 100644
index 0000000..576aae5
--- /dev/null
+++ b/test/invalid-hence/empty-3.hence.expected
@@ -0,0 +1 @@
+invalid-hence/empty-3.hence: Error: Expected module declaration, got end of file
diff --git a/test/invalid-hence/empty-4.hence b/test/invalid-hence/empty-4.hence
new file mode 100644
index 0000000..0519ecb
--- /dev/null
+++ b/test/invalid-hence/empty-4.hence
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/test/invalid-hence/empty-4.hence.expected b/test/invalid-hence/empty-4.hence.expected
new file mode 100644
index 0000000..2d7a30b
--- /dev/null
+++ b/test/invalid-hence/empty-4.hence.expected
@@ -0,0 +1 @@
+invalid-hence/empty-4.hence: Error: Expected module declaration, got end of file
diff --git a/test/invalid-hence/empty-5.hence b/test/invalid-hence/empty-5.hence
new file mode 100644
index 0000000..8d1c8b6
--- /dev/null
+++ b/test/invalid-hence/empty-5.hence
@@ -0,0 +1 @@
+
diff --git a/test/invalid-hence/empty-5.hence.expected b/test/invalid-hence/empty-5.hence.expected
new file mode 100644
index 0000000..afd7eaf
--- /dev/null
+++ b/test/invalid-hence/empty-5.hence.expected
@@ -0,0 +1 @@
+invalid-hence/empty-5.hence: Error: Expected module declaration, got end of file
diff --git a/test/invalid-hence/empty-6.hence b/test/invalid-hence/empty-6.hence
new file mode 100644
index 0000000..501a6bb
--- /dev/null
+++ b/test/invalid-hence/empty-6.hence
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/test/invalid-hence/empty-6.hence.expected b/test/invalid-hence/empty-6.hence.expected
new file mode 100644
index 0000000..1869ba1
--- /dev/null
+++ b/test/invalid-hence/empty-6.hence.expected
@@ -0,0 +1 @@
+invalid-hence/empty-6.hence: Error: Expected module declaration, got end of file
diff --git a/test/invalid-hence/empty-7.hence b/test/invalid-hence/empty-7.hence
new file mode 100644
index 0000000..09c0ba9
--- /dev/null
+++ b/test/invalid-hence/empty-7.hence
@@ -0,0 +1 @@
+
diff --git a/test/invalid-hence/empty-7.hence.expected b/test/invalid-hence/empty-7.hence.expected
new file mode 100644
index 0000000..cf98e0c
--- /dev/null
+++ b/test/invalid-hence/empty-7.hence.expected
@@ -0,0 +1 @@
+invalid-hence/empty-7.hence: Error: Expected module declaration, got end of file
diff --git a/test/invalid-hence/empty-8.hence b/test/invalid-hence/empty-8.hence
new file mode 100644
index 0000000..0b2d044
--- /dev/null
+++ b/test/invalid-hence/empty-8.hence
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/test/invalid-hence/empty-8.hence.expected b/test/invalid-hence/empty-8.hence.expected
new file mode 100644
index 0000000..834673e
--- /dev/null
+++ b/test/invalid-hence/empty-8.hence.expected
@@ -0,0 +1 @@
+invalid-hence/empty-8.hence: Error: Expected module declaration, got end of file
diff --git a/test/invalid-hence/empty-9.hence b/test/invalid-hence/empty-9.hence
new file mode 100644
index 0000000..de13416
--- /dev/null
+++ b/test/invalid-hence/empty-9.hence
@@ -0,0 +1,2 @@
+
+ \ No newline at end of file
diff --git a/test/invalid-hence/empty-9.hence.expected b/test/invalid-hence/empty-9.hence.expected
new file mode 100644
index 0000000..1b4af21
--- /dev/null
+++ b/test/invalid-hence/empty-9.hence.expected
@@ -0,0 +1 @@
+invalid-hence/empty-9.hence: Error: Expected module declaration, got end of file
diff --git a/test/test-duplicate-input.c b/test/old/test-duplicate-input.c
index 8d1b88f..8d1b88f 100644
--- a/test/test-duplicate-input.c
+++ b/test/old/test-duplicate-input.c
diff --git a/test/test-short-keyword.c b/test/old/test-short-keyword.c
index b3baa2c..b3baa2c 100644
--- a/test/test-short-keyword.c
+++ b/test/old/test-short-keyword.c
diff --git a/test/test-whitespace-input.c b/test/old/test-whitespace-input.c
index cb4ec22..cb4ec22 100644
--- a/test/test-whitespace-input.c
+++ b/test/old/test-whitespace-input.c
diff --git a/test/run-lang-tests.sh b/test/run-lang-tests.sh
new file mode 100755
index 0000000..5cc68b3
--- /dev/null
+++ b/test/run-lang-tests.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+cd "$(dirname $0)"
+EXECUTABLE="$PWD/../simulator"
+
+echo $PWD
+
+for src in invalid-hence/*.hence ; do
+ outfile="$(mktemp)"
+ "$EXECUTABLE" "$src" 2> "$outfile"
+ if diff "$src.expected" "$outfile" ; then
+ echo -ne '[\e[0;32mPASS\e[0m]'
+ rm "$outfile"
+ else
+ echo -ne '[\e[1;31mFAIL\e[0m]'
+ fi
+ echo " $src"
+done
+
+#for src in valid-hence/*.hence ; do
+# outfile="$(mktemp)"
+# "$EXECUTABLE" "$src" > "$outfile"
+# if diff "$src.expected" "$outfile" >/dev/null ; then
+# echo "$src: PASS"
+# else
+# echo "$src: FAIL"
+# fi
+#done