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
|
||||||
|
|
||||||
|
@ -370,25 +370,35 @@ addGoalieSpec = describe "addGoalie" $ mapM_
|
||||||
[ ( "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] )
|
||||||
|
, ( "no active flag", failure, noActive, [joe] )
|
||||||
, ( "rookie", success, mkRookie, [joe, rookie] )
|
, ( "rookie", success, mkRookie, [joe, rookie] )
|
||||||
|
, ( "retired", success, mkRetired, [joe, retired] )
|
||||||
, ( "normal goalie", success, mkNormal, [joe, normal] )
|
, ( "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)
|
||||||
|
mkRetired = cgs (Just 3) (Just False) (Just False)
|
||||||
|
mkNormal = cgs (Just 3) (Just False) (Just True)
|
||||||
joe = newGoalie 2 "Joe"
|
joe = newGoalie 2 "Joe"
|
||||||
rookie = bob True
|
rookie = goalie True True
|
||||||
normal = bob False
|
retired = goalie False False
|
||||||
bob r = newGoalie 3 "Bob" & gRookie .~ r
|
normal = goalie False True
|
||||||
cgs n rf = CreateGoalie $ newCreateGoalieState
|
|
||||||
|
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