MCPcopy Create free account
hub / github.com/comaps/comaps / UNIT_TEST

Function UNIT_TEST

libs/map/map_tests/extrapolator_tests.cpp:40–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40UNIT_TEST(LinearExtrapolation)
41{
42 GpsInfo const loc1 = GetGpsInfo(0.0 /* timestampS */, 1.0 /* m_latitude */, 1.0 /* m_longitude */,
43 1.0 /* m_altitude */, 10.0 /* m_speed */);
44 GpsInfo const loc2 = GetGpsInfo(1.0 /* timestampS */, 1.01 /* m_latitude */, 1.01 /* m_longitude */,
45 2.0 /* m_altitude */, 12.0 /* m_speed */);
46
47 // 0 ms after |point2|.
48 TestGpsInfo(LinearExtrapolation(loc1, loc2, 0 /* timeAfterPoint2Ms */), loc2);
49
50 // 100 ms after |point2|.
51 {
52 GpsInfo const expected = GetGpsInfo(1.1 /* timestampS */, 1.011 /* m_latitude */, 1.011 /* m_longitude */,
53 2.1 /* m_altitude */, 12.2 /* m_speed */);
54 TestGpsInfo(LinearExtrapolation(loc1, loc2, 100 /* timeAfterPoint2Ms */), expected);
55 }
56
57 // 200 ms after |point2|.
58 {
59 GpsInfo const expected = GetGpsInfo(1.2 /* timestampS */, 1.012 /* m_latitude */, 1.012 /* m_longitude */,
60 2.2 /* m_altitude */, 12.4 /* m_speed */);
61 TestGpsInfo(LinearExtrapolation(loc1, loc2, 200 /* timeAfterPoint2Ms */), expected);
62 }
63
64 // 1000 ms after |point2|.
65 {
66 GpsInfo const expected = GetGpsInfo(2.0 /* timestampS */, 1.02 /* m_latitude */, 1.02 /* m_longitude */,
67 3.0 /* m_altitude */, 14.0 /* m_speed */);
68 TestGpsInfo(LinearExtrapolation(loc1, loc2, 1000 /* timeAfterPoint2Ms */), expected);
69 }
70}
71
72UNIT_TEST(AreCoordsGoodForExtrapolation)
73{

Callers

nothing calls this directly

Calls 5

GetGpsInfoFunction · 0.85
TestGpsInfoFunction · 0.85
LinearExtrapolationFunction · 0.85
TESTFunction · 0.85

Tested by

no test coverage detected