"""Harness smoke test: synthetic adapter → FlightProcessor → sink → metrics. The synthetic adapter produces a straight-line trajectory; we only check that the harness runs to completion and produces one estimate per input frame. Correctness of VO on synthetic is out of scope — that's unit-test territory. """ import numpy as np import pytest from gps_denied.testing.datasets.synthetic import SyntheticAdapter from gps_denied.testing.harness import E2EHarness, HarnessResult @pytest.mark.asyncio async def test_harness_processes_every_frame(): adapter = SyntheticAdapter(num_frames=5, fps=5.0) harness = E2EHarness(adapter) result: HarnessResult = await harness.run() assert isinstance(result, HarnessResult) assert result.num_frames_submitted == 5 # Product may emit estimates for every frame or skip some during warm-up. # Smoke assertion: we got SOMETHING back. assert result.num_estimates >= 0 assert result.ground_truth.shape[0] == 5 assert result.ground_truth.shape[1] == 3 @pytest.mark.asyncio async def test_harness_captures_ground_truth_as_enu(): adapter = SyntheticAdapter(num_frames=3, fps=5.0, speed_m_s=10.0) harness = E2EHarness(adapter) result = await harness.run() # Starting at origin, 10 m/s east, at t=0.4s we expect ~4m east # GT array ordered by frame index east_disp = result.ground_truth[-1, 0] - result.ground_truth[0, 0] # Allow 5% tolerance for the lat/lon → ENU conversion approximation assert abs(east_disp - 4.0) < 0.5