1 #include <gtest/gtest.h>
2 #include <marnav/nmea/nmea.hpp>
3 #include <marnav/nmea/pgrmm.hpp>
4 #include "type_traits_helper.hpp"
9 using namespace marnav
;
11 class Test_nmea_pgrmm
: public ::testing::Test
15 TEST_F(Test_nmea_pgrmm
, contruction
)
20 TEST_F(Test_nmea_pgrmm
, properties
)
22 nmea_sentence_traits
<nmea::pgrmm
>();
25 TEST_F(Test_nmea_pgrmm
, parse
)
27 auto s
= nmea::make_sentence("$PGRMM,WGS 84*06");
28 ASSERT_NE(nullptr, s
);
30 auto pgrmm
= nmea::sentence_cast
<nmea::pgrmm
>(s
);
31 ASSERT_NE(nullptr, pgrmm
);
34 TEST_F(Test_nmea_pgrmm
, parse_invalid_number_of_arguments
)
37 nmea::detail::factory::sentence_parse
<nmea::pgrmm
>(nmea::talker::none
, {2, "@"}));
40 TEST_F(Test_nmea_pgrmm
, empty_to_string
)
44 EXPECT_STREQ("$PGRMM,*69", nmea::to_string(pgrmm
).c_str());
47 TEST_F(Test_nmea_pgrmm
, set_map_datum
)
50 pgrmm
.set_map_datum("WGS 84");
52 EXPECT_STREQ("$PGRMM,WGS 84*06", nmea::to_string(pgrmm
).c_str());
55 TEST_F(Test_nmea_pgrmm
, set_map_datum_empty
)
58 pgrmm
.set_map_datum("");
60 EXPECT_STREQ("$PGRMM,*69", nmea::to_string(pgrmm
).c_str());
63 TEST_F(Test_nmea_pgrmm
, set_map_datum_too_large
)
67 "012345678901234567890123456789012345678901234567890123456789012345678901234567890");
69 const auto s
= nmea::to_string(pgrmm
);
71 EXPECT_EQ(nmea::sentence::max_length
, s
.size());
73 "$PGRMM,012345678901234567890123456789012345678901234567890123456789012345678901*69",