< Summary

Information
Class: BallSort.Engine.Logic.BoardHashEqualityComparer
Assembly: BallSort.Engine
File(s): /home/runner/work/BallSort/BallSort/src/BallSort.Engine/Logic/BoardHashEqualityComparer.cs
Tag: 216
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 43
Line coverage: 100%
Branch coverage
100%
Covered branches: 12
Total branches: 12
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Equals(...)100%1010100%
GetHashCode(...)100%22100%

File(s)

/home/runner/work/BallSort/BallSort/src/BallSort.Engine/Logic/BoardHashEqualityComparer.cs

#LineLine coverage
 1namespace BallSort.Engine.Logic;
 2
 3public class BoardHashEqualityComparer : IEqualityComparer<ulong[]>
 4{
 5    public bool Equals(ulong[] x, ulong[] y)
 6    {
 43347        if (x == null || y == null)
 8        {
 29            return false;
 10        }
 11
 433212        if (x.Length != y.Length)
 13        {
 214            return false;
 15        }
 16
 12993617        for (var i = 0; i < x.Length; i++)
 18        {
 6064019            if (x[i] != y[i])
 20            {
 221                return false;
 22            }
 23        }
 24
 432825        return true;
 26    }
 27
 28    public int GetHashCode(ulong[] source)
 29    {
 30        unchecked
 31        {
 1056232            var hash = 17;
 33
 32464834            foreach (var b in source)
 35            {
 15176236                hash = hash * 31 + (int) b;
 15176237                hash = hash * 31 + (int) (b >> 32);
 38            }
 39
 1056240            return hash;
 41        }
 42    }
 43}