< Summary

Information
Class: FixedMathSharp.Assertions.Fixed4x4Assertions
Assembly: FixedMathSharp.FluentAssertions
File(s): /home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp.FluentAssertions/Fixed4x4Assertions.cs
Line coverage
100%
Covered lines: 47
Uncovered lines: 0
Coverable lines: 47
Total lines: 136
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Identifier()100%11100%
BeApproximately(...)100%11100%
NotBeApproximately(...)100%11100%
BeIdentity(...)100%11100%
BeAffine(...)100%11100%
HaveTranslationApproximately(...)100%11100%
HaveScaleApproximately(...)100%11100%
HaveRotationApproximately(...)100%11100%
HaveNormalizedRotationBasis(...)100%11100%

File(s)

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp.FluentAssertions/Fixed4x4Assertions.cs

#LineLine coverage
 1//=======================================================================
 2// Fixed4x4Assertions.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using FluentAssertions;
 9using FluentAssertions.Execution;
 10using FluentAssertions.Numeric;
 11
 12namespace FixedMathSharp.Assertions;
 13
 14public sealed class Fixed4x4Assertions : FixedStructAssertions<Fixed4x4, Fixed4x4Assertions>
 15{
 7416    public Fixed4x4Assertions(Fixed4x4 value) : base(value) { }
 17
 418    protected override string Identifier => "fixed4x4 matrix";
 19
 20    public AndConstraint<Fixed4x4Assertions> BeApproximately(
 21        Fixed4x4 expected,
 22        Fixed64? tolerance = null,
 23        string because = "",
 24        params object[] becauseArgs)
 25    {
 1826        Fixed64 limit = FixedAssertionHelpers.ResolveTolerance(tolerance);
 27
 1828        CurrentAssertionChain
 1829            .ForCondition(FixedAssertionHelpers.AreComponentApproximatelyEqual(Subject, expected, limit))
 1830            .BecauseOf(because, becauseArgs)
 1831            .FailWith("Expected fixed4x4 matrix to be approximately {0} +/- {1}{reason}, but found {2}.", expected, limi
 32
 133        return new AndConstraint<Fixed4x4Assertions>(this);
 34    }
 35
 36    public AndConstraint<Fixed4x4Assertions> NotBeApproximately(
 37        Fixed4x4 expected,
 38        Fixed64? tolerance = null,
 39        string because = "",
 40        params object[] becauseArgs)
 41    {
 242        Fixed64 limit = FixedAssertionHelpers.ResolveTolerance(tolerance);
 43
 244        CurrentAssertionChain
 245            .ForCondition(!FixedAssertionHelpers.AreComponentApproximatelyEqual(Subject, expected, limit))
 246            .BecauseOf(because, becauseArgs)
 247            .FailWith("Expected fixed4x4 matrix not to be approximately {0} +/- {1}{reason}, but found {2}.", expected, 
 48
 149        return new AndConstraint<Fixed4x4Assertions>(this);
 50    }
 51
 52    public AndConstraint<Fixed4x4Assertions> BeIdentity(
 53        string because = "",
 54        params object[] becauseArgs)
 55    {
 256        return Be(Fixed4x4.Identity, because, becauseArgs);
 57    }
 58
 59    public AndConstraint<Fixed4x4Assertions> BeAffine(
 60        string because = "",
 61        params object[] becauseArgs)
 62    {
 263        CurrentAssertionChain
 264            .ForCondition(Subject.IsAffine)
 265            .BecauseOf(because, becauseArgs)
 266            .FailWith("Expected fixed4x4 matrix to be affine{reason}, but found {0}.", Subject);
 67
 168        return new AndConstraint<Fixed4x4Assertions>(this);
 69    }
 70
 71    public AndConstraint<Fixed4x4Assertions> HaveTranslationApproximately(
 72        Vector3d expected,
 73        Fixed64? tolerance = null,
 74        string because = "",
 75        params object[] becauseArgs)
 76    {
 277        Fixed64 limit = FixedAssertionHelpers.ResolveTolerance(tolerance);
 278        Vector3d translation = Subject.Translation;
 79
 280        CurrentAssertionChain
 281            .ForCondition(FixedAssertionHelpers.AreComponentApproximatelyEqual(translation, expected, limit))
 282            .BecauseOf(because, becauseArgs)
 283            .FailWith("Expected fixed4x4 matrix translation to be approximately {0} +/- {1}{reason}, but found {2}.", ex
 84
 185        return new AndConstraint<Fixed4x4Assertions>(this);
 86    }
 87
 88    public AndConstraint<Fixed4x4Assertions> HaveScaleApproximately(
 89        Vector3d expected,
 90        Fixed64? tolerance = null,
 91        string because = "",
 92        params object[] becauseArgs)
 93    {
 394        Fixed64 limit = FixedAssertionHelpers.ResolveTolerance(tolerance);
 395        Vector3d scale = Fixed4x4.ExtractScaleMagnitudes(Subject);
 96
 397        CurrentAssertionChain
 398            .ForCondition(FixedAssertionHelpers.AreComponentApproximatelyEqual(scale, expected, limit))
 399            .BecauseOf(because, becauseArgs)
 3100            .FailWith("Expected fixed4x4 matrix scale magnitudes to be approximately {0} +/- {1}{reason}, but found {2}.
 101
 2102        return new AndConstraint<Fixed4x4Assertions>(this);
 103    }
 104
 105    public AndConstraint<Fixed4x4Assertions> HaveRotationApproximately(
 106        FixedQuaternion expected,
 107        Fixed64? tolerance = null,
 108        string because = "",
 109        params object[] becauseArgs)
 110    {
 2111        Fixed64 limit = FixedAssertionHelpers.ResolveTolerance(tolerance);
 2112        FixedQuaternion rotation = Subject.Rotation;
 113
 2114        CurrentAssertionChain
 2115            .ForCondition(FixedAssertionHelpers.RepresentsSameRotation(rotation, expected, limit))
 2116            .BecauseOf(because, becauseArgs)
 2117            .FailWith("Expected fixed4x4 matrix rotation to be approximately {0} +/- {1}{reason}, but found {2}.", expec
 118
 1119        return new AndConstraint<Fixed4x4Assertions>(this);
 120    }
 121
 122    public AndConstraint<Fixed4x4Assertions> HaveNormalizedRotationBasis(
 123        Fixed64? tolerance = null,
 124        string because = "",
 125        params object[] becauseArgs)
 126    {
 4127        Fixed64 limit = FixedAssertionHelpers.ResolveTolerance(tolerance);
 128
 4129        CurrentAssertionChain
 4130            .ForCondition(FixedAssertionHelpers.HasUnitAxes(Subject, limit))
 4131            .BecauseOf(because, becauseArgs)
 4132            .FailWith("Expected fixed4x4 matrix rotation basis to be normalized within +/- {0}{reason}, but found {1}.",
 133
 1134        return new AndConstraint<Fixed4x4Assertions>(this);
 135    }
 136}