< Summary

Information
Class: FixedMathSharp.Assertions.FixedQuaternionAssertions
Assembly: FixedMathSharp.FluentAssertions
File(s): /home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp.FluentAssertions/FixedQuaternionAssertions.cs
Line coverage
100%
Covered lines: 29
Uncovered lines: 0
Coverable lines: 29
Total lines: 99
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%
HaveComponentApproximately(...)100%11100%
RepresentSameRotationAs(...)100%11100%
BeIdentity(...)100%11100%
BeNormalized(...)100%11100%

File(s)

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

#LineLine coverage
 1//=======================================================================
 2// FixedQuaternionAssertions.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 FixedQuaternionAssertions : FixedStructAssertions<FixedQuaternion, FixedQuaternionAssertions>
 15{
 3816    public FixedQuaternionAssertions(FixedQuaternion value) : base(value) { }
 17
 618    protected override string Identifier => "fixed quaternion";
 19
 20    public AndConstraint<FixedQuaternionAssertions> BeApproximately(
 21        FixedQuaternion expected,
 22        Fixed64? tolerance = null,
 23        string because = "",
 24        params object[] becauseArgs)
 25    {
 726        Fixed64 limit = FixedAssertionHelpers.ResolveTolerance(tolerance);
 27
 728        CurrentAssertionChain
 729            .ForCondition(FixedAssertionHelpers.AreComponentApproximatelyEqual(Subject, expected, limit))
 730            .BecauseOf(because, becauseArgs)
 731            .FailWith("Expected fixed quaternion components to be approximately {0} +/- {1}{reason}, but found {2}.", ex
 32
 233        return new AndConstraint<FixedQuaternionAssertions>(this);
 34    }
 35
 36    public AndConstraint<FixedQuaternionAssertions> NotBeApproximately(
 37        FixedQuaternion 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 fixed quaternion not to be approximately {0} +/- {1}{reason}, but found {2}.", expected,
 48
 149        return new AndConstraint<FixedQuaternionAssertions>(this);
 50    }
 51
 52    public AndConstraint<FixedQuaternionAssertions> HaveComponentApproximately(
 53        FixedQuaternion expected,
 54        Fixed64? tolerance = null,
 55        string because = "",
 56        params object[] becauseArgs)
 57    {
 158        return BeApproximately(expected, tolerance, because, becauseArgs);
 59    }
 60
 61    public AndConstraint<FixedQuaternionAssertions> RepresentSameRotationAs(
 62        FixedQuaternion expected,
 63        Fixed64? tolerance = null,
 64        string because = "",
 65        params object[] becauseArgs)
 66    {
 267        Fixed64 limit = FixedAssertionHelpers.ResolveTolerance(tolerance);
 68
 269        CurrentAssertionChain
 270            .ForCondition(FixedAssertionHelpers.RepresentsSameRotation(Subject, expected, limit))
 271            .BecauseOf(because, becauseArgs)
 272            .FailWith("Expected fixed quaternion to represent the same rotation as {0} +/- {1}{reason}, but found {2}.",
 73
 174        return new AndConstraint<FixedQuaternionAssertions>(this);
 75    }
 76
 77    public AndConstraint<FixedQuaternionAssertions> BeIdentity(
 78        string because = "",
 79        params object[] becauseArgs)
 80    {
 281        return Be(FixedQuaternion.Identity, because, becauseArgs);
 82    }
 83
 84    public AndConstraint<FixedQuaternionAssertions> BeNormalized(
 85        Fixed64? tolerance = null,
 86        string because = "",
 87        params object[] becauseArgs)
 88    {
 289        Fixed64 limit = FixedAssertionHelpers.ResolveTolerance(tolerance);
 290        Fixed64 magnitude = FixedQuaternion.GetMagnitude(Subject);
 91
 292        CurrentAssertionChain
 293            .ForCondition(FixedAssertionHelpers.AreApproximatelyEqual(magnitude, Fixed64.One, limit))
 294            .BecauseOf(because, becauseArgs)
 295            .FailWith("Expected fixed quaternion to be normalized within +/- {0}{reason}, but found magnitude {1}.", lim
 96
 197        return new AndConstraint<FixedQuaternionAssertions>(this);
 98    }
 99}