summary refs log tree commit diff
path: root/lib/game/no-moves.test.fnl
blob: a94d60a6e977ad2db184bb88f55a25aca7e3c841 (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
(let [{: no-moves?} (require :lib.game.no-moves)
      {: neighbors} (require :lib.constants)
      {: describe : test-end} (require :lib.test)
      with-neighbors (partial no-moves? neighbors)
      ]

  (describe "# NOMOVES" (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))))