1 #include <marnav/nmea/gns.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_gns
: public ::testing::Test
15 TEST_F(Test_nmea_gns
, contruction
)
17 EXPECT_NO_THROW(nmea::gns gns
);
20 TEST_F(Test_nmea_gns
, properties
)
22 nmea_sentence_traits
<nmea::gns
>();
25 TEST_F(Test_nmea_gns
, parse
)
27 auto s
= nmea::make_sentence(
28 "$GNGNS,122310.0,3722.42567,N,12258.856215,W,AA,15,0.9,1005.54,6.5,,*75");
29 ASSERT_NE(nullptr, s
);
31 auto gns
= nmea::sentence_cast
<nmea::gns
>(s
);
32 ASSERT_NE(nullptr, gns
);
35 TEST_F(Test_nmea_gns
, parse_invalid_number_of_arguments
)
38 nmea::detail::factory::sentence_parse
<nmea::gns
>(nmea::talker::none
, {11, "@"}));
40 nmea::detail::factory::sentence_parse
<nmea::gns
>(nmea::talker::none
, {13, "@"}));
43 TEST_F(Test_nmea_gns
, empty_to_string
)
47 EXPECT_STREQ("$GPGNS,,,,,,AA,,,,,,*4D", nmea::to_string(gns
).c_str());
50 TEST_F(Test_nmea_gns
, set_lat
)
53 gns
.set_lat(geo::latitude
{12.34});
55 EXPECT_STREQ("$GPGNS,,1220.4000,N,,,AA,,,,,,*28", nmea::to_string(gns
).c_str());
58 TEST_F(Test_nmea_gns
, set_lon_west
)
61 gns
.set_lon(geo::longitude
{-123.45});
63 EXPECT_STREQ("$GPGNS,,,,12327.0000,W,AA,,,,,,*01", nmea::to_string(gns
).c_str());
66 TEST_F(Test_nmea_gns
, set_lon_east
)
69 gns
.set_lon(geo::longitude
{123.45});
71 EXPECT_STREQ("$GPGNS,,,,12327.0000,E,AA,,,,,,*13", nmea::to_string(gns
).c_str());
74 TEST_F(Test_nmea_gns
, set_mode_indicator
)
77 gns
.set_mode_indicator("DD");
79 EXPECT_STREQ("$GPGNS,,,,,,DD,,,,,,*4D", nmea::to_string(gns
).c_str());