diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-25 13:26:22 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-25 13:26:22 +0200 |
| commit | e73b7a9ccb4bc61e54d1fdc61b5954879c637d00 (patch) | |
| tree | 34658a02faee971fa041a3f02160770ae283a6de /internal/ridetest/ride_test.go | |
| parent | d5de3a6fefbc57bccfb1fe688f9c190ccf87d58d (diff) | |
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.
Diffstat (limited to 'internal/ridetest/ride_test.go')
| -rw-r--r-- | internal/ridetest/ride_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
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)) |
