tests: specify maximum minmea_scan coordinate range

This commit is contained in:
Kosma Moczek 2014-03-03 15:22:59 +01:00
parent 7543c35079
commit 0b044db606

14
tests.c
View File

@ -117,6 +117,20 @@ START_TEST(test_minmea_scan_f)
ck_assert(minmea_scan("-1.23,V", "f", &value, &scale) == true);
ck_assert_int_eq(value, -123);
ck_assert_int_eq(scale, 100);
/* some GPS units have absurdly big precision. handle whatever int handles. */
ck_assert(minmea_scan("5106.94091", "f", &value, &scale) == true);
ck_assert_int_eq(value, 510694091);
ck_assert_int_eq(scale, 100000);
/* for now we support +-180 degrees with 5 decimal digits; anything
* more will overflow. */
ck_assert(minmea_scan("18000.00000", "f", &value, &scale) == true);
ck_assert_int_eq(value, 1800000000);
ck_assert_int_eq(scale, 100000);
ck_assert(minmea_scan("-18000.00000", "f", &value, &scale) == true);
ck_assert_int_eq(value, -1800000000);
ck_assert_int_eq(scale, 100000);
}
END_TEST