implemented editGoalieYtdLosses

This commit is contained in:
Jonathan Lamothe 2019-11-14 01:57:51 -05:00
parent 01859634a1
commit 4655cb37b9
2 changed files with 33 additions and 1 deletions

View File

@ -90,7 +90,7 @@ editGoalieYtdLosses
-- ^ The number of losses
-> ProgState
-> ProgState
editGoalieYtdLosses = undefined
editGoalieYtdLosses losses = editGoalie (gYtd.gsLosses .~ losses) EGYtd
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
editGoalie f mode s = fromMaybe s $ do

View File

@ -37,6 +37,7 @@ spec = describe "EditGoalie" $ do
editGoalieYtdMinsSpec
editGoalieYtdGoalsSpec
editGoalieYtdWinsSpec
editGoalieYtdLossesSpec
editGoalieNumberSpec :: Spec
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
@ -224,6 +225,37 @@ editGoalieYtdWinsSpec = describe "editGoalieYtdWins" $ editTest
)
]
editGoalieYtdLossesSpec :: Spec
editGoalieYtdLossesSpec = describe "editGoalieYtdLosses" $ editTest
(editGoalieYtdLosses 1)
EGYtdLosses
(\(num, name, losses) -> newGoalie num name & gYtd.gsLosses .~ losses)
[ ( "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 )
, EGYtdLosses
)
, ( "no goalie selected"
, Nothing
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGYtdLosses
)
]
editTest
:: (ProgState -> ProgState)
-> EditGoalieMode