implemented editGoalieYtdGames
This commit is contained in:
parent
f739db4203
commit
203650397e
|
@ -54,7 +54,7 @@ editGoalieYtdGames
|
||||||
-- ^ The number of games played
|
-- ^ The number of games played
|
||||||
-> ProgState
|
-> ProgState
|
||||||
-> ProgState
|
-> ProgState
|
||||||
editGoalieYtdGames = undefined
|
editGoalieYtdGames games = editGoalie (gYtd.gsGames .~ games) EGYtd
|
||||||
|
|
||||||
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
|
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
|
||||||
editGoalie f mode s = fromMaybe s $ do
|
editGoalie f mode s = fromMaybe s $ do
|
||||||
|
|
|
@ -33,6 +33,7 @@ spec :: Spec
|
||||||
spec = describe "EditGoalie" $ do
|
spec = describe "EditGoalie" $ do
|
||||||
editGoalieNumberSpec
|
editGoalieNumberSpec
|
||||||
editGoalieNameSpec
|
editGoalieNameSpec
|
||||||
|
editGoalieYtdGamesSpec
|
||||||
|
|
||||||
editGoalieNumberSpec :: Spec
|
editGoalieNumberSpec :: Spec
|
||||||
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
|
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
|
||||||
|
@ -96,6 +97,37 @@ editGoalieNameSpec = describe "editGoalieName" $ editTest
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
editGoalieYtdGamesSpec :: Spec
|
||||||
|
editGoalieYtdGamesSpec = describe "editGoalieYtdGames" $ editTest
|
||||||
|
(editGoalieYtdGames 1)
|
||||||
|
EGYtdGames
|
||||||
|
(\(num, name, games) -> newGoalie num name & gYtd.gsGames .~ games)
|
||||||
|
[ ( "set Joe"
|
||||||
|
, Just 0
|
||||||
|
, ( 2, "Joe", 1 )
|
||||||
|
, ( 3, "Bob", 0 )
|
||||||
|
, EGYtd
|
||||||
|
)
|
||||||
|
, ( "set Bob"
|
||||||
|
, Just 1
|
||||||
|
, ( 2, "Joe", 0 )
|
||||||
|
, ( 3, "Bob", 1 )
|
||||||
|
, EGYtd
|
||||||
|
)
|
||||||
|
, ( "out of bounds"
|
||||||
|
, Just 2
|
||||||
|
, ( 2, "Joe", 0 )
|
||||||
|
, ( 3, "Bob", 0 )
|
||||||
|
, EGYtdGames
|
||||||
|
)
|
||||||
|
, ( "no goalie selected"
|
||||||
|
, Nothing
|
||||||
|
, ( 2, "Joe", 0 )
|
||||||
|
, ( 3, "Bob", 0 )
|
||||||
|
, EGYtdGames
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
editTest
|
editTest
|
||||||
:: (ProgState -> ProgState)
|
:: (ProgState -> ProgState)
|
||||||
-> EditGoalieMode
|
-> EditGoalieMode
|
||||||
|
|
Loading…
Reference in New Issue
Block a user