< Summary

Class:Itinero.Network.Tiles.ArrayBaseExtensions
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Network/Tiles/ArrayBaseExtensions.cs
Covered lines:13
Uncovered lines:0
Coverable lines:13
Total lines:33
Line coverage:100% (13 of 13)
Covered branches:4
Total branches:4
Branch coverage:100% (4 of 4)
Tag:232_15462506344

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
EnsureMinimumSize(...)100%4100%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/Network/Tiles/ArrayBaseExtensions.cs

#LineLine coverage
 1using Reminiscence.Arrays;
 2
 3namespace Itinero.Network.Tiles;
 4
 5internal static class ArrayBaseExtensions
 6{
 7    /// <summary>
 8    /// Increase the array size with a fixed step (but never more) to ensure the given position fits.
 9    /// </summary>
 10    /// <param name="array">The array.</param>
 11    /// <param name="position">The position.</param>
 12    /// <param name="step">The steps to add.</param>
 13    /// <param name="fill">The default value to set.</param>
 14    /// <typeparam name="T">The type of the elements in the array.</typeparam>
 15    public static void EnsureMinimumSize<T>(this ArrayBase<T> array, long position,
 16        long step = 16, T fill = default)
 138017    {
 138018        if (array.Length > position)
 74919        {
 74920            return;
 21        }
 22
 63123        var increase = System.Math.DivRem(position - array.Length, step, out _) + 1;
 63124        increase *= step;
 25
 63126        var size = array.Length;
 63127        array.Resize(array.Length + increase);
 2144828        for (var i = size; i < array.Length; i++)
 1009329        {
 1009330            array[i] = fill;
 1009331        }
 138032    }
 33}

Methods/Properties

EnsureMinimumSize(...)