void ElapsedLapTimeTest::testStopRecording() { gpsSnap.deltaFirstFix = 3; lap_started_normal_event(&gpsSnap); CPPUNIT_ASSERT_EQUAL(0, lapstats_elapsed_time()); gpsSnap.deltaFirstFix = 15; update_elapsed_time(&gpsSnap); CPPUNIT_ASSERT_EQUAL(12, lapstats_elapsed_time()); gpsSnap.deltaFirstFix = 122; lap_finished_event(&gpsSnap); update_elapsed_time(&gpsSnap); CPPUNIT_ASSERT_EQUAL(12, lapstats_elapsed_time()); }
/** * All logic associated with determining if we are at the finish line. */ static void process_finish_logic(const GpsSnapshot *gpsSnapshot) { if (!lapstats_lap_in_progress()) return; if (!isGeoTriggerTripped(&g_finish_geo_trigger)) return; const GeoPoint point = gpsSnapshot->sample.point; if (!gc_isPointInGeoCircle(&point, g_geo_circles.finish)) return; // If we get here, then we have completed a lap. lap_finished_event(gpsSnapshot); }