module Terminal.Game.PlaneSpec where import Test.Hspec import Terminal.Game.Plane import Terminal.Game.Draw spec :: Spec spec = do let testPlane = blankPlane 2 2 & (1,1) % box '.' 2 2 & (1,2) % cell ' ' describe "listPlane" $ do it "creates a plane from string" $ listPlane (2,2) (map creaCell ". ..") `shouldBe` testPlane it "ignores extra characters" $ listPlane (2,2) (map creaCell ". ..abc") `shouldBe` testPlane describe "pastePlane" $ do it "pastes a simple plane onto another" $ pastePlane (cell 'a') (cell 'b') (1,1) `shouldBe` cell 'a' describe "stringPlane" $ do it "creates plane from spec" $ stringPlane ".\n.." `shouldBe` testPlane describe "stringPlaneTrans" $ do it "allows transparency" $ stringPlaneTrans '.' ".\n.." `shouldBe` addVitrum '.' testPlane describe "updatePlane" $ do let ma = listPlane (2,1) (map creaCell "ab") mb = listPlane (2,1) (map creaCell "xb") it "updates a Plane" $ updatePlane ma [((1,1), creaCell 'x')] `shouldBe` mb