implemented movement of single beads

This commit is contained in:
2024-08-22 16:53:01 -04:00
parent af72ca74af
commit d03f997c6a
4 changed files with 55 additions and 2 deletions

View File

@@ -24,6 +24,8 @@ module Abacus.App.ActionsSpec (spec) where
import Lens.Micro.Platform ((&), (.~))
import Test.Hspec (Spec, context, describe, it, shouldBe)
import Abacus
import Abacus.Internal
import Abacus.App.Actions
import Abacus.App.Types
@@ -31,6 +33,8 @@ spec :: Spec
spec = describe "Actions" $ do
moveUpSpec
moveDownSpec
beadLeftSpec
beadRightSpec
moveUpSpec :: Spec
moveUpSpec = describe "moveUp" $ mapM_
@@ -62,4 +66,22 @@ moveDownSpec = describe "moveDown" $ mapM_
elsewhere = initialState & rungNum .~ 8
movedDown = initialState & rungNum .~ 1
beadLeftSpec :: Spec
beadLeftSpec = describe "beadLeft" $ let
state = initialState
& abacus .~ Abacus 10 [1..10]
& rungNum .~ 5
expected = state & abacus.rungL 5 .~ 5
in it ("should be " ++ show expected) $
beadLeft state `shouldBe` expected
beadRightSpec :: Spec
beadRightSpec = describe "beadRight" $ let
state = initialState
& abacus .~ Abacus 10 [1..10]
& rungNum .~ 5
expected = state & abacus.rungL 5 .~ 7
in it ("should be " ++ show expected) $
beadRight state `shouldBe` expected
--jl