check should return score or nothing if invalid
This commit is contained in:
parent
57579fa5e4
commit
38838c47b9
4 changed files with 11 additions and 13 deletions
|
|
@ -32,8 +32,8 @@ spec = do
|
|||
displayText gameBoard `shouldBe` "1 2 \n3 4 \n"
|
||||
|
||||
it "validates a move" do
|
||||
selectCheck (0, 0) (1, 1) gameBoard `shouldBe` True
|
||||
selectCheck (0, 0) (0, 1) gameBoard `shouldBe` False
|
||||
selectCheck (0, 0) (1, 1) gameBoard `shouldBe` Just 4
|
||||
selectCheck (0, 0) (0, 1) gameBoard `shouldBe` Nothing
|
||||
|
||||
it "clears properly" do
|
||||
let cleared = clear (0, 0) (0, 1) gameBoard
|
||||
|
|
@ -55,7 +55,7 @@ spec = do
|
|||
let action = SelectSquare (0, 0) (0, 1)
|
||||
newState = makeMove (MkPlayerIndex 0) action initialState
|
||||
|
||||
preview (#players % ix 0 % #score) newState `shouldBe` Just 1
|
||||
preview (#players % ix 0 % #score) newState `shouldBe` Just 2
|
||||
|
||||
it "does not increase score if sum does not equal target" do
|
||||
let invalidAction = SelectSquare (0, 0) (1, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue