summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-07-26 17:44:50 +0200
committerLouis Burda <quent.burda@gmail.com>2023-07-26 17:44:50 +0200
commitce2b644f251d5b22dc2228a0ffc8479408c49c38 (patch)
tree78b2f7005499c65858f2372f64ccad95bf369032
parent317ef5cfe36ddb9b9ab205826132ddd227a3db01 (diff)
downloadtis100-ce2b644f251d5b22dc2228a0ffc8479408c49c38.tar.gz
tis100-ce2b644f251d5b22dc2228a0ffc8479408c49c38.zip
Add testing
-rw-r--r--test.sh16
-rw-r--r--test/and.asm27
-rw-r--r--test/ports.out1
-rw-r--r--test/xor.asm26
4 files changed, 17 insertions, 53 deletions
diff --git a/test.sh b/test.sh
new file mode 100644
index 0000000..ad786c7
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+
+for f in test/*.asm; do
+ in="$(echo "$f" | cut -d. -f1).in"
+ out="$(echo "$f" | cut -d. -f1).out"
+ tmp="/tmp/tis-test.out"
+ ./tis-as "$f" "$in" "$tmp"
+ if [ $? -ne 0 ]; then
+ echo "$f"
+ elif ! diff "$out" "$tmp"; then
+ cat "$tmp" | xxd 1>&2
+ cat "$out" | xxd 1>&2
+ echo "$f"
+ fi
+done
diff --git a/test/and.asm b/test/and.asm
deleted file mode 100644
index c4a15a6..0000000
--- a/test/and.asm
+++ /dev/null
@@ -1,27 +0,0 @@
-stdout X1 Y1
-
-tpu X1 Y0
- mov 0, DOWN
- mov 1, DOWN
- mov 0, DOWN
- mov 1, DOWN
- MOV UP, NIL
-end
-
-tpu X0 Y1
- mov 0, RIGHT
- mov 0, RIGHT
- mov 1, RIGHT
- mov 1, RIGHT
- MOV UP, NIL
-end
-
-tpu X1 Y1
- mov 2, ACC
- sub UP
- sub LEFT
- jez H
- mov 0, DOWN
- jro 2
-H: mov 1, DOWN
-end
diff --git a/test/ports.out b/test/ports.out
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/test/ports.out
@@ -0,0 +1 @@
+test
diff --git a/test/xor.asm b/test/xor.asm
deleted file mode 100644
index 7e24812..0000000
--- a/test/xor.asm
+++ /dev/null
@@ -1,26 +0,0 @@
-stdout X1 Y1
-
-tpu X1 Y0
- mov 0, DOWN
- mov 1, DOWN
- mov 0, DOWN
- mov 1, DOWN
- MOV UP, NIL
-end
-
-tpu X0 Y1
- mov 0, RIGHT
- mov 0, RIGHT
- mov 1, RIGHT
- mov 1, RIGHT
- MOV UP, NIL
-end
-
-tpu X1 Y1
- MOV UP, ACC
- sub LEFT
- jnz H
- mov 0, DOWN
- jro 2
-H: mov 1, DOWN
-end