< Summary

Line coverage
48%
Covered lines: 21
Uncovered lines: 22
Coverable lines: 43
Total lines: 121
Line coverage: 48.8%
Branch coverage
33%
Covered branches: 2
Total branches: 6
Branch coverage: 33.3%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
.ctor(...)100%210%
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
get_X()100%11100%
set_X(...)100%11100%
get_Y()100%11100%
set_Y(...)100%11100%
get_Z()100%11100%
set_Z(...)100%11100%
Equals(...)0%620%
Equals(...)50%44100%
GetHashCode()100%210%
op_Equality(...)100%210%
op_Inequality(...)100%210%
op_Implicit(...)100%210%
Deconstruct(...)100%210%
ToVector3()100%210%

File(s)

https://raw.githubusercontent.com/JeremyAnsel/JeremyAnsel.Media.WavefrontObj/dbbfcd213b7c54f49194f82fcd56e790cca193c3/JeremyAnsel.Media.WavefrontObj/JeremyAnsel.Media.WavefrontObj/ObjVector3.cs

#LineLine coverage
 1// <copyright file="ObjVector3.cs" company="Jérémy Ansel">
 2// Copyright (c) 2017, 2019 Jérémy Ansel
 3// </copyright>
 4// <license>
 5// Licensed under the MIT license. See LICENSE.txt
 6// </license>
 7
 8namespace JeremyAnsel.Media.WavefrontObj
 9{
 10    [System.Diagnostics.DebuggerDisplay("{X} {Y} {Z}")]
 11    public struct ObjVector3 : IEquatable<ObjVector3>
 12    {
 13        private float x;
 14
 15        private float y;
 16
 17        private float z;
 18
 19        public ObjVector3(System.Numerics.Vector3 v)
 20        {
 021            this.x = v.X;
 022            this.y = v.Y;
 023            this.z = v.Z;
 024        }
 25
 26        public ObjVector3(System.Numerics.Vector2 v, float z = 1.0f)
 27        {
 028            this.x = v.X;
 029            this.y = v.Y;
 030            this.z = z;
 031        }
 32
 33        public ObjVector3(float x, float y, float z)
 34        {
 136835            this.x = x;
 136836            this.y = y;
 136837            this.z = z;
 136838        }
 39
 40        public ObjVector3(float x, float y)
 41        {
 342            this.x = x;
 343            this.y = y;
 344            this.z = 1.0f;
 345        }
 46
 47        public ObjVector3(float x)
 48        {
 349            this.x = x;
 350            this.y = 0.0f;
 351            this.z = 1.0f;
 352        }
 53
 54        public float X
 55        {
 52856            readonly get { return this.x; }
 75057            set { this.x = value; }
 58        }
 59
 60        public float Y
 61        {
 46262            readonly get { return this.y; }
 64263            set { this.y = value; }
 64        }
 65
 66        public float Z
 67        {
 47468            readonly get { return this.z; }
 62469            set { this.z = value; }
 70        }
 71
 72        public readonly override bool Equals(object? obj)
 73        {
 074            return obj is ObjVector3 vector && Equals(vector);
 75        }
 76
 77        public readonly bool Equals(ObjVector3 other)
 78        {
 3079            return x == other.x &&
 3080                   y == other.y &&
 3081                   z == other.z;
 82        }
 83
 84        public readonly override int GetHashCode()
 85        {
 086            var hashCode = 373119288;
 087            hashCode = hashCode * -1521134295 + x.GetHashCode();
 088            hashCode = hashCode * -1521134295 + y.GetHashCode();
 089            hashCode = hashCode * -1521134295 + z.GetHashCode();
 090            return hashCode;
 91        }
 92
 93        public static bool operator ==(ObjVector3 left, ObjVector3 right)
 94        {
 095            return left.Equals(right);
 96        }
 97
 98        public static bool operator !=(ObjVector3 left, ObjVector3 right)
 99        {
 0100            return !(left == right);
 101        }
 102
 103        public static implicit operator ObjVector3(System.Numerics.Vector3 v)
 104        {
 0105            return new ObjVector3(v);
 106        }
 107
 108        public readonly void Deconstruct(out float @x, out float @y, out float @z)
 109        {
 0110            @x = this.x;
 0111            @y = this.y;
 0112            @z = this.z;
 0113        }
 114
 115        public readonly System.Numerics.Vector3 ToVector3()
 116        {
 0117            return new System.Numerics.Vector3(x, y, z);
 118        }
 119    }
 120}
 121