record active flag on goalie creation
This commit is contained in:
parent
e28ef1ff0e
commit
9b07c6d249
|
@ -179,10 +179,12 @@ addGoalie s = fromMaybe s $ do
|
||||||
let cgs = s^.progMode.createGoalieStateL
|
let cgs = s^.progMode.createGoalieStateL
|
||||||
num <- cgs^.cgsNumber
|
num <- cgs^.cgsNumber
|
||||||
rFlag <- cgs^.cgsRookieFlag
|
rFlag <- cgs^.cgsRookieFlag
|
||||||
|
aFlag <- cgs^.cgsActiveFlag
|
||||||
let
|
let
|
||||||
name = cgs^.cgsName
|
name = cgs^.cgsName
|
||||||
goalie = newGoalie num name
|
goalie = newGoalie num name
|
||||||
& gRookie .~ rFlag
|
& gRookie .~ rFlag
|
||||||
|
& gActive .~ aFlag
|
||||||
Just $ s & database.dbGoalies
|
Just $ s & database.dbGoalies
|
||||||
%~ (++[goalie])
|
%~ (++[goalie])
|
||||||
|
|
||||||
|
|
|
@ -341,11 +341,11 @@ addPlayerSpec = describe "addPlayer" $ mapM_
|
||||||
mkRetired = mkpm (Just 3) (Just False) (Just False)
|
mkRetired = mkpm (Just 3) (Just False) (Just False)
|
||||||
mkNormal = mkpm (Just 3) (Just False) (Just True)
|
mkNormal = mkpm (Just 3) (Just False) (Just True)
|
||||||
joe = newPlayer 2 "Joe" "centre"
|
joe = newPlayer 2 "Joe" "centre"
|
||||||
rookie = bob True True
|
rookie = player True True
|
||||||
retired = bob False False
|
retired = player False False
|
||||||
normal = bob False True
|
normal = player False True
|
||||||
|
|
||||||
bob r a = newPlayer 3 "Bob" "defense"
|
player r a = newPlayer 3 "Bob" "defense"
|
||||||
& pRookie .~ r
|
& pRookie .~ r
|
||||||
& pActive .~ a
|
& pActive .~ a
|
||||||
|
|
||||||
|
@ -366,29 +366,39 @@ addGoalieSpec = describe "addGoalie" $ mapM_
|
||||||
ps' = addGoalie ps
|
ps' = addGoalie ps
|
||||||
in ps'^.database.dbGoalies `shouldBe` goalies)
|
in ps'^.database.dbGoalies `shouldBe` goalies)
|
||||||
|
|
||||||
-- label, expectation, progMode, expected goalies
|
-- label, expectation, progMode, expected goalies
|
||||||
[ ( "wrong mode", failure, MainMenu, [joe] )
|
[ ( "wrong mode", failure, MainMenu, [joe] )
|
||||||
, ( "no number", failure, noNum, [joe] )
|
, ( "no number", failure, noNum, [joe] )
|
||||||
, ( "no rookie flag", failure, noRookie, [joe] )
|
, ( "no rookie flag", failure, noRookie, [joe] )
|
||||||
, ( "rookie", success, mkRookie, [joe, rookie] )
|
, ( "no active flag", failure, noActive, [joe] )
|
||||||
, ( "normal goalie", success, mkNormal, [joe, normal] )
|
, ( "rookie", success, mkRookie, [joe, rookie] )
|
||||||
|
, ( "retired", success, mkRetired, [joe, retired] )
|
||||||
|
, ( "normal goalie", success, mkNormal, [joe, normal] )
|
||||||
]
|
]
|
||||||
|
|
||||||
where
|
where
|
||||||
failure = "should not create the goalie"
|
failure = "should not create the goalie"
|
||||||
success = "should create the goalie"
|
success = "should create the goalie"
|
||||||
noNum = cgs Nothing (Just False)
|
noNum = cgs Nothing (Just False) (Just True)
|
||||||
noRookie = cgs (Just 3) Nothing
|
noRookie = cgs (Just 3) Nothing (Just True)
|
||||||
mkRookie = cgs (Just 3) (Just True)
|
noActive = cgs (Just 3) (Just False) Nothing
|
||||||
mkNormal = cgs (Just 3) (Just False)
|
mkRookie = cgs (Just 3) (Just True) (Just True)
|
||||||
joe = newGoalie 2 "Joe"
|
mkRetired = cgs (Just 3) (Just False) (Just False)
|
||||||
rookie = bob True
|
mkNormal = cgs (Just 3) (Just False) (Just True)
|
||||||
normal = bob False
|
joe = newGoalie 2 "Joe"
|
||||||
bob r = newGoalie 3 "Bob" & gRookie .~ r
|
rookie = goalie True True
|
||||||
cgs n rf = CreateGoalie $ newCreateGoalieState
|
retired = goalie False False
|
||||||
|
normal = goalie False True
|
||||||
|
|
||||||
|
goalie r a = newGoalie 3 "Bob"
|
||||||
|
& gRookie .~ r
|
||||||
|
& gActive .~ a
|
||||||
|
|
||||||
|
cgs n r a = CreateGoalie $ newCreateGoalieState
|
||||||
& cgsNumber .~ n
|
& cgsNumber .~ n
|
||||||
& cgsName .~ "Bob"
|
& cgsName .~ "Bob"
|
||||||
& cgsRookieFlag .~ rf
|
& cgsRookieFlag .~ r
|
||||||
|
& cgsActiveFlag .~ a
|
||||||
|
|
||||||
resetCreatePlayerStateSpec :: Spec
|
resetCreatePlayerStateSpec :: Spec
|
||||||
resetCreatePlayerStateSpec = describe "resetCreatePlayerState" $ let
|
resetCreatePlayerStateSpec = describe "resetCreatePlayerState" $ let
|
||||||
|
|
Loading…
Reference in New Issue
Block a user