implemented movement of single beads
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user