< Summary

Information
Class: Trailblazer.Navigation.GuidedClimbIntentResolver
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Navigator/Guidance/GuidedClimbIntentResolver.cs
Line coverage
86%
Covered lines: 19
Uncovered lines: 3
Coverable lines: 22
Total lines: 47
Line coverage: 86.3%
Branch coverage
84%
Covered branches: 22
Total branches: 26
Branch coverage: 84.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Resolve(...)93.75%161692.3%
RequestsClimbIntent(...)70%111077.77%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Navigator/Guidance/GuidedClimbIntentResolver.cs

#LineLine coverage
 1using Trailblazer.Pathing;
 2
 3namespace Trailblazer.Navigation;
 4
 5/// <summary>
 6/// Resolves whether a guided request or handoff currently implies climb intent.
 7/// </summary>
 8internal static class GuidedClimbIntentResolver
 9{
 10    public static bool Resolve(IPathRequest pathRequest, GuidedVolumeExitHandoff? handoff = null)
 11    {
 7112        if (handoff != null
 7113            && !string.IsNullOrEmpty(handoff.TransitionId)
 7114            && TraversalTransitionRegistry.TryGet(handoff.TransitionId, out TraversalTransition transition))
 15        {
 1216            return transition.RequestsClimbIntent;
 17        }
 18
 5919        return pathRequest switch
 5920        {
 3621            AStarPathRequest aStar when aStar.AllowTraversalTransitions =>
 2222                RequestsClimbIntent(HybridPathRequest.CreateFromAStar(aStar)),
 723            FlowFieldPathRequest flowField when flowField.AllowTraversalTransitions =>
 624                RequestsClimbIntent(HybridPathRequest.CreateFromFlowField(flowField)),
 025            HybridPathRequest hybrid => RequestsClimbIntent(hybrid),
 3126            _ => false
 5927        };
 28    }
 29
 30    private static bool RequestsClimbIntent(HybridPathRequest? request)
 31    {
 2832        if (request == null)
 033            return false;
 34
 2835        TraversalTransition[]? directedTransitions = request.RoutePlan?.DirectedTransitions;
 2836        if (directedTransitions == null)
 037            return false;
 38
 9239        for (int i = 0; i < directedTransitions.Length; i++)
 40        {
 2641            if (directedTransitions[i].RequestsClimbIntent)
 842                return true;
 43        }
 44
 2045        return false;
 46    }
 47}