Unit tests: speed smoothing, CSC wraparound, distance accumulation #22

Closed
opened 2026-08-31 17:14:42 +02:00 by robert · 1 comment
robert commented 2026-08-31 17:14:42 +02:00 (Migrated from git.butzei.de)

Goal

Lock in the arithmetic that is painful to debug on a bike.

Acceptance criteria

  • Speed smoothing and the stop clamp tested against synthetic fix sequences
  • CSC 16-bit event-time and 32-bit revolution wraparound tested at the boundaries
  • Distance accumulation tested against a known GPX with a hand-checked total
  • Bad-accuracy fix rejection tested
  • Source arbitration hand-over tested, including the no-source case
  • All tests run on the JVM with no device or network

Files

  • companion/src/test/
## Goal Lock in the arithmetic that is painful to debug on a bike. ## Acceptance criteria - [ ] Speed smoothing and the stop clamp tested against synthetic fix sequences - [ ] CSC 16-bit event-time and 32-bit revolution wraparound tested at the boundaries - [ ] Distance accumulation tested against a known GPX with a hand-checked total - [ ] Bad-accuracy fix rejection tested - [ ] Source arbitration hand-over tested, including the no-source case - [ ] All tests run on the JVM with no device or network ## Files - `companion/src/test/`
Owner

Closed by PR #103 (merged): audited, not rewritten. Speed smoothing/stop clamp, CSC wraparound, bad-accuracy rejection, and source-handover-including-no-source were all already genuinely covered by #69/#17/#18/#19's PRs tonight (SpeedPipelineTest, GpsQualityTest, CscMeasurementTest, WheelSpeedTrackerTest, StopDetectorTest) \u2014 confirmed by reading each test, not assumed, no duplicates added.\n\nThe one real gap \u2014 "distance accumulation tested against a known GPX with a hand-checked total" against the live-ride SpeedPipeline.onGpsFix path specifically (different from RealWorldFixtureTest's import-time computeRouteMetrics path on the same file) \u2014 filled with SpeedPipelineGpxReplayTest: replays the real ~119km Havelchaussee fixture's raw 2795 points (bypassing RDP simplification, using each point's real recorded timestamp) through onGpsFix one at a time. Result: 119,020.29m vs the ~119,020.29m ground truth \u2014 about 3.5mm off. Tight tolerance justified, not padded: independently confirmed via a companion Python script that this specific ride has zero confirmed-stop events anywhere (no two consecutive points are ever slower than 0.8 m/s apart), so moving distance and raw distance are the same quantity for this fixture specifically \u2014 documented as fixture-specific, not a general claim.\n\nVerified for real: :companion:core:test/:companion:pebble:test and :companion:core:koverVerify (coverage floor holds) all green.

Closed by PR #103 (merged): audited, not rewritten. Speed smoothing/stop clamp, CSC wraparound, bad-accuracy rejection, and source-handover-including-no-source were all already genuinely covered by #69/#17/#18/#19's PRs tonight (SpeedPipelineTest, GpsQualityTest, CscMeasurementTest, WheelSpeedTrackerTest, StopDetectorTest) \u2014 confirmed by reading each test, not assumed, no duplicates added.\n\nThe one real gap \u2014 \"distance accumulation tested against a known GPX with a hand-checked total\" against the *live-ride* SpeedPipeline.onGpsFix path specifically (different from RealWorldFixtureTest's import-time computeRouteMetrics path on the same file) \u2014 filled with SpeedPipelineGpxReplayTest: replays the real ~119km Havelchaussee fixture's raw 2795 points (bypassing RDP simplification, using each point's real recorded timestamp) through onGpsFix one at a time. Result: 119,020.29m vs the ~119,020.29m ground truth \u2014 about 3.5mm off. Tight tolerance justified, not padded: independently confirmed via a companion Python script that this specific ride has zero confirmed-stop events anywhere (no two consecutive points are ever slower than 0.8 m/s apart), so moving distance and raw distance are the same quantity for this fixture specifically \u2014 documented as fixture-specific, not a general claim.\n\nVerified for real: `:companion:core:test`/`:companion:pebble:test` and `:companion:core:koverVerify` (coverage floor holds) all green.
Sign in to join this conversation.
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
robert/PedalPebble#22
No description provided.