about summary refs log tree commit diff stats
path: root/sys.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-08-23 10:17:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-08-23 10:17:33 -0700
commitad9e48b34b8b83c9eb196c6608de145c7960854c (patch)
treec5cfb46225ef69961ecd4d6b6fb2cd8c88f70bd5 /sys.arc.t
parent2ee76bda373acdce71f560908e7c15ae7d97b8f8 (diff)
downloadmu-ad9e48b34b8b83c9eb196c6608de145c7960854c.tar.gz
73
Diffstat (limited to 'sys.arc.t')
-rw-r--r--sys.arc.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys.arc.t b/sys.arc.t
new file mode 100644
index 00000000..3a5d0acf
--- /dev/null
+++ b/sys.arc.t
@@ -0,0 +1,23 @@
+(load "new.arc")
+
+(reset)
+;? (prn memory*)
+(if (~iso memory*.Root_custodian Allocator_start)
+  (prn "F - allocator initialized"))
+
+(reset)
+(add-fns
+  '((main
+      ((x integer-address) <- new)
+      ((x integer-address deref) <- literal 34))))
+(run function*!main)
+;? (prn memory*)
+(if (~iso memory*.Root_custodian (+ Allocator_start 1))
+  (prn "F - 'new' increments allocator pointer"))
+(if (~iso memory*.Allocator_start 34)
+  (prn "F - 'new' returns old location"))
+
+; other tests to express:
+;  no other function can increment the pointer
+;  no later clause can increment the pointer after this base clause
+;  multiple threads/routines can't call the allocator at once