From 41440cb538deaa7291c9c3b308e7f3152571b1fc Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 24 Sep 2026 19:49:23 +0200 Subject: [PATCH] Tie the scalar comparison overloads too, not just vector-vector The vector-vector self-tie added in the previous commit does not cover float2/float3/float4's vector-scalar and scalar-vector overloads: their existing no-tie fixture (a distinct vector against a single scalar) never had a component equal to that scalar, so their boundary-flip mutants (< to <=, > to >=) kept surviving. Add a uniform vector (every component the same value) against a scalar equal to that value, tying every component of both scalar overloads at once. Co-Authored-By: Claude Opus 5.5 --- .../CultMath.Tests/VectorEqualityTests.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/packages/cultmath/tests/CultMath.Tests/VectorEqualityTests.cs b/packages/cultmath/tests/CultMath.Tests/VectorEqualityTests.cs index 53fca558..9335784d 100644 --- a/packages/cultmath/tests/CultMath.Tests/VectorEqualityTests.cs +++ b/packages/cultmath/tests/CultMath.Tests/VectorEqualityTests.cs @@ -130,6 +130,18 @@ public sealed class VectorEqualityTests AssertElementwiseComparisonOperators( left, left, leftVals, leftVals, (x, y) => x < y, (x, y) => x > y, (x, y) => x <= y, (x, y) => x >= y, (v, i) => v[i], "float2 tied vector-vector"); + + // The scalar overloads need their own tie: a uniform vector against a scalar equal to + // every component, so every component of the vector-scalar and scalar-vector overloads + // ties too (the vector-vector tie above does not cover them). + var uniform = new float2(4.0f, 4.0f); + var uniformVals = new double[] { 4.0, 4.0 }; + AssertElementwiseComparisonOperators( + uniform, 4.0f, uniformVals, uniformVals, + (x, y) => x < y, (x, y) => x > y, (x, y) => x <= y, (x, y) => x >= y, (v, i) => v[i], "float2 tied vector-scalar"); + AssertElementwiseComparisonOperators( + 4.0f, uniform, uniformVals, uniformVals, + (x, y) => x < y, (x, y) => x > y, (x, y) => x <= y, (x, y) => x >= y, (v, i) => v[i], "float2 tied scalar-vector"); } // ---- float3 ----------------------------------------------------------------------------- @@ -182,6 +194,16 @@ public sealed class VectorEqualityTests AssertElementwiseComparisonOperators( left, left, leftVals, leftVals, (x, y) => x < y, (x, y) => x > y, (x, y) => x <= y, (x, y) => x >= y, (v, i) => v[i], "float3 tied vector-vector"); + + // The scalar overloads need their own tie (see the float2 uniform-vector comment above). + var uniform = new float3(4.0f, 4.0f, 4.0f); + var uniformVals = new double[] { 4.0, 4.0, 4.0 }; + AssertElementwiseComparisonOperators( + uniform, 4.0f, uniformVals, uniformVals, + (x, y) => x < y, (x, y) => x > y, (x, y) => x <= y, (x, y) => x >= y, (v, i) => v[i], "float3 tied vector-scalar"); + AssertElementwiseComparisonOperators( + 4.0f, uniform, uniformVals, uniformVals, + (x, y) => x < y, (x, y) => x > y, (x, y) => x <= y, (x, y) => x >= y, (v, i) => v[i], "float3 tied scalar-vector"); } // ---- float4 ----------------------------------------------------------------------------- @@ -235,6 +257,16 @@ public sealed class VectorEqualityTests AssertElementwiseComparisonOperators( left, left, leftVals, leftVals, (x, y) => x < y, (x, y) => x > y, (x, y) => x <= y, (x, y) => x >= y, (v, i) => v[i], "float4 tied vector-vector"); + + // The scalar overloads need their own tie (see the float2 uniform-vector comment above). + var uniform = new float4(4.0f, 4.0f, 4.0f, 4.0f); + var uniformVals = new double[] { 4.0, 4.0, 4.0, 4.0 }; + AssertElementwiseComparisonOperators( + uniform, 4.0f, uniformVals, uniformVals, + (x, y) => x < y, (x, y) => x > y, (x, y) => x <= y, (x, y) => x >= y, (v, i) => v[i], "float4 tied vector-scalar"); + AssertElementwiseComparisonOperators( + 4.0f, uniform, uniformVals, uniformVals, + (x, y) => x < y, (x, y) => x > y, (x, y) => x <= y, (x, y) => x >= y, (v, i) => v[i], "float4 tied scalar-vector"); } // ---- double2 ----------------------------------------------------------------------------