Build: update docker build scripts
[marnav.git] / test / nmea / Test_nmea_sfi.cpp
blob29380c08a83090d9205622d848fd09e816305c23
1 #include <gtest/gtest.h>
2 #include <marnav/nmea/sfi.hpp>
3 #include <marnav/nmea/nmea.hpp>
4 #include "type_traits_helper.hpp"
6 namespace
9 using namespace marnav;
11 class Test_nmea_sfi : public ::testing::Test
15 TEST_F(Test_nmea_sfi, contruction)
17 EXPECT_NO_THROW(nmea::sfi sfi);
20 TEST_F(Test_nmea_sfi, properties)
22 nmea_sentence_traits<nmea::sfi>();
25 TEST_F(Test_nmea_sfi, parse)
27 auto s = nmea::make_sentence("$GPSFI,1,1,156025,M*03");
28 ASSERT_NE(nullptr, s);
30 auto sfi = nmea::sentence_cast<nmea::sfi>(s);
31 ASSERT_NE(nullptr, sfi);
34 TEST_F(Test_nmea_sfi, parse_invalid_number_of_arguments)
36 EXPECT_ANY_THROW(
37 nmea::detail::factory::sentence_parse<nmea::sfi>(nmea::talker::none, {1, "@"}));
38 EXPECT_ANY_THROW(
39 nmea::detail::factory::sentence_parse<nmea::sfi>(nmea::talker::none, {3, "@"}));
40 EXPECT_ANY_THROW(
41 nmea::detail::factory::sentence_parse<nmea::sfi>(nmea::talker::none, {23, "@"}));
42 EXPECT_ANY_THROW(
43 nmea::detail::factory::sentence_parse<nmea::sfi>(nmea::talker::none, {24, "@"}));
46 TEST_F(Test_nmea_sfi, empty_to_string)
48 nmea::sfi sfi;
50 EXPECT_STREQ("$GPSFI,0,0*4B", nmea::to_string(sfi).c_str());