NMEA: make nmeatool available with/without ENABLE_IO
[marnav.git] / test / nmea / Test_nmea_tpr.cpp
blob7f449a917d16b12827061d7e4524b975e0cbe12f
1 #include <marnav/nmea/tpr.hpp>
2 #include "type_traits_helper.hpp"
3 #include <marnav/nmea/nmea.hpp>
4 #include <gtest/gtest.h>
6 namespace
9 using namespace marnav;
11 class Test_nmea_tpr : public ::testing::Test
15 TEST_F(Test_nmea_tpr, contruction)
17 EXPECT_NO_THROW(nmea::tpr tpr);
20 TEST_F(Test_nmea_tpr, properties)
22 nmea_sentence_traits<nmea::tpr>();
25 TEST_F(Test_nmea_tpr, parse)
27 auto s = nmea::make_sentence("$GPTPR,1.0,M,2.0,P,3.0,M*3F");
28 ASSERT_NE(nullptr, s);
30 auto tpr = nmea::sentence_cast<nmea::tpr>(s);
31 ASSERT_NE(nullptr, tpr);
34 TEST_F(Test_nmea_tpr, parse_invalid_number_of_arguments)
36 EXPECT_ANY_THROW(
37 nmea::detail::factory::sentence_parse<nmea::tpr>(nmea::talker::none, {5, "@"}));
38 EXPECT_ANY_THROW(
39 nmea::detail::factory::sentence_parse<nmea::tpr>(nmea::talker::none, {7, "@"}));
42 TEST_F(Test_nmea_tpr, empty_to_string)
44 nmea::tpr tpr;
46 EXPECT_STREQ("$GPTPR,0,M,0,P,0,M*21", nmea::to_string(tpr).c_str());