1 #include <gtest/gtest.h>
2 #include <marnav/nmea/gll.hpp>
3 #include <marnav/nmea/nmea.hpp>
4 #include "type_traits_helper.hpp"
9 using namespace marnav
;
11 class Test_nmea_gll
: public ::testing::Test
15 TEST_F(Test_nmea_gll
, contruction
)
17 EXPECT_NO_THROW(nmea::gll gll
);
20 TEST_F(Test_nmea_gll
, properties
)
22 nmea_sentence_traits
<nmea::gll
>();
25 TEST_F(Test_nmea_gll
, parse
)
27 auto s
= nmea::make_sentence("$GPGLL,,,,,,*50");
28 ASSERT_NE(nullptr, s
);
30 auto gll
= nmea::sentence_cast
<nmea::gll
>(s
);
31 ASSERT_NE(nullptr, gll
);
34 TEST_F(Test_nmea_gll
, parse_invalid_number_of_arguments
)
37 nmea::detail::factory::sentence_parse
<nmea::gll
>(nmea::talker_id::none
, {5, "@"}));
39 nmea::detail::factory::sentence_parse
<nmea::gll
>(nmea::talker_id::none
, {8, "@"}));
42 TEST_F(Test_nmea_gll
, empty_to_string
)
46 EXPECT_STREQ("$GPGLL,,,,,,,V*2A", nmea::to_string(gll
).c_str());
49 TEST_F(Test_nmea_gll
, set_lat_north
)
52 gll
.set_lat(geo::latitude
{12.345});
54 EXPECT_STREQ("$GPGLL,1220.7000,N,,,,,V*4C", nmea::to_string(gll
).c_str());
57 TEST_F(Test_nmea_gll
, set_lat_south
)
60 gll
.set_lat(geo::latitude
{-12.345});
62 EXPECT_STREQ("$GPGLL,1220.7000,S,,,,,V*51", nmea::to_string(gll
).c_str());
65 TEST_F(Test_nmea_gll
, set_lon_west
)
68 gll
.set_lon(geo::longitude
{-123.45});
70 EXPECT_STREQ("$GPGLL,,,12327.0000,W,,,V*66", nmea::to_string(gll
).c_str());
73 TEST_F(Test_nmea_gll
, set_lon_east
)
76 gll
.set_lon(geo::longitude
{123.45});
78 EXPECT_STREQ("$GPGLL,,,12327.0000,E,,,V*74", nmea::to_string(gll
).c_str());