about summary refs log tree commit diff stats
path: root/baremetal/shell/print.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-03-01 23:46:00 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-03-01 23:49:53 -0800
commit249bef13d8058ff91cbb94e4b6559932ecebe519 (patch)
tree3040159edb15f2a637e838311155789335af59cb /baremetal/shell/print.mu
parent89b7ea80a5502dd3f5a611b15d426605c85aba3b (diff)
downloadmu-249bef13d8058ff91cbb94e4b6559932ecebe519.tar.gz
7840
Diffstat (limited to 'baremetal/shell/print.mu')
-rw-r--r--baremetal/shell/print.mu39
1 files changed, 39 insertions, 0 deletions
diff --git a/baremetal/shell/print.mu b/baremetal/shell/print.mu
index 9c8c719b..32f5e725 100644
--- a/baremetal/shell/print.mu
+++ b/baremetal/shell/print.mu
@@ -219,3 +219,42 @@ fn test-print-cell-singleton-list {
   print-cell list, out, 0/no-trace
   check-stream-equal out, "(abc)", "F - test-print-cell-singleton-list"
 }
+
+fn test-print-cell-list {
+  # list = cons "abc", nil
+  var left-storage: (handle cell)
+  var left/ecx: (addr handle cell) <- address left-storage
+  new-symbol left, "abc"
+  var nil-storage: (handle cell)
+  var nil/edx: (addr handle cell) <- address nil-storage
+  allocate-pair nil
+  var list-storage: (handle cell)
+  var list/esi: (addr handle cell) <- address list-storage
+  new-pair list, *left, *nil
+  # list = cons 64, list
+  new-integer left, 0x40
+  new-pair list, *left, *list
+  #
+  var out-storage: (stream byte 0x40)
+  var out/edi: (addr stream byte) <- address out-storage
+  print-cell list, out, 0/no-trace
+  check-stream-equal out, "(64 abc)", "F - test-print-cell-list"
+}
+
+fn test-print-dotted-list {
+  # list = cons 64, "abc"
+  var left-storage: (handle cell)
+  var left/ecx: (addr handle cell) <- address left-storage
+  new-symbol left, "abc"
+  var right-storage: (handle cell)
+  var right/edx: (addr handle cell) <- address right-storage
+  new-integer right, 0x40
+  var list-storage: (handle cell)
+  var list/esi: (addr handle cell) <- address list-storage
+  new-pair list, *left, *right
+  #
+  var out-storage: (stream byte 0x40)
+  var out/edi: (addr stream byte) <- address out-storage
+  print-cell list, out, 0/no-trace
+  check-stream-equal out, "(abc . 64)", "F - test-print-dotted-list"
+}