implemented editGoalieLtGoals

This commit is contained in:
Jonathan Lamothe 2019-11-14 02:35:58 -05:00
parent c0386fa0b9
commit 954fe98998
2 changed files with 33 additions and 1 deletions

View File

@ -126,7 +126,7 @@ editGoalieLtGoals
-- ^ The number of goals
-> ProgState
-> ProgState
editGoalieLtGoals = undefined
editGoalieLtGoals goals = editGoalie (gLifetime.gsGoalsAllowed .~ goals) EGLifetime
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
editGoalie f mode s = fromMaybe s $ do

View File

@ -41,6 +41,7 @@ spec = describe "EditGoalie" $ do
editGoalieYtdTiesSpec
editGoalieLtGamesSpec
editGoalieLtMinsSpec
editGoalieLtGoalsSpec
editGoalieNumberSpec :: Spec
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
@ -352,6 +353,37 @@ editGoalieLtMinsSpec = describe "editGoalieLtMins" $ editTest
)
]
editGoalieLtGoalsSpec :: Spec
editGoalieLtGoalsSpec = describe "editGoalieLtGoals" $ editTest
(editGoalieLtGoals 1)
EGLtGoals
(\(num, name, goals) -> newGoalie num name & gLifetime.gsGoalsAllowed .~ goals)
[ ( "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 )
, EGLtGoals
)
, ( "no goalie selected"
, Nothing
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGLtGoals
)
]
editTest
:: (ProgState -> ProgState)
-> EditGoalieMode