Build: update docker build scripts
[marnav.git] / test / nmea / Test_nmea_zfo.cpp
blob92c0788622f6a9a701c412960e9e362fb5198547
1 #include <gtest/gtest.h>
2 #include <marnav/nmea/zfo.hpp>
3 #include <marnav/nmea/nmea.hpp>
4 #include "type_traits_helper.hpp"
6 namespace
9 using namespace marnav;
11 class Test_nmea_zfo : public ::testing::Test
15 TEST_F(Test_nmea_zfo, contruction)
17 EXPECT_NO_THROW(nmea::zfo zfo);
20 TEST_F(Test_nmea_zfo, properties)
22 nmea_sentence_traits<nmea::zfo>();
25 TEST_F(Test_nmea_zfo, parse)
27 auto s = nmea::make_sentence("$GPZFO,123456.1,000010,POINT1*0C");
28 ASSERT_NE(nullptr, s);
30 auto zfo = nmea::sentence_cast<nmea::zfo>(s);
31 ASSERT_NE(nullptr, zfo);
34 TEST_F(Test_nmea_zfo, parse_invalid_number_of_arguments)
36 EXPECT_ANY_THROW(
37 nmea::detail::factory::sentence_parse<nmea::zfo>(nmea::talker::none, {2, "@"}));
38 EXPECT_ANY_THROW(
39 nmea::detail::factory::sentence_parse<nmea::zfo>(nmea::talker::none, {4, "@"}));
42 TEST_F(Test_nmea_zfo, empty_to_string)
44 nmea::zfo zfo;
46 EXPECT_STREQ("$GPZFO,,,*68", nmea::to_string(zfo).c_str());
49 TEST_F(Test_nmea_zfo, set_time_utc)
51 nmea::zfo zfo;
52 zfo.set_time_utc(nmea::time{12, 34, 56});
54 EXPECT_STREQ("$GPZFO,123456,,*6F", nmea::to_string(zfo).c_str());
57 TEST_F(Test_nmea_zfo, set_time_elapsed)
59 nmea::zfo zfo;
60 zfo.set_time_elapsed(nmea::duration{12, 34, 56});
62 EXPECT_STREQ("$GPZFO,,123456,*6F", nmea::to_string(zfo).c_str());
65 TEST_F(Test_nmea_zfo, set_waypoint_id)
67 nmea::zfo zfo;
68 zfo.set_waypoint_id(nmea::waypoint{"POINT1"});
70 EXPECT_STREQ("$GPZFO,,,POINT1*15", nmea::to_string(zfo).c_str());