implemented editGoalieYtdTies

This commit is contained in:
Jonathan Lamothe 2019-11-14 02:07:00 -05:00
parent 101f436424
commit f97db477dd
2 changed files with 33 additions and 1 deletions

View File

@ -99,7 +99,7 @@ editGoalieYtdTies
-- ^ The number of ties -- ^ The number of ties
-> ProgState -> ProgState
-> ProgState -> ProgState
editGoalieYtdTies = undefined editGoalieYtdTies ties = editGoalie (gYtd.gsTies .~ ties) EGYtd
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
editGoalie f mode s = fromMaybe s $ do editGoalie f mode s = fromMaybe s $ do

View File

@ -38,6 +38,7 @@ spec = describe "EditGoalie" $ do
editGoalieYtdGoalsSpec editGoalieYtdGoalsSpec
editGoalieYtdWinsSpec editGoalieYtdWinsSpec
editGoalieYtdLossesSpec editGoalieYtdLossesSpec
editGoalieYtdTiesSpec
editGoalieNumberSpec :: Spec editGoalieNumberSpec :: Spec
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
@ -256,6 +257,37 @@ editGoalieYtdLossesSpec = describe "editGoalieYtdLosses" $ editTest
) )
] ]
editGoalieYtdTiesSpec :: Spec
editGoalieYtdTiesSpec = describe "editGoalieYtdTies" $ editTest
(editGoalieYtdTies 1)
EGYtdTies
(\(num, name, ties) -> newGoalie num name & gYtd.gsTies .~ ties)
[ ( "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 )
, EGYtdTies
)
, ( "no goalie selected"
, Nothing
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGYtdTies
)
]
editTest editTest
:: (ProgState -> ProgState) :: (ProgState -> ProgState)
-> EditGoalieMode -> EditGoalieMode