diff --git a/apps/zasm/main.asm b/apps/zasm/main.asm index 94aa6a2..d538298 100644 --- a/apps/zasm/main.asm +++ b/apps/zasm/main.asm @@ -56,7 +56,7 @@ ; *** Code *** jp zasmMain -#include "util.asm" +#include "util_z.asm" .equ IO_RAMSTART ZASM_RAMEND #include "io.asm" #include "tok.asm" diff --git a/apps/zasm/util.asm b/apps/zasm/util_z.asm similarity index 100% rename from apps/zasm/util.asm rename to apps/zasm/util_z.asm diff --git a/tools/tests/unit/runtests.sh b/tools/tests/unit/runtests.sh index 59f954a..5895a80 100755 --- a/tools/tests/unit/runtests.sh +++ b/tools/tests/unit/runtests.sh @@ -5,11 +5,12 @@ set -o pipefail SCAS=scas PARTS=../../../parts/z80 +ZASMDIR=../../../apps/zasm RUNBIN=../../emul/runbin/runbin for fn in *.asm; do echo "Running test ${fn}" - if ! ${SCAS} -I ${PARTS} -o - ${fn} | ${RUNBIN}; then + if ! ${SCAS} -I ${PARTS} -I ${ZASMDIR} -o - ${fn} | ${RUNBIN}; then echo "failed with code ${PIPESTATUS[1]}" exit 1 fi diff --git a/tools/tests/unit/test_parse_z.asm b/tools/tests/unit/test_parse_z.asm new file mode 100644 index 0000000..a605228 --- /dev/null +++ b/tools/tests/unit/test_parse_z.asm @@ -0,0 +1,55 @@ +jp test + +#include "core.asm" +#include "parse.asm" +#include "util_z.asm" +#include "parse_z.asm" + +; mocks. aren't used in tests +zasmIsFirstPass: +symSelect: +symFind: +symGetVal: + jp fail + +testNum: .db 1 + +s99: .db "99", 0 +s0x99: .db "0x99", 0 +sFoo: .db "Foo", 0 + +test: + ld hl, 0xffff + ld sp, hl + + ld hl, s99 + call parseLiteral + jp nz, fail + ld a, ixh + or a + jp nz, fail + ld a, ixl + cp 99 + jp nz, fail + call nexttest + + ld hl, sFoo + call parseLiteral + jp z, fail + call nexttest + + ; success + xor a + halt + +nexttest: + ld a, (testNum) + inc a + ld (testNum), a + ret + +fail: + ld a, (testNum) + halt + +