Build: update docker build scripts
[marnav.git] / test / nmea / Test_nmea_pgrmm.cpp
blob836fd1cdc7fbff27054bca4dcd147b7788038d25
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)
17 nmea::pgrmm pgrmm;
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)
36 EXPECT_ANY_THROW(
37 nmea::detail::factory::sentence_parse<nmea::pgrmm>(nmea::talker::none, {2, "@"}));
40 TEST_F(Test_nmea_pgrmm, empty_to_string)
42 nmea::pgrmm pgrmm;
44 EXPECT_STREQ("$PGRMM,*69", nmea::to_string(pgrmm).c_str());
47 TEST_F(Test_nmea_pgrmm, set_map_datum)
49 nmea::pgrmm pgrmm;
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)
57 nmea::pgrmm pgrmm;
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)
65 nmea::pgrmm pgrmm;
66 pgrmm.set_map_datum(
67 "012345678901234567890123456789012345678901234567890123456789012345678901234567890");
69 const auto s = nmea::to_string(pgrmm);
71 EXPECT_EQ(nmea::sentence::max_length, s.size());
72 EXPECT_STREQ(
73 "$PGRMM,012345678901234567890123456789012345678901234567890123456789012345678901*69",
74 s.c_str());