Created
April 24, 2012 14:27
-
-
Save borkdude/2480095 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn make-test-board-fn [win-fn player expect] | |
(fn [board] | |
(is (= (win-fn board player) expect)))) | |
(deftest winner-in-rows?-test | |
(doseq [player [\X \Y]] | |
(let [test-fn (make-test-board-fn winner-in-rows? player true)] | |
(doseq [board (row-win-combinations player)] | |
(test-fn board))))) | |
(deftest winner-in-rows?-test | |
(doseq [player [\X \Y]] | |
(let [test-fn (make-test-board-fn winner-in-rows? player true)] | |
(dorun (map test-fn (row-win-combinations player)))) | |
(deftest winner-in-rows?-test | |
(dorun (map (fn [player] | |
(let [test-fn (make-test-board-fn winner-in-rows? player true)] | |
(dorun (map test-fn (row-win-combinations player))))) | |
[\X \Y]))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment