about summary refs log tree commit diff stats
path: root/new.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-08-19 12:02:40 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-08-19 12:02:40 -0700
commit889e4b958e0755eb18f4d545ba4f191d9ea0296c (patch)
treecf741bd6858a4f4c9eeb5fdbd1c9f4edd578f22c /new.arc.t
parent955ecf4a45312c495403aacc0b687a4bc33844ec (diff)
downloadmu-889e4b958e0755eb18f4d545ba4f191d9ea0296c.tar.gz
53 - simplest possible allocator: just one word at a time
But with tests this time.
Diffstat (limited to 'new.arc.t')
-rw-r--r--new.arc.t19
1 files changed, 19 insertions, 0 deletions
diff --git a/new.arc.t b/new.arc.t
new file mode 100644
index 00000000..e256ea86
--- /dev/null
+++ b/new.arc.t
@@ -0,0 +1,19 @@
+(load "mu.arc")
+(load "new.arc")
+
+(reset)
+(add-fns
+  '((main)))
+(run function*!main)
+(if (~iso memory* (obj Root_allocator_pointer 1000))
+  (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_allocator_pointer 1001)
+  (prn "F - 'new' increments allocator pointer"))