AlgorithmHarness
object AlgorithmHarness
Replay a recorded trace through an algorithm and score the result.
This is the part that turns "algorithm A is better than algorithm B" from an argument into a measurement. Without it, every threshold in the system is a number somebody once felt good about, and every change is unfalsifiable.
The whole harness is pure and synchronous because MileageAlgorithm.process is: no device, no emulator, no coroutines, no clock. A trace replays identically on a laptop, in CI, and in a browser preview.
Functions
Link copied to clipboard
fun run(algorithm: MileageAlgorithm, trace: List<Fix>, session: SessionContext = SessionContext(startedAtMs = trace.firstOrNull()?.timeMs ?: 0L)): RunReport
Link copied to clipboard
Verify that resuming from a snapshot mid-trace yields the same totals as an uninterrupted run — minus the one leg deliberately dropped across the resume boundary.