NMEA: renaming enumeration 'positioning_system_mode_indicator' to 'mode_indicator'.
[marnav.git] / test / nmea / Test_nmea_pgrmm.cpp
blobdb8bb5f61e2ae393e7f27e7a3be015fcaff7ec37
1 #include <gtest/gtest.h>
2 #include <marnav/nmea/nmea.hpp>
3 #include <marnav/nmea/pgrmm.hpp>
4 #include "type_traits_helper.hpp"
6 namespace
9 using namespace marnav;
11 class Test_nmea_pgrmm : public ::testing::Test
15 TEST_F(Test_nmea_pgrmm, contruction) { nmea::pgrmm pgrmm; }
17 TEST_F(Test_nmea_pgrmm, properties) { nmea_sentence_traits<nmea::pgrmm>(); }
19 TEST_F(Test_nmea_pgrmm, parse)
21 auto s = nmea::make_sentence("$PGRMM,WGS 84*06");
22 ASSERT_NE(nullptr, s);
24 auto pgrmm = nmea::sentence_cast<nmea::pgrmm>(s);
25 ASSERT_NE(nullptr, pgrmm);
28 TEST_F(Test_nmea_pgrmm, parse_invalid_number_of_arguments)
30 EXPECT_ANY_THROW(nmea::sentence_parse<nmea::pgrmm>("@@", {2, "@"}));
33 TEST_F(Test_nmea_pgrmm, empty_to_string)
35 nmea::pgrmm pgrmm;
37 EXPECT_STREQ("$PGRMM,*69", nmea::to_string(pgrmm).c_str());
40 TEST_F(Test_nmea_pgrmm, set_map_datum)
42 nmea::pgrmm pgrmm;
43 pgrmm.set_map_datum("WGS 84");
45 EXPECT_STREQ("$PGRMM,WGS 84*06", nmea::to_string(pgrmm).c_str());
48 TEST_F(Test_nmea_pgrmm, set_map_datum_empty)
50 nmea::pgrmm pgrmm;
51 pgrmm.set_map_datum("");
53 EXPECT_STREQ("$PGRMM,*69", nmea::to_string(pgrmm).c_str());
56 TEST_F(Test_nmea_pgrmm, set_map_datum_too_large)
58 nmea::pgrmm pgrmm;
59 pgrmm.set_map_datum(
60 "012345678901234567890123456789012345678901234567890123456789012345678901234567890");
62 const auto s = nmea::to_string(pgrmm);
64 EXPECT_EQ(nmea::sentence::max_length, s.size());
65 EXPECT_STREQ(
66 "$PGRMM,012345678901234567890123456789012345678901234567890123456789012345678901*69",
67 s.c_str());