Run unit tests with zasm

This commit is contained in:
Virgil Dupras 2019-05-20 07:50:23 -04:00
parent d2c6e21c64
commit ae315499cb
4 changed files with 34 additions and 30 deletions

View File

@ -3,14 +3,12 @@
set -e set -e
set -o pipefail set -o pipefail
SCAS=scas ZASM=../../emul/zasm/zasm
KERNEL=../../../kernel
APPS=../../../apps
RUNBIN=../../emul/runbin/runbin RUNBIN=../../emul/runbin/runbin
for fn in *.asm; do for fn in *.asm; do
echo "Running test ${fn}" 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]}" echo "failed with code ${PIPESTATUS[1]}"
exit 1 exit 1
fi fi

View File

@ -32,10 +32,11 @@ test:
ld hl, s1 ld hl, s1
call parseExpr call parseExpr
jp nz, fail jp nz, fail
ld a, ixh push ix \ pop hl
ld a, h
or a or a
jp nz, fail jp nz, fail
ld a, ixl ld a, l
cp 4 cp 4
jp nz, fail jp nz, fail
call nexttest call nexttest
@ -43,10 +44,11 @@ test:
ld hl, s2 ld hl, s2
call parseExpr call parseExpr
jp nz, fail jp nz, fail
ld a, ixh push ix \ pop hl
ld a, h
cp 0x40 cp 0x40
jp nz, fail jp nz, fail
ld a, ixl ld a, l
cp 0x23 cp 0x23
jp nz, fail jp nz, fail
call nexttest call nexttest
@ -65,10 +67,11 @@ test:
ld hl, s3 ld hl, s3
call parseExpr call parseExpr
jp nz, fail jp nz, fail
ld a, ixh push ix \ pop hl
ld a, h
cp 0x40 cp 0x40
jp nz, fail jp nz, fail
ld a, ixl ld a, l
cp 0x20 cp 0x20
jp nz, fail jp nz, fail
call nexttest call nexttest
@ -76,10 +79,11 @@ test:
ld hl, s4 ld hl, s4
call parseExpr call parseExpr
jp nz, fail jp nz, fail
ld a, ixh push ix \ pop hl
ld a, h
or a or a
jp nz, fail jp nz, fail
ld a, ixl ld a, l
cp 0x60 cp 0x60
jp nz, fail jp nz, fail
call nexttest call nexttest
@ -87,10 +91,11 @@ test:
ld hl, s5 ld hl, s5
call parseExpr call parseExpr
jp nz, fail jp nz, fail
ld a, ixh push ix \ pop hl
ld a, h
cp 0x3f cp 0x3f
jp nz, fail jp nz, fail
ld a, ixl ld a, l
cp 0xfd cp 0xfd
jp nz, fail jp nz, fail
call nexttest call nexttest
@ -98,10 +103,11 @@ test:
ld hl, s6 ld hl, s6
call parseExpr call parseExpr
jp nz, fail jp nz, fail
ld a, ixh push ix \ pop hl
ld a, h
cp 0x40 cp 0x40
jp nz, fail jp nz, fail
ld a, ixl ld a, l
cp 0x80 cp 0x80
jp nz, fail jp nz, fail
call nexttest call nexttest
@ -119,6 +125,3 @@ nexttest:
fail: fail:
ld a, (testNum) ld a, (testNum)
halt halt

View File

@ -39,14 +39,14 @@ test:
jp nz, fail jp nz, fail
call nexttest call nexttest
ld hl, sab ld hl, saB
call parseHexPair call parseHexPair
jp c, fail jp c, fail
cp 0xab cp 0xab
jp nz, fail jp nz, fail
call nexttest call nexttest
ld hl, sfoo ld hl, sFoo
call parseHexPair call parseHexPair
jp nc, fail jp nc, fail
call nexttest call nexttest
@ -64,4 +64,3 @@ nexttest:
fail: fail:
ld a, (testNum) ld a, (testNum)
halt halt

View File

@ -28,10 +28,11 @@ test:
ld hl, s99 ld hl, s99
call parseLiteral call parseLiteral
jp nz, fail jp nz, fail
ld a, ixh push ix \ pop hl
ld a, h
or a or a
jp nz, fail jp nz, fail
ld a, ixl ld a, l
cp 99 cp 99
jp nz, fail jp nz, fail
call nexttest call nexttest
@ -39,10 +40,11 @@ test:
ld hl, s0x100 ld hl, s0x100
call parseLiteral call parseLiteral
jp nz, fail jp nz, fail
ld a, ixh push ix \ pop hl
ld a, h
cp 1 cp 1
jp nz, fail jp nz, fail
ld a, ixl ld a, l
or a or a
jp nz, fail jp nz, fail
call nexttest call nexttest
@ -55,10 +57,11 @@ test:
ld hl, s0b0101 ld hl, s0b0101
call parseLiteral call parseLiteral
jp nz, fail jp nz, fail
ld a, ixh push ix \ pop hl
ld a, h
or a or a
jp nz, fail jp nz, fail
ld a, ixl ld a, l
cp 0b0101 cp 0b0101
jp nz, fail jp nz, fail
call nexttest call nexttest
@ -66,10 +69,11 @@ test:
ld hl, s0b01010101 ld hl, s0b01010101
call parseLiteral call parseLiteral
jp nz, fail jp nz, fail
ld a, ixh push ix \ pop hl
ld a, h
or a or a
jp nz, fail jp nz, fail
ld a, ixl ld a, l
cp 0b01010101 cp 0b01010101
jp nz, fail jp nz, fail
call nexttest call nexttest