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
) { 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
)
37 EXPECT_STREQ("$PGRMM,*69", nmea::to_string(pgrmm
).c_str());
40 TEST_F(Test_nmea_pgrmm
, set_map_datum
)
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
)
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
)
60 "012345678901234567890123456789012345678901234567890123456789012345678901234567890");
62 const auto s
= nmea::to_string(pgrmm
);
64 EXPECT_EQ(nmea::sentence::max_length
, s
.size());
66 "$PGRMM,012345678901234567890123456789012345678901234567890123456789012345678901*69",