diff --git a/spec/automaton_test.clj b/spec/automaton_test.clj deleted file mode 100644 index b2d0ff8..0000000 --- a/spec/automaton_test.clj +++ /dev/null @@ -1,17 +0,0 @@ -(ns solutions.automaton-test - (:use circumspec solutions.automaton)) - -(testing-fn active-neighbors - ((repeat (repeat :on)) -> 8) - ((repeat (repeat :off)) -> 0)) - -(testing-fn step - ([[:off :off :off :off :off] - [:off :off :on :off :on ] - [:off :off :off :off :off] - [:off :off :off :off :off]] -> - [[:off :off :off :on :off] - [:off :off :dying :on :dying ] - [:off :off :off :on :off] - [:off :off :off :off :off]])) - diff --git a/spec/mini_browser_test.clj b/spec/mini_browser_test.clj deleted file mode 100644 index 2bb43e6..0000000 --- a/spec/mini_browser_test.clj +++ /dev/null @@ -1,18 +0,0 @@ -(ns solutions.mini-browser-test - (:use circumspec solutions.mini-browser)) - -(testing-fn namespace-link - ("foo" -> [:a {:href "/browse/foo"} "foo"])) - -(testing-fn namespace-browser - (["foo", "bar"] -> [:div - {:class "browse-list"} - [:ul - [[:li [:a {:href "/browse/foo"} "foo"]] - [:li [:a {:href "/browse/bar"} "bar"]]]]])) - -(testing-fn var-link - ("com.foo" "zap" -> [:a {:href "/browse/com.foo/zap"} "zap"]) - ("com.foo" "zap?" -> [:a {:href "/browse/com.foo/zap%3F"} "zap?"])) - - diff --git a/spec/project_euler_test.clj b/spec/project_euler_test.clj deleted file mode 100644 index 1fc47b0..0000000 --- a/spec/project_euler_test.clj +++ /dev/null @@ -1,72 +0,0 @@ -(ns solutions.project-euler-test - (:use circumspec solutions.project-euler)) - -(testing-fn divides? - (10 2 -> true) - (10 3 -> false) - (10 4 -> false) - (10 5 -> true)) - -(testing divides-any - (let [pred (divides-any 3 5)] - (for-these [result input] (should (= result (pred input))) - false 2 - true 3 - false 4 - true 5 - true 6))) - -(testing "various approaches to problem 1" - (dotimes [n 10] - (should (= (problem-1-recur n) - (problem-1 n) - (problem-1-left-to-right n))))) - -(testing-fn problem-1 - (-> 233168) - (10 -> 23)) - -(testing-fn problem-2 - (-> 4613732) - (40 -> 44)) - -(testing-fn prime-factors - (0 -> ()) - (1 -> ()) - (2 -> [2]) - (3 -> [3]) - (4 -> [2 2]) - (12 -> [2 2 3]) - (600851475143 -> [71 839 1471 6857])) - -(testing-fn problem-3 - (4 -> 2) - (12 -> 3) - (-> 6857)) - -(testing-fn problem-4 - (1 -> 0) - (10 -> 9) - (100 -> 9009) - (1000 -> 906609)) - -(testing-fn unique-factors - (10 -> [10 9 8 7 6]) - (6 -> [6 5 4]) - (5 -> [5 4 3])) - -(testing-fn problem-5 - (2 -> 2) - (3 -> 6) - (4 -> 12) - (10 -> 2520) - #_(20 -> 232792560)) - -(testing-fn problem-6 - (10 -> 2640) - (100 -> 25164150)) - -(testing-fn problem-7 - (6 -> 13) - (10001 -> 104743)) - diff --git a/spec/rock_paper_scissors_test.clj b/spec/rock_paper_scissors_test.clj deleted file mode 100644 index 324856c..0000000 --- a/spec/rock_paper_scissors_test.clj +++ /dev/null @@ -1,40 +0,0 @@ -(ns solutions.rock-paper-scissors-test - (use circumspec solutions.rock-paper-scissors) - (import [solutions.rock-paper-scissors Stubborn Random Mean])) - -(testing-fn winner - (:rock :rock => nil) - (:rock :paper => :paper) - (:rock :scissors => :rock)) - -(testing-fn draw? - (:rock :rock => true) - (:rock :paper => false) - (:rock :scissors => false)) - -(testing-fn iwon? - (:rock :rock => false) - (:rock :paper => false) - (:rock :scissors => true)) - -(testing "Stubborn" - (let [s (Stubborn. :rock)] - (should (= :rock (choose s))) - (should (= s (update-strategy s :ignored :ignored))))) - -(testing "Random" - (let [r (Random.)] - (should (contains? choices (choose r))) - (should (= r (update-strategy r :ignored :ignored))))) - -(describe Mean - (let [m (Mean. :rock)] - (it "should replay last winning value" - (should (= m (update-strategy m :rock :scissors)))) - (it "should reset if it did not win" - (should (= (Mean. nil) (update-strategy m :rock :paper)))))) - -(testing "mean beats stubborn (life advice perhaps?)" - (let [{:keys [p1 p2]} (game (Mean. :rock) (Stubborn. :rock) 100)] - (should (<= (+ p1 p2 100))) - (should (< p2 p1))))