summary refs log tree commit diff
path: root/lib/no-moves.test.fnl
blob: db0613cfd6ed07a365595fa3602271f7fd8bcb40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(let [{: no-moves?} (require :lib.no-moves)
      {: neighbors} (require :lib.constants)
      {: describe :end test-end} (require :lib.test)
      with-neighbors (partial no-moves? neighbors)
      ]

  (describe "no-moves()" (fn [t]
    (let [moves [ 1 2 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 ]
          player 1
          ]
        (t {:given "one move with no moves"
            :should "return true"
            :expected true
            :actual (with-neighbors moves player)
            }))
    (let [moves [ 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
          player 1
          ]
        (t {:given "one move with one move"
            :should "return false"
            :expected false
            :actual (with-neighbors moves player)
            }))
    (let [moves [ 1 1 1 0 2 0 0 0 0 2 0 0 0 0 2 0 0 0 0 0 0 0 ]
          player 1
          ]
        (t {:given "several moves with no moves"
            :should "return true"
            :expected true
            :actual (with-neighbors moves player)
            }))
    (let [moves [ 0 2 0 2 1 2 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
          player 1
          ]
        (t {:given "four occupied neighbors"
            :should "return true"
            :expected true
            :actual (with-neighbors moves player)
            }))
    (let [moves [ 1 2 1 2 0 2 1 2 1 2 1 0 1 2 1 2 2 2 0 1 0 0 0 0 0 ]
          player 2
          ]
        (t {:given "this turn that is giving me trouble"
            :should "return true"
            :expected true
            :actual (with-neighbors moves player)
            }))

    (test-end))))