implemented arbitrary rung selection

This commit is contained in:
2024-08-22 18:50:27 -04:00
parent a3259f3b7d
commit 04e90481de
4 changed files with 37 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ spec :: Spec
spec = describe "Actions" $ do
moveUpSpec
moveDownSpec
selRungSpec
beadLeftSpec
beadRightSpec
rungLeftSpec
@@ -68,6 +69,20 @@ moveDownSpec = describe "moveDown" $ mapM_
elsewhere = initialState & rungNum .~ 8
movedDown = initialState & rungNum .~ 1
selRungSpec :: Spec
selRungSpec = describe "selRung" $ mapM_
( \(desc, rung, expected) -> context desc $
it ("should be " ++ show expected) $
selRung rung initialState `shouldBe` expected
)
[ ( "negative rung", -1, initialState )
, ( "valid rung", 5, rung5 )
, ( "large rung", 11, rung9 )
]
where
rung5 = initialState & rungNum .~ 5
rung9 = initialState & rungNum .~ 9
beadLeftSpec :: Spec
beadLeftSpec = describe "beadLeft" $ let
state = initialState