1 #include <marnav/nmea/zte.hpp>
2 #include "type_traits_helper.hpp"
3 #include <marnav/nmea/nmea.hpp>
4 #include <gtest/gtest.h>
8 using namespace marnav
;
10 class Test_nmea_zte
: public ::testing::Test
14 TEST_F(Test_nmea_zte
, contruction
)
16 EXPECT_NO_THROW(nmea::zte zte
);
19 TEST_F(Test_nmea_zte
, properties
)
21 nmea_sentence_traits
<nmea::zte
>();
24 TEST_F(Test_nmea_zte
, parse
)
26 auto s
= nmea::make_sentence("$GPZTE,123456.1,000010,POINT1*14");
27 ASSERT_NE(nullptr, s
);
29 auto zte
= nmea::sentence_cast
<nmea::zte
>(s
);
30 ASSERT_NE(nullptr, zte
);
32 EXPECT_EQ(nmea::time(12, 34, 56, 100), zte
->get_time_utc());
33 EXPECT_EQ(nmea::duration(0, 0, 10), zte
->get_time_remaining());
34 EXPECT_STREQ("POINT1", zte
->get_waypoint_id().c_str());
37 TEST_F(Test_nmea_zte
, parse_invalid_number_of_arguments
)
40 nmea::detail::factory::sentence_parse
<nmea::zte
>(nmea::talker::none
, {2, "@"}));
42 nmea::detail::factory::sentence_parse
<nmea::zte
>(nmea::talker::none
, {4, "@"}));
45 TEST_F(Test_nmea_zte
, empty_to_string
)
49 EXPECT_STREQ("$GPZTE,000000,000000,*70", nmea::to_string(zte
).c_str());
52 TEST_F(Test_nmea_zte
, set_time_utc
)
55 zte
.set_time_utc(nmea::time
{12, 34, 56});
57 EXPECT_STREQ("$GPZTE,123456,000000,*77", nmea::to_string(zte
).c_str());
60 TEST_F(Test_nmea_zte
, set_time_remaining
)
63 zte
.set_time_remaining(nmea::duration
{12, 34, 56});
65 EXPECT_STREQ("$GPZTE,000000,123456,*77", nmea::to_string(zte
).c_str());
68 TEST_F(Test_nmea_zte
, set_waypoint_id
)
71 zte
.set_waypoint_id(nmea::waypoint
{"POINT1"});
73 EXPECT_STREQ("$GPZTE,000000,000000,POINT1*0D", nmea::to_string(zte
).c_str());