diff --git a/test/Spec.hs b/test/Spec.hs index 43b348d..ec57706 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -4,21 +4,26 @@ module Spec where import Data.Array (array) -import Display (Display (display), displayText) +import Display (displayText) import Test.Hspec import Types.GameBoard import Types.GameMode (SumTo (MkSumTo), Tile (IntTile)) spec :: Spec spec = describe "gameboard" do + let tiles = + array + ((0, 0), (1, 1)) + [ ((0, 0), Just $ IntTile 1) + , ((0, 1), Just $ IntTile 2) + , ((1, 0), Just $ IntTile 3) + , ((1, 1), Just $ IntTile 4) + ] + gameBoard = MkGameBoard{width = 2, height = 2, gameMode = MkSumTo 10, board = tiles} + it "displays correctly" do - let tiles = - array - ((0, 0), (1, 1)) - [ ((0, 0), Just $ IntTile 1) - , ((0, 1), Just $ IntTile 2) - , ((1, 0), Just $ IntTile 3) - , ((1, 1), Just $ IntTile 4) - ] - gameBoard = MkGameBoard{width = 2, height = 2, gameMode = MkSumTo 10, board = tiles} displayText gameBoard `shouldBe` "1 2 \n3 4 \n" + + it "validates a move" do + selectCheck gameBoard (0, 0) (1, 1) `shouldBe` True + selectCheck gameBoard (0, 0) (0, 1) `shouldBe` False