From eaae9fe9b80433a05cee5e1d669e87f7057b921a Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Wed, 29 Apr 2026 07:13:12 +0200 Subject: [PATCH 1/2] Add mutannot --- .../MutationCaseAttribute.fs | 13 +++++++++++ .../NightLight.Core.Tests.fsproj | 1 + flake.lock | 22 +++++++++++++++++++ flake.nix | 6 +++++ 4 files changed, 42 insertions(+) create mode 100644 NightLight.Core.Tests/MutationCaseAttribute.fs diff --git a/NightLight.Core.Tests/MutationCaseAttribute.fs b/NightLight.Core.Tests/MutationCaseAttribute.fs new file mode 100644 index 0000000..12e6475 --- /dev/null +++ b/NightLight.Core.Tests/MutationCaseAttribute.fs @@ -0,0 +1,13 @@ +namespace Mutannot + +open System + +[] +type MutationCaseAttribute(id: string, file: string, line: int, find: string, replace: string) = + inherit Attribute() + + member _.Id = id + member _.File = file + member _.Line = line + member _.Find = find + member _.Replace = replace diff --git a/NightLight.Core.Tests/NightLight.Core.Tests.fsproj b/NightLight.Core.Tests/NightLight.Core.Tests.fsproj index 8c14702..4364d43 100644 --- a/NightLight.Core.Tests/NightLight.Core.Tests.fsproj +++ b/NightLight.Core.Tests/NightLight.Core.Tests.fsproj @@ -7,6 +7,7 @@ + diff --git a/flake.lock b/flake.lock index 181aa01..52a4b9b 100644 --- a/flake.lock +++ b/flake.lock @@ -42,6 +42,27 @@ "url": "https://codeberg.org/svenvanheugten/git-check-assertions.git" } }, + "mutannot": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1777439386, + "narHash": "sha256-nTBcu7NsN1jwoXr8SoKaW+0EPb5klTU6SSWuXOeuEuA=", + "ref": "main", + "rev": "1019d3c5d04d441d12b915876110f7493270b988", + "revCount": 19, + "type": "git", + "url": "https://git.memcmp.org/svenvanheugten/mutannot.git" + }, + "original": { + "ref": "main", + "type": "git", + "url": "https://git.memcmp.org/svenvanheugten/mutannot.git" + } + }, "nixpkgs": { "locked": { "lastModified": 1773507054, @@ -62,6 +83,7 @@ "inputs": { "flake-utils": "flake-utils", "git-check-assertions": "git-check-assertions", + "mutannot": "mutannot", "nixpkgs": "nixpkgs" } }, diff --git a/flake.nix b/flake.nix index 5447ef1..074d9ba 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,10 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; + mutannot = { + url = "git+https://git.memcmp.org/svenvanheugten/mutannot.git?ref=main"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { @@ -14,6 +18,7 @@ nixpkgs, flake-utils, git-check-assertions, + mutannot, }: flake-utils.lib.eachDefaultSystem ( system: @@ -26,6 +31,7 @@ packages = [ pkgs.dotnet-sdk_10 git-check-assertions.packages.${system}.default + mutannot.packages.${system}.default ]; }; } From 56ef751145bc4f18362bfbca19cada68e86c5525 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Wed, 29 Apr 2026 07:25:05 +0200 Subject: [PATCH 2/2] Add some mutannot mutations --- NightLight.Core.Tests/NightLightTests.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NightLight.Core.Tests/NightLightTests.fs b/NightLight.Core.Tests/NightLightTests.fs index 7ad546b..a66d65e 100644 --- a/NightLight.Core.Tests/NightLightTests.fs +++ b/NightLight.Core.Tests/NightLightTests.fs @@ -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 [ |])>] + [] 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) [ |], MaxTest = 500)>] + [ 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) [ |], MaxTest = 500)>] + [] let ``All lights with power should have the correct state`` (interactions: Interaction list) = let fakeHome = createFakeHomeWithNightLightAndInteract interactions