< Summary

Line coverage
69%
Covered lines: 18
Uncovered lines: 8
Coverable lines: 26
Total lines: 88
Line coverage: 69.2%
Branch coverage
16%
Covered branches: 1
Total branches: 6
Branch coverage: 16.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
get_Position()100%11100%
set_Position(...)100%11100%
get_Color()100%11100%
set_Color(...)100%11100%
Equals(...)0%620%
Equals(...)50%22100%
GetHashCode()0%620%
op_Equality(...)100%210%
op_Inequality(...)100%210%

File(s)

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

#LineLine coverage
 1// <copyright file="ObjVertex.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("Vertex Position:{Position} Color:{Color}")]
 11    public struct ObjVertex : IEquatable<ObjVertex>
 12    {
 13        private ObjVector4 position;
 14
 15        private ObjVector4? color;
 16
 17        public ObjVertex(float x, float y, float z)
 18        {
 6619            this.position = new ObjVector4(x, y, z, 1.0f);
 6620            this.color = null;
 6621        }
 22
 23        public ObjVertex(float x, float y, float z, float w)
 24        {
 1525            this.position = new ObjVector4(x, y, z, w);
 1526            this.color = null;
 1527        }
 28
 29        public ObjVertex(float x, float y, float z, float r, float g, float b)
 30        {
 331            this.position = new ObjVector4(x, y, z, 1.0f);
 332            this.color = new ObjVector4(r, g, b, 1.0f);
 333        }
 34
 35        public ObjVertex(float x, float y, float z, float r, float g, float b, float a)
 36        {
 1537            this.position = new ObjVector4(x, y, z, 1.0f);
 1538            this.color = new ObjVector4(r, g, b, a);
 1539        }
 40
 41        public ObjVector4 Position
 42        {
 12643            get { return this.position; }
 98444            set { this.position = value; }
 45        }
 46
 47        public ObjVector4? Color
 48        {
 12049            get { return this.color; }
 1850            set { this.color = value; }
 51        }
 52
 53        public override bool Equals(object? obj)
 54        {
 055            return obj is ObjVertex vertex && Equals(vertex);
 56        }
 57
 58        public bool Equals(ObjVertex other)
 59        {
 1260            return position.Equals(other.position) &&
 1261                   EqualityComparer<ObjVector4?>.Default.Equals(color, other.color);
 62        }
 63
 64        public override int GetHashCode()
 65        {
 066            var hashCode = -2056440846;
 067            hashCode = hashCode * -1521134295 + EqualityComparer<ObjVector4>.Default.GetHashCode(position);
 68
 069            if (color.HasValue)
 70            {
 071                hashCode = hashCode * -1521134295 + EqualityComparer<ObjVector4>.Default.GetHashCode(color.Value);
 72            }
 73
 074            return hashCode;
 75        }
 76
 77        public static bool operator ==(ObjVertex left, ObjVertex right)
 78        {
 079            return left.Equals(right);
 80        }
 81
 82        public static bool operator !=(ObjVertex left, ObjVertex right)
 83        {
 084            return !(left == right);
 85        }
 86    }
 87}
 88