getInteractionsExcept -> genRandomInteractionsExcept

This commit is contained in:
Sven van Heugten 2026-01-09 06:02:48 +01:00
parent 879b75f201
commit 6ec9aa1b51
2 changed files with 8 additions and 8 deletions

View file

@ -24,12 +24,12 @@ let genInitialInteractions biasTowardsLight =
Gen.listOf <| genInteraction biasTowardsLight ] Gen.listOf <| genInteraction biasTowardsLight ]
|> concatGens |> concatGens
let genInteractionsExcept biasTowardsLight disqualifier = let genRandomInteractionsExcept biasTowardsLight disqualifier =
genInteraction biasTowardsLight genInteraction biasTowardsLight
|> Gen.filter (not << disqualifier) |> Gen.filter (not << disqualifier)
|> Gen.listOf |> Gen.listOf
let genInitialInteractionsExcept biasTowardsLight disqualifier = let genInitialInteractionsExcept biasTowardsLight disqualifier =
[ genTimeChanged |> Gen.map List.singleton [ genTimeChanged |> Gen.map List.singleton
genInteractionsExcept biasTowardsLight disqualifier ] genRandomInteractionsExcept biasTowardsLight disqualifier ]
|> concatGens |> concatGens

View file

@ -48,7 +48,7 @@ type NightLightTests() =
concatGens concatGens
[ genInitialInteractions light [ genInitialInteractions light
genTimeChangedToRandomDayTime |> Gen.map List.singleton genTimeChangedToRandomDayTime |> Gen.map List.singleton
genInteractionsExcept light isTimeChangedToAnyNightTime ] genRandomInteractionsExcept light isTimeChangedToAnyNightTime ]
|> Arb.fromGen |> Arb.fromGen
|> Prop.forAll |> Prop.forAll
<| fun interactions -> <| fun interactions ->
@ -63,7 +63,7 @@ type NightLightTests() =
concatGens concatGens
[ genInitialInteractions light [ genInitialInteractions light
genTimeChangedToRandomNightTime |> Gen.map List.singleton genTimeChangedToRandomNightTime |> Gen.map List.singleton
genInteractionsExcept light isTimeChangedToAnyDayTime ] genRandomInteractionsExcept light isTimeChangedToAnyDayTime ]
|> Arb.fromGen |> Arb.fromGen
|> Prop.forAll |> Prop.forAll
<| fun interactions -> <| fun interactions ->
@ -101,7 +101,7 @@ type NightLightTests() =
concatGens concatGens
[ genInitialInteractions light [ genInitialInteractions light
HumanInteraction RemotePressedOnButton |> List.singleton |> Gen.constant HumanInteraction RemotePressedOnButton |> List.singleton |> Gen.constant
genInteractionsExcept light ((=) (HumanInteraction RemotePressedOffButton)) ] genRandomInteractionsExcept light ((=) (HumanInteraction RemotePressedOffButton)) ]
|> Arb.fromGen |> Arb.fromGen
|> Prop.forAll |> Prop.forAll
<| fun interactions -> <| fun interactions ->
@ -117,9 +117,9 @@ type NightLightTests() =
concatGens concatGens
[ genInitialInteractions light [ genInitialInteractions light
genTimeChangedToRandomNightTime |> Gen.map List.singleton genTimeChangedToRandomNightTime |> Gen.map List.singleton
genInteractionsExcept light isTimeChangedToAnyDayTime genRandomInteractionsExcept light isTimeChangedToAnyDayTime
genTimeChangedToRandomDayTime |> Gen.map List.singleton genTimeChangedToRandomDayTime |> Gen.map List.singleton
genInteractionsExcept light ((=) (HumanInteraction RemotePressedOffButton)) ] genRandomInteractionsExcept light ((=) (HumanInteraction RemotePressedOffButton)) ]
|> Arb.fromGen |> Arb.fromGen
|> Prop.forAll |> Prop.forAll
<| fun interactions -> <| fun interactions ->
@ -135,7 +135,7 @@ type NightLightTests() =
concatGens concatGens
[ genInitialInteractions light [ genInitialInteractions light
HumanInteraction RemotePressedOffButton |> List.singleton |> Gen.constant HumanInteraction RemotePressedOffButton |> List.singleton |> Gen.constant
genInteractionsExcept light (fun interaction -> genRandomInteractionsExcept light (fun interaction ->
interaction = HumanInteraction RemotePressedOnButton interaction = HumanInteraction RemotePressedOnButton
|| interaction |> isTimeChangedToAnyDayTime) ] || interaction |> isTimeChangedToAnyDayTime) ]
|> Arb.fromGen |> Arb.fromGen