From 522512197de372aa9b9c5584711619a76a5546d8 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Thu, 27 Aug 2026 12:07:11 +0200 Subject: clenaup --- climb/detection_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'climb/detection_test.go') diff --git a/climb/detection_test.go b/climb/detection_test.go index 3c6a33b..e02c02b 100644 --- a/climb/detection_test.go +++ b/climb/detection_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/martinlehoux/biking_home/climb" - "github.com/martinlehoux/biking_home/core" + "github.com/martinlehoux/biking_home/geo" "github.com/martinlehoux/biking_home/internal/routetest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -43,7 +43,7 @@ func TestDetectClimbsSkipsMiddleClaim(t *testing.T) { // A climb, a false flat giving a saddle, then a climb again. Claiming the // saddle's descent base should leave both climbs detected separately. route := routetest.MustRoute("2km at 7% | 1km at -7% | 2km at 7%") - detected := climb.Detect(route, []core.Interval{core.NewInterval(20, 20)}, climb.ClimbSlopeMinimum) + detected := climb.Detect(route, []geo.Interval{geo.NewInterval(20, 20)}, climb.ClimbSlopeMinimum) // No free region falls under the min distance except the two climbs. assert.Len(t, detected, 2) @@ -54,13 +54,13 @@ func TestDetectClimbsSkipsMiddleClaim(t *testing.T) { func TestDetectClimbsOverlappingClaimDropsClimb(t *testing.T) { // Claiming the ascent region entirely swallows the climb. route := routetest.MustRoute("2km at 7% | 20km at 0%") - detected := climb.Detect(route, []core.Interval{core.NewInterval(0, 40)}, climb.ClimbSlopeMinimum) + detected := climb.Detect(route, []geo.Interval{geo.NewInterval(0, 40)}, climb.ClimbSlopeMinimum) assert.Empty(t, detected) } func TestDetectClimbsIgnoresOutOfRangeClaim(t *testing.T) { route := routetest.MustRoute("2km at 7% | 20km at 0%") - detected := climb.Detect(route, []core.Interval{core.NewInterval(-5, -1)}, climb.ClimbSlopeMinimum) + detected := climb.Detect(route, []geo.Interval{geo.NewInterval(-5, -1)}, climb.ClimbSlopeMinimum) require.Len(t, detected, 1) assert.Equal(t, "0.0km-2.0km: 2.0km at 7.0% (98 pts - Cat 3)", describe(route, detected[0])) } @@ -74,10 +74,10 @@ func TestDetectClimbsWithUnsortedClaimsDropsOverlappingClimb(t *testing.T) { route := routetest.MustRoute("2km at 7% | 1km at -7% | 2km at 7%") // Both climbs claimed, but in reverse order (mimics ORDER BY id returning 30-50 before 0-20). // Sorted input correctly yields 0 detected climbs. - sorted := []core.Interval{core.NewInterval(0, 20), core.NewInterval(30, 50)} + sorted := []geo.Interval{geo.NewInterval(0, 20), geo.NewInterval(30, 50)} assert.Empty(t, climb.Detect(route, sorted, climb.ClimbSlopeMinimum)) - unsorted := []core.Interval{core.NewInterval(30, 50), core.NewInterval(0, 20)} + unsorted := []geo.Interval{geo.NewInterval(30, 50), geo.NewInterval(0, 20)} detected := climb.Detect(route, unsorted, climb.ClimbSlopeMinimum) // Before fix this fails: freeRegions skips {0,20} because 20 < 30 and returns 1 climb. assert.Empty(t, detected, "unsorted claimed ranges must still suppress overlapping climbs — expected 0, got %v", detected) -- cgit v1.3