< Summary

Line coverage
47%
Covered lines: 23
Uncovered lines: 25
Coverable lines: 48
Total lines: 129
Line coverage: 47.9%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
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%
get_X()100%11100%
set_X(...)100%11100%
get_Y()100%11100%
set_Y(...)100%11100%
get_Z()100%11100%
set_Z(...)100%11100%
get_W()100%11100%
set_W(...)100%11100%
Equals(...)50%22100%
Equals(...)50%66100%
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/ObjVector4.cs

#LineLine coverage
 1// <copyright file="ObjVector4.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} {W}")]
 11    public struct ObjVector4 : IEquatable<ObjVector4>
 12    {
 13        private float x;
 14
 15        private float y;
 16
 17        private float z;
 18
 19        private float w;
 20
 21        public ObjVector4(System.Numerics.Vector4 v)
 22        {
 023            this.x = v.X;
 024            this.y = v.Y;
 025            this.z = v.Z;
 026            this.w = v.W;
 027        }
 28
 29        public ObjVector4(System.Numerics.Vector3 v, float w = 1.0f)
 30        {
 031            this.x = v.X;
 032            this.y = v.Y;
 033            this.z = v.Z;
 034            this.w = w;
 035        }
 36
 37        public ObjVector4(float x, float y, float z, float w)
 38        {
 62739            this.x = x;
 62740            this.y = y;
 62741            this.z = z;
 62742            this.w = w;
 62743        }
 44
 45        public ObjVector4(float x, float y, float z)
 46        {
 347            this.x = x;
 348            this.y = y;
 349            this.z = z;
 350            this.w = 1.0f;
 351        }
 52
 53        public float X
 54        {
 10855            readonly get { return this.x; }
 656            set { this.x = value; }
 57        }
 58
 59        public float Y
 60        {
 10861            readonly get { return this.y; }
 662            set { this.y = value; }
 63        }
 64
 65        public float Z
 66        {
 10867            readonly get { return this.z; }
 668            set { this.z = value; }
 69        }
 70
 71        public float W
 72        {
 10873            readonly get { return this.w; }
 674            set { this.w = value; }
 75        }
 76
 77        public readonly override bool Equals(object? obj)
 78        {
 379            return obj is ObjVector4 vector && Equals(vector);
 80        }
 81
 82        public readonly bool Equals(ObjVector4 other)
 83        {
 2484            return x == other.x &&
 2485                   y == other.y &&
 2486                   z == other.z &&
 2487                   w == other.w;
 88        }
 89
 90        public readonly override int GetHashCode()
 91        {
 092            var hashCode = -1743314642;
 093            hashCode = hashCode * -1521134295 + x.GetHashCode();
 094            hashCode = hashCode * -1521134295 + y.GetHashCode();
 095            hashCode = hashCode * -1521134295 + z.GetHashCode();
 096            hashCode = hashCode * -1521134295 + w.GetHashCode();
 097            return hashCode;
 98        }
 99
 100        public static bool operator ==(ObjVector4 left, ObjVector4 right)
 101        {
 0102            return left.Equals(right);
 103        }
 104
 105        public static bool operator !=(ObjVector4 left, ObjVector4 right)
 106        {
 0107            return !(left == right);
 108        }
 109
 110        public static implicit operator ObjVector4(System.Numerics.Vector4 v)
 111        {
 0112            return new ObjVector4(v);
 113        }
 114
 115        public readonly void Deconstruct(out float @x, out float @y, out float @z, out float @w)
 116        {
 0117            @x = this.x;
 0118            @y = this.y;
 0119            @z = this.z;
 0120            @w = this.w;
 0121        }
 122
 123        public readonly System.Numerics.Vector4 ToVector3()
 124        {
 0125            return new System.Numerics.Vector4(x, y, z, w);
 126        }
 127    }
 128}
 129