implemented createPlayerStateL
This commit is contained in:
parent
d5d08aa0f7
commit
154c3979a5
|
@ -44,6 +44,7 @@ module Mtlstats.Types (
|
||||||
inputBuffer,
|
inputBuffer,
|
||||||
-- ** ProgMode Lenses
|
-- ** ProgMode Lenses
|
||||||
gameStateL,
|
gameStateL,
|
||||||
|
createPlayerStateL,
|
||||||
-- ** GameState Lenses
|
-- ** GameState Lenses
|
||||||
gameYear,
|
gameYear,
|
||||||
gameMonth,
|
gameMonth,
|
||||||
|
@ -443,6 +444,13 @@ gameStateL = lens
|
||||||
_ -> newGameState)
|
_ -> newGameState)
|
||||||
(\_ gs -> NewGame gs)
|
(\_ gs -> NewGame gs)
|
||||||
|
|
||||||
|
createPlayerStateL :: Lens' ProgMode CreatePlayerState
|
||||||
|
createPlayerStateL = lens
|
||||||
|
(\case
|
||||||
|
CreatePlayer cps -> cps
|
||||||
|
_ -> newCreatePlayerState)
|
||||||
|
(\_ cps -> CreatePlayer cps)
|
||||||
|
|
||||||
-- | Constructor for a 'ProgState'
|
-- | Constructor for a 'ProgState'
|
||||||
newProgState :: ProgState
|
newProgState :: ProgState
|
||||||
newProgState = ProgState
|
newProgState = ProgState
|
||||||
|
|
|
@ -42,6 +42,7 @@ spec = describe "Mtlstats.Types" $ do
|
||||||
gameStatsSpec
|
gameStatsSpec
|
||||||
databaseSpec
|
databaseSpec
|
||||||
gameStateLSpec
|
gameStateLSpec
|
||||||
|
createPlayerStateLSpec
|
||||||
teamScoreSpec
|
teamScoreSpec
|
||||||
otherScoreSpec
|
otherScoreSpec
|
||||||
homeTeamSpec
|
homeTeamSpec
|
||||||
|
@ -81,6 +82,23 @@ gameStateLSpec = describe "gameStateL" $ lensSpec gameStateL
|
||||||
]
|
]
|
||||||
where gs t = newGameState & gameType ?~ t
|
where gs t = newGameState & gameType ?~ t
|
||||||
|
|
||||||
|
createPlayerStateLSpec :: Spec
|
||||||
|
createPlayerStateLSpec = describe "createPlayerStateL" $
|
||||||
|
lensSpec createPlayerStateL
|
||||||
|
-- getters
|
||||||
|
[ ( MainMenu, newCreatePlayerState )
|
||||||
|
, ( CreatePlayer $ cps 1 , cps 1 )
|
||||||
|
]
|
||||||
|
-- setters
|
||||||
|
[ ( MainMenu, cps 1 )
|
||||||
|
, ( CreatePlayer $ cps 1, cps 2 )
|
||||||
|
]
|
||||||
|
where
|
||||||
|
cps n = newCreatePlayerState
|
||||||
|
& cpsNumber ?~ n
|
||||||
|
& cpsName .~ "foo"
|
||||||
|
& cpsPosition .~ "bar"
|
||||||
|
|
||||||
teamScoreSpec :: Spec
|
teamScoreSpec :: Spec
|
||||||
teamScoreSpec = describe "teamScore" $ do
|
teamScoreSpec = describe "teamScore" $ do
|
||||||
let
|
let
|
||||||
|
|
Loading…
Reference in New Issue
Block a user