NMEA: make nmeatool available with/without ENABLE_IO
[marnav.git] / test / nmea / Test_nmea_gst.cpp
blobd5a88374db75cc8e878aac158f86e5a11a7a2cd5
1 #include <marnav/nmea/gst.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_gst : public ::testing::Test
15 TEST_F(Test_nmea_gst, contruction)
17 EXPECT_NO_THROW(nmea::gst gst);
20 TEST_F(Test_nmea_gst, properties)
22 nmea_sentence_traits<nmea::gst>();
25 TEST_F(Test_nmea_gst, parse)
27 auto s = nmea::make_sentence("$GPGST,123456.34,1.0,2.1,3.2,4.3,5.4,6.5,7.6*50");
28 ASSERT_NE(nullptr, s);
30 auto gst = nmea::sentence_cast<nmea::gst>(s);
31 ASSERT_NE(nullptr, gst);
34 TEST_F(Test_nmea_gst, parse_invalid_number_of_arguments)
36 EXPECT_ANY_THROW(
37 nmea::detail::factory::sentence_parse<nmea::gst>(nmea::talker::none, {7, "@"}));
38 EXPECT_ANY_THROW(
39 nmea::detail::factory::sentence_parse<nmea::gst>(nmea::talker::none, {9, "@"}));
42 TEST_F(Test_nmea_gst, empty_to_string)
44 nmea::gst gst;
46 EXPECT_STREQ("$GPGST,000000.00,0,0,0,0,0,0,0*49", nmea::to_string(gst).c_str());