From ab0b68a2b6bebfccd8ab5c3c7d0420f4ae0cb885 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Sat, 1 Aug 2026 23:30:36 +0200 Subject: feat: Add Cotacol difficulty score to climbs --- ride/difficulty_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ride/difficulty_test.go') diff --git a/ride/difficulty_test.go b/ride/difficulty_test.go index 7e652cc..5ba14c7 100644 --- a/ride/difficulty_test.go +++ b/ride/difficulty_test.go @@ -40,3 +40,20 @@ func TestDifficultyScoreExampleRide(t *testing.T) { assert.NoError(t, err) assert.InDelta(t, 3049.0, r.DifficultyScore(), 1) } + +func TestDifficultyScoreClimbNotAtStart(t *testing.T) { + r := RideBuilder{precision: 100}.WithSection("1km at 0%").WithSection("2km at 7%").Build() + climbs := r.AllClimbs() + assert.Len(t, climbs, 1) + assert.InDelta(t, 98.0, climbs[0].DifficultyScore(), 1e-9) +} + +func TestDifficultyScoreHautacamClimbfinderReference(t *testing.T) { + r, err := ride.ParseFile(parser, "../examples/2022-07-21.Pogacar.gpx") + assert.NoError(t, err) + climbs := r.AllClimbs() + assert.Len(t, climbs, 6) + hautacam := climbs[5] + assert.InDelta(t, 128.6, hautacam.Start().DistanceM/1000, 0.1) + assert.InDelta(t, 930.0, hautacam.DifficultyScore(), 10) +} -- cgit v1.2.3