< Summary

Class:Itinero.Network.Tiles.ArrayBaseExtensions
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Network/Tiles/ArrayBaseExtensions.cs
Covered lines:18
Uncovered lines:6
Coverable lines:24
Total lines:60
Line coverage:75% (18 of 24)
Covered branches:10
Total branches:16
Branch coverage:62.5% (10 of 16)
Tag:251_23667616543

Metrics

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

File(s)

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

#LineLine coverage
 1namespace Itinero.Network.Tiles;
 2
 3internal static class ArrayBaseExtensions
 4{
 5    /// <summary>
 6    /// Increase the native byte array size with a fixed step (but never more) to ensure the given position fits.
 7    /// </summary>
 8    /// <param name="array">The array.</param>
 9    /// <param name="position">The position.</param>
 10    /// <param name="step">The steps to add.</param>
 11    public static void EnsureMinimumSize(ref byte[] array, long position, long step = 16)
 16328312    {
 29576613        if (array.Length > position) return;
 3080014        var newSize = array.Length + step;
 3080015        while (newSize <= position) newSize += step;
 3080016        System.Array.Resize(ref array, (int)newSize);
 16328317    }
 18
 19    /// <summary>
 20    /// Increase the native int array size with a fixed step (but never more) to ensure the given position fits.
 21    /// </summary>
 22    /// <param name="array">The array.</param>
 23    /// <param name="position">The position.</param>
 24    /// <param name="step">The steps to add.</param>
 25    public static void EnsureMinimumSize(ref int[] array, long position, long step = 16)
 326    {
 327        if (array.Length > position) return;
 328        var newSize = array.Length + step;
 529        while (newSize <= position) newSize += step;
 330        System.Array.Resize(ref array, (int)newSize);
 331    }
 32
 33    /// <summary>
 34    /// Increase the native uint array size with a fixed step (but never more) to ensure the given position fits.
 35    /// </summary>
 36    /// <param name="array">The array.</param>
 37    /// <param name="position">The position.</param>
 38    /// <param name="step">The steps to add.</param>
 39    public static void EnsureMinimumSize(ref uint[] array, long position, long step = 16)
 3919740    {
 7546041        if (array.Length > position) return;
 293442        var newSize = array.Length + step;
 293443        while (newSize <= position) newSize += step;
 293444        System.Array.Resize(ref array, (int)newSize);
 3919745    }
 46
 47    /// <summary>
 48    /// Increase the native string array size with a fixed step (but never more) to ensure the given position fits.
 49    /// </summary>
 50    /// <param name="array">The array.</param>
 51    /// <param name="position">The position.</param>
 52    /// <param name="step">The steps to add.</param>
 53    public static void EnsureMinimumSize(ref string[] array, long position, long step = 16)
 054    {
 055        if (array.Length > position) return;
 056        var newSize = array.Length + step;
 057        while (newSize <= position) newSize += step;
 058        System.Array.Resize(ref array, (int)newSize);
 059    }
 60}