about summary refs log tree commit diff stats
path: root/mu.arc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-12-13 00:49:58 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-12-13 00:49:58 -0800
commit18b92d77c9691177098714ce37b053b915403863 (patch)
tree908d636561b1f6ec3d70192807895c711087083c /mu.arc
parent4f9f75ddcf0a4dd2d6db9c6d2a59eaf72b17d47d (diff)
downloadmu-18b92d77c9691177098714ce37b053b915403863.tar.gz
406 - mu tests run at level 10
We're now going to start doing surgery on low-level helpers.
Diffstat (limited to 'mu.arc')
-rw-r--r--mu.arc29
1 files changed, 29 insertions, 0 deletions
diff --git a/mu.arc b/mu.arc
index ce5bf92d..b578db06 100644
--- a/mu.arc
+++ b/mu.arc
@@ -1359,6 +1359,35 @@
 ;?     (= function*.name (convert-names:convert-labels:convert-braces:prn:insert-code body)))
     (= function*.name (convert-names:convert-labels:convert-braces:insert-code body name))))
 
+;; test helpers
+
+(def memory-contains (addr value)
+;?   (prn "Looking for @value starting at @addr")
+  (loop (addr addr
+         idx  0)
+;?     (prn "@idx vs @addr")
+    (if (>= idx len.value)
+          t
+        (~is memory*.addr value.idx)
+          (do1 nil
+               (prn "@addr should contain @value.idx but contains @memory*.addr"))
+        :else
+          (recur (+ addr 1) (+ idx 1)))))
+
+(def memory-contains-array (addr value)
+;?   (prn "Looking for @value starting at @addr, size @memory*.addr vs @len.value")
+  (and (>= memory*.addr len.value)
+       (loop (addr (+ addr 1)
+              idx  0)
+;?          (prn "comparing @memory*.addr and @value.idx")
+         (if (>= idx len.value)
+               t
+             (~is memory*.addr value.idx)
+               (do1 nil
+                    (prn "@addr should contain @value.idx but contains @memory*.addr"))
+             :else
+               (recur (+ addr 1) (+ idx 1))))))
+
 ;; load all provided files and start at 'main'
 (reset)
 (awhen (pos "--" argv)