commit ce2b644f251d5b22dc2228a0ffc8479408c49c38
parent 317ef5cfe36ddb9b9ab205826132ddd227a3db01
Author: Louis Burda <quent.burda@gmail.com>
Date: Wed, 26 Jul 2023 17:44:50 +0200
Add testing
Diffstat:
4 files changed, 17 insertions(+), 53 deletions(-)
diff --git a/test.sh 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
@@ -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
@@ -0,0 +1 @@
+test
diff --git a/test/xor.asm b/test/xor.asm
@@ -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