about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-13 22:38:40 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-13 22:38:40 -0800
commit188206bd546b5d6e62f483be6940a3826ac1ee43 (patch)
tree669fed4301d365f8f3d53d25fb9d577d370c7e22
parentf306071516c6f1b06aff7684a292bcc79eadad08 (diff)
downloadmu-188206bd546b5d6e62f483be6940a3826ac1ee43.tar.gz
558 - more chessboard tests
-rw-r--r--chessboard-cursor.arc.t39
1 files changed, 38 insertions, 1 deletions
diff --git a/chessboard-cursor.arc.t b/chessboard-cursor.arc.t
index a3edfab0..d52183a2 100644
--- a/chessboard-cursor.arc.t
+++ b/chessboard-cursor.arc.t
@@ -29,8 +29,8 @@
 ;? (= dump-trace* (obj whitelist '("schedule")))
 (run 'main)
 (each routine completed-routines*
+;?   (prn "  " routine)
   (awhen rep.routine!error
-;?     (prn "  " r)
     (prn "error - " it)))
 (if (~ran-to-completion 'read-move)
   (prn "F - chessboard accepts legal moves (<rank><file>-<rank><file>)"))
@@ -80,3 +80,40 @@
   (prn "F - chessboard quits on move starting with 'q'"))
 
 (reset)
+(new-trace "read-illegal-file")
+(add-code:readfile "chessboard-cursor.mu")
+(add-code
+  '((function! main [
+      (default-space:space-address <- new space:literal 30:literal/capacity)
+      (1:channel-address/raw <- init-channel 3:literal)
+      (r:integer/routine <- fork-helper read-file:fn nil:literal/globals nil:literal/limit)
+      (c:character <- copy ((#\i literal)))
+      (x:tagged-value <- save-type c:character)
+      (1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
+      (sleep until-routine-done:literal r:integer/routine)
+     ])))
+;? (= dump-trace* (obj whitelist '("schedule")))
+(run 'main)
+;? (each routine completed-routines*
+;?   (prn "  " routine))
+(if (ran-to-completion 'read-file)
+  (prn "F - 'read-file' checks that file lies between 'a' and 'h'"))
+
+(reset)
+(new-trace "read-illegal-rank")
+(add-code:readfile "chessboard-cursor.mu")
+(add-code
+  '((function! main [
+      (default-space:space-address <- new space:literal 30:literal/capacity)
+      (1:channel-address/raw <- init-channel 3:literal)
+      (r:integer/routine <- fork-helper read-rank:fn nil:literal/globals nil:literal/limit)
+      (c:character <- copy ((#\9 literal)))
+      (x:tagged-value <- save-type c:character)
+      (1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
+      (sleep until-routine-done:literal r:integer/routine)
+     ])))
+(run 'main)
+(if (ran-to-completion 'read-rank)
+  (prn "F - 'read-rank' checks that rank lies between '1' and '8'"))
+
+(reset)