summary refs log tree commit diff
path: root/lib/mill.test.fnl
diff options
context:
space:
mode:
authordozens2024-06-20 09:17:06 -0600
committerdozens2024-06-20 09:17:06 -0600
commitc7b2c982004e350f5e3032321baadfc9021b6bad (patch)
tree3f8883c94bed5a1f847cf60cb11207ca53946c67 /lib/mill.test.fnl
parentce09973e7cacccdc779f91b8e6e48a520b9f9f4d (diff)
🗄️ big tidy up
- isolate core game logic and move it to src/game.fnl
- main.fnl should be just the ui now
- move all table funcs into lib/table
- move all (1) string funcs into lib/string
- move all game funcs into lib/game/
Diffstat (limited to 'lib/mill.test.fnl')
-rw-r--r--lib/mill.test.fnl150
1 files changed, 0 insertions, 150 deletions
diff --git a/lib/mill.test.fnl b/lib/mill.test.fnl
deleted file mode 100644
index 04f7e97..0000000
--- a/lib/mill.test.fnl
+++ /dev/null
@@ -1,150 +0,0 @@
-(let [{: describe
-       :end test-end} (require :lib.test)
-      {: mill-at?
-       : get-candidates
-       : move-mills
-       : candidate-moves
-       : any
-       } (require :lib.mill)
-      {: mills } (require :lib.constants)
-      with-mills (partial mill-at? mills)]
-
-  (describe "Mill" (fn []
-    (describe "#get-candidates()" (fn [t]
-        (t
-          (let [move 3
-                expected [[1 2 3] [3 15 24]]
-                moves [ 1 1 0 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
-               ]
-            {:given (string.format "a move of %d" move)
-            :should "return [[1 2 3] [3 15 24]]" 
-            : expected 
-            :actual (get-candidates mills move)
-            }))
-        (t
-          (let [move 1
-                expected [[1 2 3] [1 10 22]]
-                moves [ 0 0 0 ]
-               ]
-            {:given (string.format "a move of %d" move)
-            :should "return [[1 2 3] [1 10 22]]" 
-            : expected 
-            :actual (get-candidates mills move)
-            }))
-        (t
-          (let [move 1
-                moves [2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
-                expected [[1 2 3] [1 10 22]]
-               ]
-            {:given (string.format "a move of %d" move)
-            :should "still return [[1 2 3] [1 10 22]]" 
-            : expected 
-            :actual (get-candidates mills move)
-            }))
-        ))
-        
-    (describe "#any()" (fn [t]
-        (t {:given "a table of false false true"
-            :should "return true"
-            :expected true
-            :actual (any [false false true])
-           })
-        (t {:given "a table of true false"
-            :should "return true"
-            :expected true
-            :actual (any [true false])
-           })
-        (t {:given "a single false"
-            :should "return false"
-            :expected false
-            :actual (any [false])
-           })
-        (t {:given "a single true"
-            :should "return true"
-            :expected true
-            :actual (any [true])
-           })))
-
-    (describe "#move-mills()" (fn [t]
-      (t
-        (let [moves [[1 1 1] [0 2 2]]
-              ]
-          {:given "a list of moves"
-           :should "turn them into true/false if they are mills"
-           :expected [true false]
-           :actual (move-mills moves)
-           }))
-      (t
-        (let [moves [[0 1 1] [0 2 2]]
-              ]
-          {:given "no mills"
-           :should "should return false"
-           :expected [false false]
-           :actual (move-mills moves)
-           }))
-      (t
-        (let [moves [[2 2 2] [2 0 0]]
-              ]
-          {:given "mill, no mill"
-           :should "should return true false"
-           :expected [true false]
-           :actual (move-mills moves)
-           }))
-      ))
-
-    (describe "#candidate-moves()" (fn [t]
-      (t (let [spaces [[1 2 3] [1 10 22]]
-               moves [2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
-               ]
-         {:given "spaces [[1 2 3] [1 10 22]]"
-          :should "map to moves"
-          :expected [[2 2 2] [2 0 0]]
-          :actual (candidate-moves spaces moves) 
-          }
-         )
-       )  
-    ))
-
-    (describe "#mill-at?()" (fn [t]
-        (t 
-          (let [move 1
-                moves [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
-                ]
-            {:given "no mills"
-             :should "return false"
-             :expected false
-             :actual (mill-at? mills moves move)
-             }))
-        (t 
-          (let [move 4
-                moves [1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
-                with-mills (partial mill-at? mills) 
-                with-moves (partial with-mills moves)]
-            {:given "a mill but not at Move"
-             :should "return false"
-             :expected false
-             :actual (with-moves move)
-             }))
-        (t 
-          (let [move 1
-                moves [2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
-                with-mills (partial mill-at? mills) 
-                with-moves (partial with-mills moves)]
-            {:given "a mill"
-             :should "return true"
-             :expected true
-             :actual (with-moves move)
-             }))
-        (t 
-          (let [move 1
-                moves [2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
-                with-mills (partial mill-at? mills) 
-                with-moves (partial with-mills moves)]
-            {:given "a mill"
-             :should "return the opposite of false"
-             :expected false
-             :actual (not (with-moves move))
-             }))
-        ))
-
-    (test-end))))