about summary refs log tree commit diff stats
path: root/mu.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-08-28 16:40:28 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-08-28 16:40:28 -0700
commitfbe15a986a12998b84f82e2a70dbfaf69043ee12 (patch)
tree3b37a36350d3620e5f0743abb478c1661eab9eda /mu.arc.t
parentd95ed21da9bbec9b1aca098866e7c08944f5d6b6 (diff)
downloadmu-fbe15a986a12998b84f82e2a70dbfaf69043ee12.tar.gz
82
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t41
1 files changed, 41 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t
index 0b89873f..7974bf4d 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -31,6 +31,17 @@
 ;? (prn memory*)
 (if (~iso memory* (obj 1 1  2 3  3 4))
   (prn "F - calling a user-defined function runs its instructions"))
+;? (quit)
+
+(reset)
+(add-fns
+  '((test1
+      ((1 integer) <- literal 1))
+    (main
+      (test1))))
+(if (~iso 2 (run 'main))
+  (prn "F - calling a user-defined function runs its instructions exactly once"))
+;? (quit)
 
 (reset)
 (add-fns
@@ -50,6 +61,35 @@
 
 (reset)
 (add-fns
+  `((test1
+      ((3 integer) <- test2))
+    (test2
+      (reply (2 integer)))
+    (main
+      ((2 integer) <- literal 34)
+      (test1))))
+(run 'main)
+;? (prn memory*)
+(if (~iso memory* (obj 2 34  3 34))
+  (prn "F - 'reply' stops executing any callers as necessary"))
+;? (quit)
+
+(reset)
+(add-fns
+  '((test1
+      ((3 integer) <- add (1 integer) (2 integer))
+      (reply)
+      ((4 integer) <- literal 34))
+    (main
+      ((1 integer) <- literal 1)
+      ((2 integer) <- literal 3)
+      (test1))))
+(if (~iso 4 (run 'main))  ; last reply sometimes not counted. worth fixing?
+  (prn "F - 'reply' executes instructions exactly once"))
+;? (quit)
+
+(reset)
+(add-fns
   '((test1
       ((4 integer) <- arg)
       ((5 integer) <- arg)
@@ -254,6 +294,7 @@
 ;? (prn memory*)
 (if (~iso memory* (obj 1 8))
   (prn "F - 'jmp' doesn't skip too many instructions"))
+;? (quit)
 
 (reset)
 (add-fns