implemented editGoalieLtLosses

This commit is contained in:
Jonathan Lamothe 2019-11-14 02:53:26 -05:00
parent 3ba3875752
commit 9456102935
2 changed files with 33 additions and 1 deletions

View File

@ -144,7 +144,7 @@ editGoalieLtLosses
-- ^ The number of losses
-> ProgState
-> ProgState
editGoalieLtLosses = undefined
editGoalieLtLosses losses = editGoalie (gLifetime.gsLosses .~ losses) EGLifetime
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
editGoalie f mode s = fromMaybe s $ do

View File

@ -43,6 +43,7 @@ spec = describe "EditGoalie" $ do
editGoalieLtMinsSpec
editGoalieLtGoalsSpec
editGoalieLtWinsSpec
editGoalieLtLossesSpec
editGoalieNumberSpec :: Spec
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
@ -416,6 +417,37 @@ editGoalieLtWinsSpec = describe "editGoalieLtWins" $ editTest
)
]
editGoalieLtLossesSpec :: Spec
editGoalieLtLossesSpec = describe "editGoalieLtLosses" $ editTest
(editGoalieLtLosses 1)
EGLtLosses
(\(num, name, losses) -> newGoalie num name & gLifetime.gsLosses .~ losses)
[ ( "set Joe"
, Just 0
, ( 2, "Joe", 1 )
, ( 3, "Bob", 0 )
, EGLifetime
)
, ( "set Bob"
, Just 1
, ( 2, "Joe", 0 )
, ( 3, "Bob", 1 )
, EGLifetime
)
, ( "out of bounds"
, Just 2
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGLtLosses
)
, ( "no goalie selected"
, Nothing
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGLtLosses
)
]
editTest
:: (ProgState -> ProgState)
-> EditGoalieMode