< Summary

Information
Class: BallSort.Engine.Logic.BoardHashEqualityComparer
Assembly: BallSort.Engine
File(s): /home/runner/work/BallSort/BallSort/src/BallSort.Engine/Logic/BoardHashEqualityComparer.cs
Tag: 158
Line coverage
75%
Covered lines: 9
Uncovered lines: 3
Coverable lines: 12
Total lines: 42
Line coverage: 75%
Branch coverage
66%
Covered branches: 8
Total branches: 12
Branch coverage: 66.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Equals(...)60%151062.5%
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<byte[]>
 4{
 5    public bool Equals(byte[] x, byte[] y)
 6    {
 2087        if (x == null || y == null)
 8        {
 09            return false;
 10        }
 11
 20812        if (x.Length != y.Length)
 13        {
 014            return false;
 15        }
 16
 1660817        for (var i = 0; i < x.Length; i++)
 18        {
 809619            if (x[i] != y[i])
 20            {
 021                return false;
 22            }
 23        }
 24
 20825        return true;
 26    }
 27
 28    public int GetHashCode(byte[] source)
 29    {
 30        unchecked
 31        {
 57632            var hash = 17;
 33
 4483234            foreach (var b in source)
 35            {
 2184036                hash = hash * 31 + b;
 37            }
 38
 57639            return hash;
 40        }
 41    }
 42}