Build: update docker build scripts
[marnav.git] / test / nmea / Test_nmea_hsc.cpp
blob8db8ffa225dda63e9c49edbfa54c4835c40d74e0
1 #include <gtest/gtest.h>
2 #include <marnav/nmea/hsc.hpp>
3 #include <marnav/nmea/nmea.hpp>
4 #include "type_traits_helper.hpp"
6 namespace
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)
36 EXPECT_ANY_THROW(
37 nmea::detail::factory::sentence_parse<nmea::hsc>(nmea::talker::none, {3, "@"}));
38 EXPECT_ANY_THROW(
39 nmea::detail::factory::sentence_parse<nmea::hsc>(nmea::talker::none, {5, "@"}));
42 TEST_F(Test_nmea_hsc, empty_to_string)
44 nmea::hsc hsc;
46 EXPECT_STREQ("$GPHSC,,,,*4F", nmea::to_string(hsc).c_str());
49 TEST_F(Test_nmea_hsc, set_heading_true)
51 nmea::hsc hsc;
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)
59 nmea::hsc hsc;
60 hsc.set_heading_mag(45.8);
62 EXPECT_STREQ("$GPHSC,,,45.8,M*15", nmea::to_string(hsc).c_str());