implemented editGoalieYtdGames
This commit is contained in:
parent
f739db4203
commit
203650397e
|
@ -54,7 +54,7 @@ editGoalieYtdGames
|
|||
-- ^ The number of games played
|
||||
-> ProgState
|
||||
-> ProgState
|
||||
editGoalieYtdGames = undefined
|
||||
editGoalieYtdGames games = editGoalie (gYtd.gsGames .~ games) EGYtd
|
||||
|
||||
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
|
||||
editGoalie f mode s = fromMaybe s $ do
|
||||
|
|
|
@ -33,6 +33,7 @@ spec :: Spec
|
|||
spec = describe "EditGoalie" $ do
|
||||
editGoalieNumberSpec
|
||||
editGoalieNameSpec
|
||||
editGoalieYtdGamesSpec
|
||||
|
||||
editGoalieNumberSpec :: Spec
|
||||
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
|
||||
:: (ProgState -> ProgState)
|
||||
-> EditGoalieMode
|
||||
|
|
Loading…
Reference in New Issue
Block a user