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 -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

View File

@ -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

View File

@ -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

View File

@ -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