implemented createGoalieStateL
This commit is contained in:
parent
ceb8132a13
commit
e94bf59c81
|
@ -47,6 +47,7 @@ module Mtlstats.Types (
|
||||||
-- ** ProgMode Lenses
|
-- ** ProgMode Lenses
|
||||||
gameStateL,
|
gameStateL,
|
||||||
createPlayerStateL,
|
createPlayerStateL,
|
||||||
|
createGoalieStateL,
|
||||||
-- ** GameState Lenses
|
-- ** GameState Lenses
|
||||||
gameYear,
|
gameYear,
|
||||||
gameMonth,
|
gameMonth,
|
||||||
|
@ -524,6 +525,13 @@ createPlayerStateL = lens
|
||||||
_ -> newCreatePlayerState)
|
_ -> newCreatePlayerState)
|
||||||
(\_ cps -> CreatePlayer cps)
|
(\_ cps -> CreatePlayer cps)
|
||||||
|
|
||||||
|
createGoalieStateL :: Lens' ProgMode CreateGoalieState
|
||||||
|
createGoalieStateL = lens
|
||||||
|
(\case
|
||||||
|
CreateGoalie cgs -> cgs
|
||||||
|
_ -> newCreateGoalieState)
|
||||||
|
(\_ cgs -> CreateGoalie cgs)
|
||||||
|
|
||||||
-- | Constructor for a 'ProgState'
|
-- | Constructor for a 'ProgState'
|
||||||
newProgState :: ProgState
|
newProgState :: ProgState
|
||||||
newProgState = ProgState
|
newProgState = ProgState
|
||||||
|
|
|
@ -46,6 +46,7 @@ spec = describe "Mtlstats.Types" $ do
|
||||||
databaseSpec
|
databaseSpec
|
||||||
gameStateLSpec
|
gameStateLSpec
|
||||||
createPlayerStateLSpec
|
createPlayerStateLSpec
|
||||||
|
createGoalieStateLSpec
|
||||||
teamScoreSpec
|
teamScoreSpec
|
||||||
otherScoreSpec
|
otherScoreSpec
|
||||||
homeTeamSpec
|
homeTeamSpec
|
||||||
|
@ -117,6 +118,26 @@ createPlayerStateLSpec = describe "createPlayerStateL" $
|
||||||
& cpsName .~ "Bob"
|
& cpsName .~ "Bob"
|
||||||
& cpsPosition .~ "defense"
|
& cpsPosition .~ "defense"
|
||||||
|
|
||||||
|
createGoalieStateLSpec :: Spec
|
||||||
|
createGoalieStateLSpec = describe "createGoalieStateL" $
|
||||||
|
lensSpec createGoalieStateL
|
||||||
|
-- getters
|
||||||
|
[ ( "missing state", MainMenu, newCreateGoalieState )
|
||||||
|
, ( "with state", CreateGoalie cgs1, cgs1 )
|
||||||
|
]
|
||||||
|
-- setters
|
||||||
|
[ ( "set state", MainMenu, cgs1 )
|
||||||
|
, ( "change state", CreateGoalie cgs1, cgs2 )
|
||||||
|
, ( "clear state", CreateGoalie cgs1, newCreateGoalieState )
|
||||||
|
]
|
||||||
|
where
|
||||||
|
cgs1 = newCreateGoalieState
|
||||||
|
& cgsNumber ?~ 1
|
||||||
|
& cgsName .~ "Joe"
|
||||||
|
cgs2 = newCreateGoalieState
|
||||||
|
& cgsNumber ?~ 2
|
||||||
|
& cgsName .~ "Bob"
|
||||||
|
|
||||||
teamScoreSpec :: Spec
|
teamScoreSpec :: Spec
|
||||||
teamScoreSpec = describe "teamScore" $ do
|
teamScoreSpec = describe "teamScore" $ do
|
||||||
let
|
let
|
||||||
|
|
Loading…
Reference in New Issue
Block a user