about summary refs log tree commit diff stats
path: root/baremetal/115write-byte.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-15 20:51:02 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-15 21:11:30 -0800
commit8ed27ce4319eb843ee021ca0b1cb46d275c2f89d (patch)
tree67439343bb4be931cd712120aafe69b8023892ed /baremetal/115write-byte.subx
parent6e36ce06dd035408d43a6599b75b933a0709cc78 (diff)
downloadmu-8ed27ce4319eb843ee021ca0b1cb46d275c2f89d.tar.gz
7522 - bring back a few tests in .subx files
Even though baremetal has tests in SubX, they can only run in Mu
programs since the test harness is currently in a Mu layer. Baremetal
isn't really intended for running SubX programs at the moment. Is this a
step down the slippery slope towards C compilers that I complained about
in http://akkartik.name/akkartik-convivial-20200607.pdf?
Diffstat (limited to 'baremetal/115write-byte.subx')
-rw-r--r--baremetal/115write-byte.subx30
1 files changed, 30 insertions, 0 deletions
diff --git a/baremetal/115write-byte.subx b/baremetal/115write-byte.subx
index d69663bc..af32f610 100644
--- a/baremetal/115write-byte.subx
+++ b/baremetal/115write-byte.subx
@@ -35,4 +35,34 @@ $append-byte:end:
     5d/pop-to-ebp
     c3/return
 
+test-append-byte-single:
+    # - check that append-byte writes to first byte of 'file'
+    # setup
+    # . clear-stream(_test-stream)
+    # . . push args
+    68/push  _test-stream/imm32
+    # . . call
+    e8/call  clear-stream/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
+    # append-byte(_test-stream, 'A')
+    # . . push args
+    68/push  0x41/imm32
+    68/push  _test-stream/imm32
+    # . . call
+    e8/call  append-byte/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
+    # check-stream-equal(_test-stream, "A", msg)
+    # . . push args
+    68/push  "F - test-append-byte-single"/imm32
+    68/push  "A"/imm32
+    68/push  _test-stream/imm32
+    # . . call
+    e8/call  check-stream-equal/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
+    # . end
+    c3/return
+
 # . . vim:nowrap:textwidth=0