ansi-terminal-game-0.3.0.0: test/Terminal/Game/Layer/ImperativeSpec.hs
module Terminal.Game.Layer.ImperativeSpec where
import Test.Hspec
import Terminal.Game
spec :: Spec
spec = do
let nd = error "<not-defined>"
s = (0, False, 0)
lf (t, True, i) Tick = (t+1, True, i+1)
lf (t, b, i) Tick = (t+1, b, i )
lf (t, _, i) (KeyPress _) = (t, True, i )
qf (3, _, _) = True
qf _ = False
es = [Tick, KeyPress 'c', KeyPress 'c', Tick, Tick]
describe "runGame" $ do
it "does not confuse input and logic" $
runGame s lf nd qf nd es `shouldBe` (3, True, 2)