< 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:224_14471318300

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)
 132017    {
 132018        if (array.Length > position)
 71919        {
 71920            return;
 21        }
 22
 60123        var increase = System.Math.DivRem(position - array.Length, step, out _) + 1;
 60124        increase *= step;
 25
 60126        var size = array.Length;
 60127        array.Resize(array.Length + increase);
 2042828        for (var i = size; i < array.Length; i++)
 961329        {
 961330            array[i] = fill;
 961331        }
 132032    }
 33}

Methods/Properties

EnsureMinimumSize(...)