diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-04-21 11:51:03 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-04-21 11:51:03 +0200 |
| commit | c47470b51075fbac1adea281f3324c1d22b6ff5f (patch) | |
| tree | 33df3b64d5153ac96f3d7f9086465cf81b7c8fad /ride/climb_test.go | |
| parent | c05cd9cb6305f15e3de985e5040142e0156a1286 (diff) | |
Cleanup parsing
Diffstat (limited to 'ride/climb_test.go')
| -rw-r--r-- | ride/climb_test.go | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/ride/climb_test.go b/ride/climb_test.go index 75aeb0e..ad00d65 100644 --- a/ride/climb_test.go +++ b/ride/climb_test.go @@ -9,7 +9,6 @@ import ( "github.com/martinlehoux/biking_home/ride" "github.com/martinlehoux/kagamigo/kcore" "github.com/stretchr/testify/assert" - "github.com/tkrajina/gpxgo/gpx" ) type RideBuilderSection struct { @@ -60,6 +59,8 @@ func (b RideBuilder) Build() ride.Ride { return ride.FromPoints(points) } +var parser = ride.GPXRideParser{} + func TestClimbThenFalseFlat(t *testing.T) { r := RideBuilder{precision: 100}.WithSection("2km at 7%").WithSection("10km at 1%").Build() climbs := r.AllClimbs() @@ -77,9 +78,8 @@ func TestSmallClimbWithDescentInsideFalseFlat(t *testing.T) { } func TestPogacar20220721(t *testing.T) { - gpxContent, err := gpx.ParseFile("../examples/2022-07-21.Pogacar.gpx") + r, err := ride.ParseFile(parser, "../examples/2022-07-21.Pogacar.gpx") assert.NoError(t, err) - r := ride.FromGPX(gpxContent) climbs := r.AllClimbs() assert.Len(t, climbs, 6) @@ -92,9 +92,8 @@ func TestPogacar20220721(t *testing.T) { } func TestBouclesVerdon2024(t *testing.T) { - gpxContent, err := gpx.ParseFile("../examples/2024-06-29.BouclesVerdon.gpx") + r, err := ride.ParseFile(parser, "../examples/2024-06-29.BouclesVerdon.gpx") assert.NoError(t, err) - r := ride.FromGPX(gpxContent) climbs := r.AllClimbs() assert.Len(t, climbs, 6) @@ -107,9 +106,8 @@ func TestBouclesVerdon2024(t *testing.T) { } func TestMimetArbois20241229(t *testing.T) { - gpxContent, err := gpx.ParseFile("../examples/2024-12-29.MimetArbois.gpx") + r, err := ride.ParseFile(parser, "../examples/2024-12-29.MimetArbois.gpx") assert.NoError(t, err) - r := ride.FromGPX(gpxContent) climbs := r.AllClimbs() assert.Len(t, climbs, 2) @@ -118,9 +116,8 @@ func TestMimetArbois20241229(t *testing.T) { } func TestMimetArbois20250104(t *testing.T) { - gpxContent, err := gpx.ParseFile("../examples/2025-01-04.MimetArbois.gpx") + r, err := ride.ParseFile(parser, "../examples/2025-01-04.MimetArbois.gpx") assert.NoError(t, err) - r := ride.FromGPX(gpxContent) climbs := r.AllClimbs() assert.Len(t, climbs, 2) @@ -130,9 +127,8 @@ func TestMimetArbois20250104(t *testing.T) { // https://www.strava.com/activities/9282265844 func TestAlpesVerdonTour20230617(t *testing.T) { - gpxContent, err := gpx.ParseFile("../examples/2023-06-17.AlpesVerdonTour.gpx") + r, err := ride.ParseFile(parser, "../examples/2023-06-17.AlpesVerdonTour.gpx") assert.NoError(t, err) - r := ride.FromGPX(gpxContent) climbs := r.AllClimbs() assert.Len(t, climbs, 6) |