< Summary

Information
Class: Trailblazer.Pathing.NavigationGenerationCounter
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/NavigationGenerationCounter.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 30
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 Line coverage
CanAdvance(...)100%11100%
CanAdvance(...)100%11100%
Advance(...)100%11100%
Advance(...)100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/NavigationGenerationCounter.cs

#LineLine coverage
 1//=======================================================================
 2// NavigationGenerationCounter.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9
 10namespace Trailblazer.Pathing;
 11
 12/// <summary>Advances bounded identities without allowing an alias-producing wrap.</summary>
 13internal static class NavigationGenerationCounter
 14{
 2186015    internal static bool CanAdvance(long generation) => generation < long.MaxValue;
 16
 425717    internal static bool CanAdvance(ulong generation) => generation < ulong.MaxValue;
 18
 19    internal static long Advance(long generation, string exhaustionMessage)
 20    {
 2125021        SwiftThrowHelper.ThrowIfTrue(!CanAdvance(generation), message: exhaustionMessage);
 2124922        return generation + 1;
 23    }
 24
 25    internal static ulong Advance(ulong generation, string exhaustionMessage)
 26    {
 118027        SwiftThrowHelper.ThrowIfTrue(!CanAdvance(generation), message: exhaustionMessage);
 117928        return generation + 1;
 29    }
 30}