1 #include "type_traits_helper.hpp"
2 #include <marnav/nmea/nmea.hpp>
3 #include <gtest/gtest.h>
4 #include <marnav/nmea/pgrmz.hpp>
9 using namespace marnav
;
11 class Test_nmea_pgrmz
: public ::testing::Test
15 TEST_F(Test_nmea_pgrmz
, contruction
)
20 TEST_F(Test_nmea_pgrmz
, properties
)
22 nmea_sentence_traits
<nmea::pgrmz
>();
25 TEST_F(Test_nmea_pgrmz
, parse
)
27 auto s
= nmea::make_sentence("$PGRMZ,1494,f,*10");
28 ASSERT_NE(nullptr, s
);
30 auto pgrmz
= nmea::sentence_cast
<nmea::pgrmz
>(s
);
31 ASSERT_NE(nullptr, pgrmz
);
34 TEST_F(Test_nmea_pgrmz
, parse_invalid_number_of_arguments
)
37 nmea::detail::factory::sentence_parse
<nmea::pgrmz
>(nmea::talker::none
, {2, "@"}));
39 nmea::detail::factory::sentence_parse
<nmea::pgrmz
>(nmea::talker::none
, {4, "@"}));
42 TEST_F(Test_nmea_pgrmz
, empty_to_string
)
46 EXPECT_STREQ("$PGRMZ,0,f,*28", nmea::to_string(pgrmz
).c_str());
49 TEST_F(Test_nmea_pgrmz
, set_altitude
)
52 pgrmz
.set_altitude(units::feet
{100});
54 EXPECT_STREQ("$PGRMZ,100,f,*29", nmea::to_string(pgrmz
).c_str());
57 TEST_F(Test_nmea_pgrmz
, set_fix_nofix
)
60 pgrmz
.set_fix(nmea::pgrmz::fix_type::no_fix
);
62 EXPECT_STREQ("$PGRMZ,0,f,1*19", nmea::to_string(pgrmz
).c_str());
65 TEST_F(Test_nmea_pgrmz
, set_fix_2d
)
68 pgrmz
.set_fix(nmea::pgrmz::fix_type::d2fix
);
70 EXPECT_STREQ("$PGRMZ,0,f,2*1A", nmea::to_string(pgrmz
).c_str());
73 TEST_F(Test_nmea_pgrmz
, set_fix_3d
)
76 pgrmz
.set_fix(nmea::pgrmz::fix_type::d3fix
);
78 EXPECT_STREQ("$PGRMZ,0,f,3*1B", nmea::to_string(pgrmz
).c_str());