Build: update docker build scripts
[marnav.git] / test / nmea / Test_nmea_gll.cpp
blob77905f3e6d7b8c60e31ab0f62f68e7efcff623e2
1 #include <gtest/gtest.h>
2 #include <marnav/nmea/gll.hpp>
3 #include <marnav/nmea/nmea.hpp>
4 #include "type_traits_helper.hpp"
6 namespace
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)
36 EXPECT_ANY_THROW(
37 nmea::detail::factory::sentence_parse<nmea::gll>(nmea::talker::none, {5, "@"}));
38 EXPECT_ANY_THROW(
39 nmea::detail::factory::sentence_parse<nmea::gll>(nmea::talker::none, {8, "@"}));
42 TEST_F(Test_nmea_gll, empty_to_string)
44 nmea::gll gll;
46 EXPECT_STREQ("$GPGLL,,,,,,,V*2A", nmea::to_string(gll).c_str());
49 TEST_F(Test_nmea_gll, set_lat_north)
51 nmea::gll gll;
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)
59 nmea::gll gll;
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)
67 nmea::gll gll;
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)
75 nmea::gll gll;
76 gll.set_lon(geo::longitude{123.45});
78 EXPECT_STREQ("$GPGLL,,,12327.0000,E,,,V*74", nmea::to_string(gll).c_str());