implemented editGoalieLtWins

This commit is contained in:
Jonathan Lamothe 2019-11-14 02:45:31 -05:00
parent dd34429f59
commit 2860309fc5
2 changed files with 33 additions and 1 deletions

View File

@ -135,7 +135,7 @@ editGoalieLtWins
-- ^ The number of wins
-> ProgState
-> ProgState
editGoalieLtWins = undefined
editGoalieLtWins wins = editGoalie (gLifetime.gsWins .~ wins) EGLifetime
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
editGoalie f mode s = fromMaybe s $ do

View File

@ -42,6 +42,7 @@ spec = describe "EditGoalie" $ do
editGoalieLtGamesSpec
editGoalieLtMinsSpec
editGoalieLtGoalsSpec
editGoalieLtWinsSpec
editGoalieNumberSpec :: Spec
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
@ -384,6 +385,37 @@ editGoalieLtGoalsSpec = describe "editGoalieLtGoals" $ editTest
)
]
editGoalieLtWinsSpec :: Spec
editGoalieLtWinsSpec = describe "editGoalieLtWins" $ editTest
(editGoalieLtWins 1)
EGLtWins
(\(num, name, wins) -> newGoalie num name & gLifetime.gsWins .~ wins)
[ ( "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 )
, EGLtWins
)
, ( "no goalie selected"
, Nothing
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGLtWins
)
]
editTest
:: (ProgState -> ProgState)
-> EditGoalieMode