1 #include <marnav/nmea/zda.hpp>
2 #include "type_traits_helper.hpp"
3 #include <marnav/nmea/nmea.hpp>
4 #include <gtest/gtest.h>
9 using namespace marnav
;
11 class Test_nmea_zda
: public ::testing::Test
15 TEST_F(Test_nmea_zda
, contruction
)
17 EXPECT_NO_THROW(nmea::zda zda
);
20 TEST_F(Test_nmea_zda
, properties
)
22 nmea_sentence_traits
<nmea::zda
>();
25 TEST_F(Test_nmea_zda
, parse
)
27 auto s
= nmea::make_sentence("$GPZDA,160012.71,11,03,2004,-1,00*7D");
28 ASSERT_NE(nullptr, s
);
30 auto zda
= nmea::sentence_cast
<nmea::zda
>(s
);
31 ASSERT_NE(nullptr, zda
);
34 TEST_F(Test_nmea_zda
, parse_invalid_number_of_arguments
)
37 nmea::detail::factory::sentence_parse
<nmea::zda
>(nmea::talker::none
, {5, "@"}));
39 nmea::detail::factory::sentence_parse
<nmea::zda
>(nmea::talker::none
, {7, "@"}));
42 TEST_F(Test_nmea_zda
, empty_to_string
)
46 EXPECT_STREQ("$GPZDA,,,,,,*48", nmea::to_string(zda
).c_str());
49 TEST_F(Test_nmea_zda
, set_time_utc
)
52 zda
.set_time_utc(nmea::time
{1, 2, 3});
54 EXPECT_STREQ("$GPZDA,010203,,,,,*48", nmea::to_string(zda
).c_str());
57 TEST_F(Test_nmea_zda
, set_date
)
60 zda
.set_date(nmea::date
{2015, nmea::month::june
, 28});
62 EXPECT_STREQ("$GPZDA,,28,06,2015,,*42", nmea::to_string(zda
).c_str());
65 TEST_F(Test_nmea_zda
, set_local_zone
)
68 zda
.set_local_zone(10, 0);
70 EXPECT_STREQ("$GPZDA,,,,,10,00*49", nmea::to_string(zda
).c_str());