From ae315499cb46d5adb8cb289c0e35c91be8e4c198 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 20 May 2019 07:50:23 -0400 Subject: [PATCH] Run unit tests with zasm --- tools/tests/unit/runtests.sh | 6 ++---- tools/tests/unit/test_expr.asm | 33 ++++++++++++++++++--------------- tools/tests/unit/test_parse.asm | 5 ++--- tools/tests/unit/test_parse_z.asm | 20 ++++++++++++-------- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/tools/tests/unit/runtests.sh b/tools/tests/unit/runtests.sh index ef6b07b..65113db 100755 --- a/tools/tests/unit/runtests.sh +++ b/tools/tests/unit/runtests.sh @@ -3,14 +3,12 @@ set -e set -o pipefail -SCAS=scas -KERNEL=../../../kernel -APPS=../../../apps +ZASM=../../emul/zasm/zasm RUNBIN=../../emul/runbin/runbin for fn in *.asm; do echo "Running test ${fn}" - if ! ${SCAS} -I ${KERNEL} -I ${APPS} -o - ${fn} | ${RUNBIN}; then + if ! ${ZASM} < ${fn} | ${RUNBIN}; then echo "failed with code ${PIPESTATUS[1]}" exit 1 fi diff --git a/tools/tests/unit/test_expr.asm b/tools/tests/unit/test_expr.asm index cda79c2..0924ba6 100644 --- a/tools/tests/unit/test_expr.asm +++ b/tools/tests/unit/test_expr.asm @@ -32,10 +32,11 @@ test: ld hl, s1 call parseExpr jp nz, fail - ld a, ixh + push ix \ pop hl + ld a, h or a jp nz, fail - ld a, ixl + ld a, l cp 4 jp nz, fail call nexttest @@ -43,10 +44,11 @@ test: ld hl, s2 call parseExpr jp nz, fail - ld a, ixh + push ix \ pop hl + ld a, h cp 0x40 jp nz, fail - ld a, ixl + ld a, l cp 0x23 jp nz, fail call nexttest @@ -65,10 +67,11 @@ test: ld hl, s3 call parseExpr jp nz, fail - ld a, ixh + push ix \ pop hl + ld a, h cp 0x40 jp nz, fail - ld a, ixl + ld a, l cp 0x20 jp nz, fail call nexttest @@ -76,10 +79,11 @@ test: ld hl, s4 call parseExpr jp nz, fail - ld a, ixh + push ix \ pop hl + ld a, h or a jp nz, fail - ld a, ixl + ld a, l cp 0x60 jp nz, fail call nexttest @@ -87,10 +91,11 @@ test: ld hl, s5 call parseExpr jp nz, fail - ld a, ixh + push ix \ pop hl + ld a, h cp 0x3f jp nz, fail - ld a, ixl + ld a, l cp 0xfd jp nz, fail call nexttest @@ -98,10 +103,11 @@ test: ld hl, s6 call parseExpr jp nz, fail - ld a, ixh + push ix \ pop hl + ld a, h cp 0x40 jp nz, fail - ld a, ixl + ld a, l cp 0x80 jp nz, fail call nexttest @@ -119,6 +125,3 @@ nexttest: fail: ld a, (testNum) halt - - - diff --git a/tools/tests/unit/test_parse.asm b/tools/tests/unit/test_parse.asm index 12dac0a..6654f9b 100644 --- a/tools/tests/unit/test_parse.asm +++ b/tools/tests/unit/test_parse.asm @@ -39,14 +39,14 @@ test: jp nz, fail call nexttest - ld hl, sab + ld hl, saB call parseHexPair jp c, fail cp 0xab jp nz, fail call nexttest - ld hl, sfoo + ld hl, sFoo call parseHexPair jp nc, fail call nexttest @@ -64,4 +64,3 @@ nexttest: fail: ld a, (testNum) halt - diff --git a/tools/tests/unit/test_parse_z.asm b/tools/tests/unit/test_parse_z.asm index ecb7131..ff88dac 100644 --- a/tools/tests/unit/test_parse_z.asm +++ b/tools/tests/unit/test_parse_z.asm @@ -28,10 +28,11 @@ test: ld hl, s99 call parseLiteral jp nz, fail - ld a, ixh + push ix \ pop hl + ld a, h or a jp nz, fail - ld a, ixl + ld a, l cp 99 jp nz, fail call nexttest @@ -39,10 +40,11 @@ test: ld hl, s0x100 call parseLiteral jp nz, fail - ld a, ixh + push ix \ pop hl + ld a, h cp 1 jp nz, fail - ld a, ixl + ld a, l or a jp nz, fail call nexttest @@ -55,10 +57,11 @@ test: ld hl, s0b0101 call parseLiteral jp nz, fail - ld a, ixh + push ix \ pop hl + ld a, h or a jp nz, fail - ld a, ixl + ld a, l cp 0b0101 jp nz, fail call nexttest @@ -66,10 +69,11 @@ test: ld hl, s0b01010101 call parseLiteral jp nz, fail - ld a, ixh + push ix \ pop hl + ld a, h or a jp nz, fail - ld a, ixl + ld a, l cp 0b01010101 jp nz, fail call nexttest