about summary refs log tree commit diff stats
path: root/403stream.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-07-30 19:22:40 -0700
committerKartik Agaram <vc@akkartik.com>2020-07-30 19:22:40 -0700
commitca237761bf0f9b16838e2d3f7079d1725e3bd87b (patch)
tree6d2c53882c593b0234e1d056a543edfd3ecc8c62 /403stream.mu
parent9cbd4199f376fdccbf08bf2ac15b48c4310e36c4 (diff)
downloadmu-ca237761bf0f9b16838e2d3f7079d1725e3bd87b.tar.gz
6686
Diffstat (limited to '403stream.mu')
-rw-r--r--403stream.mu15
1 files changed, 15 insertions, 0 deletions
diff --git a/403stream.mu b/403stream.mu
new file mode 100644
index 00000000..e7661658
--- /dev/null
+++ b/403stream.mu
@@ -0,0 +1,15 @@
+# Tests for Mu's stream primitives.
+
+fn test-stream {
+  # write an int to a stream, then read it back
+  var s: (stream int 4)
+  var s2/ecx: (addr stream int 4) <- address s
+  var x: int
+  copy-to x, 0x34
+  var x2/edx: (addr int) <- address x
+  write-to-stream s2, x2
+  var y: int
+  var y2/ebx: (addr int) <- address y
+  read-from-stream s2, y2
+  check-ints-equal y, 0x34, "F - test-stream"
+}