Class ArrayAssertions
- Namespace
- MathAssertions.TUnit
- Assembly
- MathAssertions.TUnit.dll
Fluent double[] / float[] array assertions delegating to
the MathTolerance span overloads. Arrays are used at the
adapter surface rather than spans because TUnit's assertion-builder infrastructure
cannot capture ref-struct values across an await boundary;
ReadOnlySpan<T> remains accessible to callers via
MathTolerance.IsApproximatelyEqual directly when zero-allocation matters.
public static class ArrayAssertions
- Inheritance
-
ArrayAssertions
- Inherited Members
Remarks
Implements the plan's M-4 fix: array overloads validate non-null at entry rather than silently treating null as an empty span. The cast to ReadOnlySpan<T> happens inside the wrapper after validation. v0.2.0 enriches the failure message with the first failing index and the per-element delta via MathAssertions.MathFailureMessage.
Methods
IsApproximatelyEqualTo(double[], double[], double)
Element-wise tolerance comparison for two double arrays.
[GenerateAssertion(InlineMethodBody = false)]
public static AssertionResult IsApproximatelyEqualTo(this double[] value, double[] expected, double tolerance)
Parameters
Returns
- AssertionResult
IsApproximatelyEqualTo(float[], float[], float)
Element-wise tolerance comparison for two float arrays.
[GenerateAssertion(InlineMethodBody = false)]
public static AssertionResult IsApproximatelyEqualTo(this float[] value, float[] expected, float tolerance)
Parameters
Returns
- AssertionResult