< Summary

Information
Class: Hertzole.ScriptableValues.Helpers.ArrayHelpers
Assembly: Hertzole.ScriptableValues
File(s): ./Packages/se.hertzole.scriptable-values/Runtime/Helpers/ArrayHelpers.cs
Tag: 52_28197466029
Line coverage
100%
Covered lines: 23
Uncovered lines: 0
Coverable lines: 23
Total lines: 42
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
EnsureCapacity[T](...)0%220100%
SequenceEquals[T](...)0%440100%

File(s)

./Packages/se.hertzole.scriptable-values/Runtime/Helpers/ArrayHelpers.cs

#LineLine coverage
 1using System;
 2using System.Buffers;
 3using System.Collections.Generic;
 4using System.Runtime.CompilerServices;
 5
 6namespace Hertzole.ScriptableValues.Helpers
 7{
 8    internal static class ArrayHelpers
 9    {
 10        public static void EnsureCapacity<T>(ref T[] array, int capacity)
 602411        {
 602412            if (array.Length <= capacity)
 22213            {
 22214                int length = array.Length;
 22215                T[] newArray = ArrayPool<T>.Shared.Rent(capacity * 2);
 22216                Array.Copy(array, newArray, length);
 22217                ArrayPool<T>.Shared.Return(array, RuntimeHelpers.IsReferenceOrContainsReferences<T>());
 22218                array = newArray;
 22219            }
 602420        }
 21
 22        public static bool SequenceEquals<T>(in ReadOnlySpan<T> left, in ReadOnlySpan<T> right)
 3623        {
 3624            if (left.Length != right.Length)
 625            {
 626                return false;
 27            }
 28
 3029            EqualityComparer<T> comparer = EqualityComparer<T>.Default;
 30
 462031            for (int i = 0; i < left.Length; i++)
 228632            {
 228633                if (!comparer.Equals(left[i], right[i]))
 634                {
 635                    return false;
 36                }
 228037            }
 38
 2439            return true;
 3640        }
 41    }
 42}