Build: update docker build scripts
[marnav.git] / test / nmea / Test_nmea_tpc.cpp
blobd93812a0a1676e8d97aed265f904c83cbc7758eb
1 #include <gtest/gtest.h>
2 #include <marnav/nmea/tpc.hpp>
3 #include <marnav/nmea/nmea.hpp>
4 #include "type_traits_helper.hpp"
6 namespace
9 using namespace marnav;
11 class Test_nmea_tpc : public ::testing::Test
15 TEST_F(Test_nmea_tpc, contruction)
17 EXPECT_NO_THROW(nmea::tpc tpc);
20 TEST_F(Test_nmea_tpc, properties)
22 nmea_sentence_traits<nmea::tpc>();
25 TEST_F(Test_nmea_tpc, parse)
27 auto s = nmea::make_sentence("$GPTPC,1.0,M,2.0,M,3.0,M*33");
28 ASSERT_NE(nullptr, s);
30 auto tpc = nmea::sentence_cast<nmea::tpc>(s);
31 ASSERT_NE(nullptr, tpc);
34 TEST_F(Test_nmea_tpc, parse_invalid_number_of_arguments)
36 EXPECT_ANY_THROW(
37 nmea::detail::factory::sentence_parse<nmea::tpc>(nmea::talker::none, {5, "@"}));
38 EXPECT_ANY_THROW(
39 nmea::detail::factory::sentence_parse<nmea::tpc>(nmea::talker::none, {7, "@"}));
42 TEST_F(Test_nmea_tpc, empty_to_string)
44 nmea::tpc tpc;
46 EXPECT_STREQ("$GPTPC,0,M,0,M,0,M*2D", nmea::to_string(tpc).c_str());