Invert helper function

This commit is contained in:
Sven van Heugten 2026-01-05 23:04:18 +01:00
parent b9a318a5f1
commit 9bc76cdf8e
2 changed files with 5 additions and 5 deletions

View file

@ -28,12 +28,12 @@ let private genInteractionsListThatStartsWithTimeChanged =
return firstInteraction :: remainingInteractions
}
let genInteractionListContaining containingInteraction afterFilter =
let genInteractionListContaining containingInteraction disqualifiedAfter =
gen {
let genNonTrivialList =
gen {
let! before = genInteractionsListThatStartsWithTimeChanged
let! after = Gen.listOf (genInteraction |> Gen.filter afterFilter)
let! after = Gen.listOf (genInteraction |> Gen.filter (not << disqualifiedAfter))
return before @ containingInteraction :: after
}

View file

@ -26,7 +26,7 @@ type NightLightTests() =
[<Property>]
let ``All lights that are on should be white or yellow during the day`` () =
genTimeChangedToDay
|> Gen.bind (fun timeChangedToDay -> genInteractionListContaining timeChangedToDay (not << _.IsTimeChanged))
|> Gen.bind (fun timeChangedToDay -> genInteractionListContaining timeChangedToDay _.IsTimeChanged)
|> Arb.fromGen
|> Prop.forAll
<| fun interactions ->
@ -36,7 +36,7 @@ type NightLightTests() =
[<Property>]
let ``All lights that are on should be red during the night`` () =
genTimeChangedToNight
|> Gen.bind (fun timeChangedToNight -> genInteractionListContaining timeChangedToNight (not << _.IsTimeChanged))
|> Gen.bind (fun timeChangedToNight -> genInteractionListContaining timeChangedToNight _.IsTimeChanged)
|> Arb.fromGen
|> Prop.forAll
<| fun interactions ->
@ -49,7 +49,7 @@ type NightLightTests() =
=
genInteractionListContaining
(HumanInteraction RemotePressedOffButton)
((<>) (HumanInteraction RemotePressedOnButton))
((=) (HumanInteraction RemotePressedOnButton))
|> Arb.fromGen
|> Prop.forAll
<| fun interactions ->