Add some mutannot mutations

This commit is contained in:
Sven van Heugten 2026-04-29 07:25:05 +02:00
parent eaae9fe9b8
commit 56ef751145
No known key found for this signature in database
GPG key ID: D612F88666F4F660

View file

@ -1,5 +1,6 @@
namespace NightLight.Core.Tests
open Mutannot
open NightLight.Core.Core
open NightLight.Core.Tests.InteractionListGenerators
open NightLight.Core.Tests.InteractionListHelpers
@ -31,6 +32,7 @@ type NightLightTests() =
fakeHome
[<Property(Arbitrary = [| typeof<ArbitraryInteractions> |])>]
[<MutationCase("all-lights-right-color-night-is-yellow", "NightLight.Core/Moods.fs", 16, "Red", "Yellow")>]
let ``All lights should either be off or have the right color`` (interactions: Interaction list) =
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
let partOfDay = getPartOfDayAfterInteractions interactions
@ -48,6 +50,7 @@ type NightLightTests() =
|> Prop.trivial (fakeHome.LightsThatAreOn.Length = 0)
[<Property(Arbitrary = [| typeof<ArbitraryInteractions> |], MaxTest = 500)>]
[<MutationCase("brightness-command-off-by-one", "NightLight.Core/ZigbeeCommands.fs", 40, "Brightness b -> b", "Brightness b -> b + 1")>]
let ``All lights should either be off or have a brightness that fits its color`` (interactions: Interaction list) =
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
let time = getTimeAfterInteractions interactions |> _.TimeOfDay
@ -88,6 +91,7 @@ type NightLightTests() =
|> Prop.trivial (fakeHome.LightsThatAreOn.Length = 0)
[<Property(Arbitrary = [| typeof<ArbitraryInteractions> |], MaxTest = 500)>]
[<MutationCase("lights-default-to-off", "NightLight.Core/NightLightStateMachine.fs", 145, "light, On", "light, Off")>]
let ``All lights with power should have the correct state`` (interactions: Interaction list) =
let fakeHome = createFakeHomeWithNightLightAndInteract interactions