Class VectorAssertions
- Namespace
- MathAssertions.TUnit
- Assembly
- MathAssertions.TUnit.dll
Fluent System.Numerics vector assertions delegating to MathTolerance. Component values widen to double internally so a tight tolerance is honored at full precision.
public static class VectorAssertions
- Inheritance
-
VectorAssertions
- Inherited Members
Remarks
v0.2.0 enriches failure messages with per-axis delta rendering via MathAssertions.MathFailureMessage. The boolean predicates in MathTolerance remain authoritative for pass / fail; the assertion methods here return TUnit.Assertions.Core.AssertionResult so the generated TUnit chain surfaces the rich diagnostic in the failure message rather than the previous static expectation-only template.
Methods
HasMagnitudeApproximately(Vector3, double, double)
Asserts the vector's magnitude is within tolerance of
expected.
[GenerateAssertion(ExpectationMessage = "to have magnitude approximately {expected} within tolerance {tolerance}", InlineMethodBody = true)]
public static bool HasMagnitudeApproximately(this Vector3 value, double expected, double tolerance)
Parameters
Returns
IsApproximatelyEqualTo(Vector2, Vector2, double)
Component-wise tolerance comparison for Vector2.
[GenerateAssertion(InlineMethodBody = true)]
public static AssertionResult IsApproximatelyEqualTo(this Vector2 value, Vector2 expected, double tolerance)
Parameters
Returns
- AssertionResult
IsApproximatelyEqualTo(Vector3, Vector3, double)
Component-wise tolerance comparison for Vector3.
[GenerateAssertion(InlineMethodBody = true)]
public static AssertionResult IsApproximatelyEqualTo(this Vector3 value, Vector3 expected, double tolerance)
Parameters
Returns
- AssertionResult
IsApproximatelyEqualTo(Vector4, Vector4, double)
Component-wise tolerance comparison for Vector4.
[GenerateAssertion(InlineMethodBody = true)]
public static AssertionResult IsApproximatelyEqualTo(this Vector4 value, Vector4 expected, double tolerance)
Parameters
Returns
- AssertionResult
IsNormalized(Vector3, double)
Asserts the vector is a unit vector (magnitude approximately 1) within
tolerance.
[GenerateAssertion(ExpectationMessage = "to be a unit (normalized) vector within tolerance {tolerance}", InlineMethodBody = true)]
public static bool IsNormalized(this Vector3 value, double tolerance)