about summary refs log tree commit diff stats
path: root/chessboard-cursor.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-17 18:50:32 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-17 18:50:32 -0800
commit33d602db6c5881b7cd26665a2a7002b257762928 (patch)
tree5c3a6349f6e9ba7e3f7cf57cb68df5fbfb2ae0e5 /chessboard-cursor.arc.t
parente047981d39cb812e5919b17f10b44a4f9b4e7b85 (diff)
downloadmu-33d602db6c5881b7cd26665a2a7002b257762928.tar.gz
582 - first tests for printing to screen
Diffstat (limited to 'chessboard-cursor.arc.t')
-rw-r--r--chessboard-cursor.arc.t57
1 files changed, 57 insertions, 0 deletions
diff --git a/chessboard-cursor.arc.t b/chessboard-cursor.arc.t
index 4cc4d0f5..662c0ee1 100644
--- a/chessboard-cursor.arc.t
+++ b/chessboard-cursor.arc.t
@@ -121,3 +121,60 @@
   (prn "F - 'read-rank' checks that rank lies between '1' and '8'"))
 
 (reset)
+(new-trace "print-board")
+(add-code:readfile "chessboard-cursor.mu")
+(add-code
+  '((function! main [
+      (default-space:space-address <- new space:literal 30:literal/capacity)
+      (initial-position:list-address <- init-list ((#\R literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\r literal))
+                                                  ((#\N literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\n literal))
+                                                  ((#\B literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\b literal))
+                                                  ((#\Q literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\q literal))
+                                                  ((#\K literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\k literal))
+                                                  ((#\B literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\b literal))
+                                                  ((#\N literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\n literal))
+                                                  ((#\R literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\r literal)))
+      (b:board-address <- init-board initial-position:list-address)
+      (screen:terminal-address <- init-fake-terminal 20:literal 10:literal)
+      (print-board screen:terminal-address b:board-address)
+      (5:string-address/raw <- get screen:terminal-address/deref data:offset)
+     ])))
+;? (set dump-trace*)
+;? (= dump-trace* (obj whitelist '("run")))
+(run 'main)
+(each routine completed-routines*
+  (awhen rep.routine!error
+    (prn "error - " it)))
+;? (prn memory*.5)
+;? (prn (memory* memory*.5))
+;? (write (memory* (+ memory*.5 1))) (prn)
+;? (write (memory* (+ memory*.5 4))) (prn)
+;? (write (memory* (+ memory*.5 5))) (prn)
+;? (prn:type (memory* (+ memory*.5 5)))
+;? (write (memory* (+ memory*.5 6))) (prn)
+;? (prn int-canon.memory*)
+;? (prn:len
+;?                         (+ "8 | r n b q k b n r "
+;?                            "7 | p p p p p p p p "
+;?                            "6 | _ _ _ _ _ _ _ _ "
+;?                            "5 | _ _ _ _ _ _ _ _ "
+;?                            "4 | _ _ _ _ _ _ _ _ "
+;?                            "3 | _ _ _ _ _ _ _ _ "
+;?                            "2 | P P P P P P P P "
+;?                            "1 | R N B Q K B N R "
+;?                            "  +---------------- "
+;?                            "    a b c d e f g h "))
+(when (~memory-contains-array memory*.5
+          (+ "8 | r n b q k b n r "
+             "7 | p p p p p p p p "
+             "6 | _ _ _ _ _ _ _ _ "
+             "5 | _ _ _ _ _ _ _ _ "
+             "4 | _ _ _ _ _ _ _ _ "
+             "3 | _ _ _ _ _ _ _ _ "
+             "2 | P P P P P P P P "
+             "1 | R N B Q K B N R "
+             "  +---------------- "
+             "    a b c d e f g h "))
+  (prn "F - print-board doesn't work; chessboard begins at @memory*.5"))
+
+(reset)