From e73b7a9ccb4bc61e54d1fdc61b5954879c637d00 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Tue, 25 Aug 2026 13:26:22 +0200 Subject: Migrate cross-package ride test fixtures to the ridetest DSL Replace raw FromColumns 4-array blocks in official_climb, mountain_pass and web test rides with ridetest.MustRide strings. Add a Heading option to ridetest for routes whose points are spaced differently per kilometer (e.g. the mountain_pass expanded-bounds route at 0.1 degrees/km). Lap, direction and cluster tests in official_climb keep FromColumns: the DSL generates monotonic northeast coords and cannot express per-point loops or reversals. --- internal/ridetest/ride_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'internal/ridetest/ride_test.go') diff --git a/internal/ridetest/ride_test.go b/internal/ridetest/ride_test.go index 69c084d..65483f2 100644 --- a/internal/ridetest/ride_test.go +++ b/internal/ridetest/ride_test.go @@ -53,6 +53,17 @@ func TestRideStartCoordHeading(t *testing.T) { assert.InDelta(t, 5.12, r.Coords()[2].Lon, 1e-9) } +func TestRideHeadingOption(t *testing.T) { + r, err := Ride("1km at 0%", StartCoord(43.0, 5.0), Heading(0.1, 0.1), Sampling(1000)) + require.NoError(t, err) + + // A single kilometer at 0.1°/km ends at (43.1, 5.1), matching rides whose + // points are spaced 0.1° apart over a kilometer. + require.Len(t, r.Coords(), 2) + assert.InDelta(t, 43.1, r.Coords()[1].Lat, 1e-9) + assert.InDelta(t, 5.1, r.Coords()[1].Lon, 1e-9) +} + func TestRideStartTime(t *testing.T) { start := time.Date(2026, 8, 1, 10, 0, 0, 0, time.UTC) r, err := Ride("1km at 0%", StartTime(start), Sampling(500)) -- cgit v1.3