< Summary

Information
Class: Trailblazer.Pathing.TraversalAuthoringMapExtensions
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Diagnostics/TraversalAuthoringMap.Extensions.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 38
Line coverage: 100%
Branch coverage
90%
Covered branches: 9
Total branches: 10
Branch coverage: 90%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
PrintXZPlane(...)90%1010100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Diagnostics/TraversalAuthoringMap.Extensions.cs

#LineLine coverage
 1using System;
 2
 3namespace Trailblazer.Pathing;
 4
 5/// <summary>
 6/// Provides extension methods for debugging and visualizing the layout of a TraversalAuthoringMap.
 7/// </summary>
 8public static class TraversalAuthoringMapExtensions
 9{
 10    /// <summary>
 11    /// Prints the token layout of a specific XZ plane in the source map for debugging purposes.
 12    /// </summary>
 13    /// <param name="map">The traversal authoring map to print.</param>
 14    /// <param name="yLevel">The Y level of the XZ plane to print.</param>
 15    /// <exception cref="ArgumentOutOfRangeException">Thrown if the specified Y level is out of bounds.</exception>
 16    public static void PrintXZPlane(this TraversalAuthoringMap map, int yLevel)
 17    {
 218        int minY = 0;
 219        int maxYExclusive = map.SourceMap.GetLength(0);
 220        if (yLevel < minY || yLevel >= maxYExclusive)
 121            throw new ArgumentOutOfRangeException(nameof(yLevel));
 22
 123        Console.WriteLine($"Token XZ Plane at Y={yLevel} for Traversal Authoring Map [{map.ChartName}]:");
 24
 125        int sizeX = map.SourceMap.GetLength(1);
 126        int sizeZ = map.SourceMap.GetLength(2);
 627        for (int z = 0; z < sizeZ; z++)
 28        {
 1229            for (int x = 0; x < sizeX; x++)
 30            {
 431                string token = map.SourceMap[yLevel, x, z];
 432                Console.Write(string.IsNullOrWhiteSpace(token) ? ". " : $"{token} ");
 33            }
 34
 235            Console.WriteLine();
 36        }
 137    }
 38}