about summary refs log tree commit diff stats
path: root/apps/tests.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-15 22:21:15 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-15 22:52:41 -0700
commitae470b42f102d5da4f7d4255a47e3cf582079f33 (patch)
treeaa251ea7734370b9c152a5cf08a7b97c9c1de0c1 /apps/tests.subx
parent8815cf7d57e738731dfc43680b4eccbaef9d822c (diff)
downloadmu-ae470b42f102d5da4f7d4255a47e3cf582079f33.tar.gz
6781 - new app: RPN (postfix) calculator
This was surprisingly hard; bugs discovered all over the place.
Diffstat (limited to 'apps/tests.subx')
-rw-r--r--apps/tests.subx12
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/tests.subx b/apps/tests.subx
index 75f8ef22..d61ea137 100644
--- a/apps/tests.subx
+++ b/apps/tests.subx
@@ -80,6 +80,8 @@ subx-gen-run-tests:  # in: (addr buffered-file), out: (addr buffered-file)
     #     read-line-buffered(in, line)
     #     if (line->write == 0) break               # end of file
     #     var word-slice = next-word(line)
+    #     if slice-empty?(word-slice)               # empty line
+    #       continue
     #     if is-label?(word-slice)
     #       if slice-starts-with?(word-slice, "test-")
     #         tests-found = true
@@ -184,6 +186,16 @@ $subx-gen-run-tests:check0:
     e8/call  next-word/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
+$subx-gen-run-tests:check-empty:
+    # if slice-empty?(word-slice) break
+    # . eax = slice-empty?(word-slice)
+    52/push-edx
+    e8/call  slice-empty?/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
+    # . if (eax != false) break
+    3d/compare-eax-and  0/imm32/false
+    75/jump-if-!=  $subx-gen-run-tests:loop/disp8
 $subx-gen-run-tests:check-for-label:
     # if (!is-label?(word-slice)) continue
     # . eax = is-label?(word-slice)