From daed9fd7079ab4786c9730b62b92553e2c4f4abf Mon Sep 17 00:00:00 2001 From: mek_x Date: Wed, 23 Apr 2014 23:55:02 +0200 Subject: [PATCH] tests: added unit tests for gsv --- tests.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests.c b/tests.c index 0159fc1..4becf22 100644 --- a/tests.c +++ b/tests.c @@ -379,6 +379,47 @@ START_TEST(test_minmea_parse_gsa1) } END_TEST +START_TEST(test_minmea_parse_gsv1) +{ + const char *sentence = "$GPGSV,3,3,11,22,42,067,42,24,14,311,43,27,05,244,00,,,,*4D"; + struct minmea_sentence_gsv frame = {}; + static const struct minmea_sentence_gsv expected = { + .total_msgs = 3, + .msg_nr = 3, + .total_sats = 11, + .sats = { + { + .nr = 22, + .elevation = 42, + .azimuth = 67, + .snr = 42 + }, + { + .nr = 24, + .elevation = 14, + .azimuth = 311, + .snr = 43 + }, + { + .nr = 27, + .elevation = 5, + .azimuth = 244, + .snr = 0 + }, + { + .nr = 0, + .elevation = 0, + .azimuth = 0, + .snr = 0 + } + } + }; + ck_assert(minmea_check(sentence) == true); + ck_assert(minmea_parse_gsv(&frame, sentence) == true); + ck_assert(!memcmp(&frame, &expected, sizeof(frame))); +} +END_TEST + START_TEST(test_minmea_usage1) { const char *sentences[] = { @@ -497,6 +538,7 @@ Suite *minmea_suite(void) tcase_add_test(tc_parse, test_minmea_parse_rmc2); tcase_add_test(tc_parse, test_minmea_parse_gga1); tcase_add_test(tc_parse, test_minmea_parse_gsa1); + tcase_add_test(tc_parse, test_minmea_parse_gsv1); suite_add_tcase(s, tc_parse); TCase *tc_usage = tcase_create("minmea_usage");