summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2019-02-21 15:46:22 -0800
committerGary E. Miller <gem@rellim.com>2019-02-21 15:46:22 -0800
commit0e4684abb7058f36eea60abba5124d019f9bc01b (patch)
tree769afff5404b5fd970afdca596f9a152ec52ca9d /tests
parentc40b62c5b409aa97acfa397e94dfb40198c62ea0 (diff)
downloadgpsd-0e4684abb7058f36eea60abba5124d019f9bc01b.tar.gz
deg_to_s(): Add more tests. Not all 'good'.
deg_to_s() needs to do better rounding.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gpsdclient.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/tests/test_gpsdclient.c b/tests/test_gpsdclient.c
index 95308cd4..6f81633f 100644
--- a/tests/test_gpsdclient.c
+++ b/tests/test_gpsdclient.c
@@ -31,9 +31,32 @@ struct test tests[] = {
" 1 01' 01.99899\""},
/* 1 deg, 2 min, 2.0999 sec */
{(1.0 + 2.0/60.0 + 2.999/3600.0),
- " 1.03416638",
- " 1 02.049983'",
- " 1 02' 02.99900\""},
+ " 1.03416638",
+ " 1 02.049983'",
+ " 1 02' 02.99900\""},
+ /* 44.99999994, should not be rounded up */
+ {44.99999994,
+ " 44.99999994",
+ " 44 59.999996'",
+ " 44 59' 59.99978\""},
+ /* 44.99999999999 */
+ /* FIXME: s/b rounded */
+ {44.99999999999,
+ " 44.99999999",
+ " 44 59.999999'",
+ " 44 59' 59.99999\""},
+ /* -44.99999999999 */
+ /* FIXME: should not be nan? */
+ {-44.99999999999,
+ "nan",
+ "nan",
+ "nan"},
+ /* 359.99999999999 */
+ /* FIXME: s/b rounded */
+ {359.99999999999,
+ "359.99999999",
+ "359 59.999999'",
+ "359 59' 59.99999\""},
};