1 #include <gtest/gtest.h>
2 #include <marnav/nmea/hsc.hpp>
3 #include <marnav/nmea/nmea.hpp>
4 #include "type_traits_helper.hpp"
9 using namespace marnav
;
11 class Test_nmea_hsc
: public ::testing::Test
15 TEST_F(Test_nmea_hsc
, contruction
)
17 EXPECT_NO_THROW(nmea::hsc hsc
);
20 TEST_F(Test_nmea_hsc
, properties
)
22 nmea_sentence_traits
<nmea::hsc
>();
25 TEST_F(Test_nmea_hsc
, parse
)
27 auto s
= nmea::make_sentence("$GPHSC,45.8,T,,*0C");
28 ASSERT_NE(nullptr, s
);
30 auto hsc
= nmea::sentence_cast
<nmea::hsc
>(s
);
31 ASSERT_NE(nullptr, hsc
);
34 TEST_F(Test_nmea_hsc
, parse_invalid_number_of_arguments
)
37 nmea::detail::factory::sentence_parse
<nmea::hsc
>(nmea::talker::none
, {3, "@"}));
39 nmea::detail::factory::sentence_parse
<nmea::hsc
>(nmea::talker::none
, {5, "@"}));
42 TEST_F(Test_nmea_hsc
, empty_to_string
)
46 EXPECT_STREQ("$GPHSC,,,,*4F", nmea::to_string(hsc
).c_str());
49 TEST_F(Test_nmea_hsc
, set_heading_true
)
52 hsc
.set_heading_true(45.8);
54 EXPECT_STREQ("$GPHSC,45.8,T,,*0C", nmea::to_string(hsc
).c_str());
57 TEST_F(Test_nmea_hsc
, set_heading_mag
)
60 hsc
.set_heading_mag(45.8);
62 EXPECT_STREQ("$GPHSC,,,45.8,M*15", nmea::to_string(hsc
).c_str());