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 20:44:16 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-08-28 20:44:16 -0700
commitf3b0f4dc0513388135a57961b5a7a00fd2b9e4e6 (patch)
tree0be201c936adb0c0b29123cd425dad9b6528ecc0 /mu.arc.t
parentaa66c8327de1b6ccae47cd107d8f99241da97487 (diff)
downloadmu-f3b0f4dc0513388135a57961b5a7a00fd2b9e4e6.tar.gz
89 - a simple round-robin scheduler
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t24
1 files changed, 24 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t
index f02f9610..2ab4d9c8 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -662,3 +662,27 @@
     (prn "F - 'new' returns current high-water mark"))
   (if (~iso Memory-in-use-until (+ before 5))
     (prn "F - 'new' on primitive arrays increments high-water mark by their size")))
+
+(reset)
+(add-fns
+  '((f1
+      ((1 integer) <- literal 3))
+    (f2
+      ((2 integer) <- literal 4))))
+(enq make-context!f1 contexts*)
+(enq make-context!f2 contexts*)
+(let ninsts (run)
+  (when (~iso 2 ninsts)
+    (prn "F - scheduler didn't run the right number of instructions: " ninsts)))
+(if (~iso memory* (obj 1 3  2 4))
+  (prn "F - scheduler runs multiple functions: " memory*))
+(check-trace-contents "scheduler orders functions correctly"
+  '(("schedule" "f1")
+    ("schedule" "f2")
+  ))
+(check-trace-contents "scheduler orders schedule and run events correctly"
+  '(("schedule" "f1")
+    ("run" "f1 0")
+    ("schedule" "f2")
+    ("run" "f2 0")
+  ))