NMEA: serialization of sentences changed, gains performance by about 7 percent on...
[marnav.git] / test / nmea / Test_nmea_manufacturer.cpp
blob3b21549f7380e8029b4ab031b4207ed32f834a19
1 #include <gtest/gtest.h>
2 #include <marnav/nmea/manufacturer.hpp>
3 #include <marnav/nmea/rmc.hpp>
4 #include <marnav/nmea/pgrme.hpp>
6 namespace
8 using namespace marnav;
10 class Test_nmea_manufacturer : public ::testing::Test
14 TEST_F(Test_nmea_manufacturer, get_manufacturer_id)
16 EXPECT_EQ(nmea::manufacturer_id::UNKNOWN, nmea::get_manufacturer_id("P"));
17 EXPECT_EQ(nmea::manufacturer_id::UNKNOWN, nmea::get_manufacturer_id("Px"));
18 EXPECT_EQ(nmea::manufacturer_id::NMEA, nmea::get_manufacturer_id("Pxx"));
19 EXPECT_EQ(nmea::manufacturer_id::UNKNOWN, nmea::get_manufacturer_id("Pxxx"));
20 EXPECT_EQ(nmea::manufacturer_id::UNKNOWN, nmea::get_manufacturer_id("Pxxx"));
21 EXPECT_EQ(nmea::manufacturer_id::UNKNOWN, nmea::get_manufacturer_id("Pxxxxx"));
22 EXPECT_EQ(nmea::manufacturer_id::NMEA, nmea::get_manufacturer_id("GPRMC"));
23 EXPECT_EQ(nmea::manufacturer_id::GRM, nmea::get_manufacturer_id("PGRME"));
26 TEST_F(Test_nmea_manufacturer, get_manufacturer_tag_from_id)
28 EXPECT_STREQ("", nmea::get_manufacturer_tag(nmea::manufacturer_id::NMEA).c_str());
29 EXPECT_STREQ("", nmea::get_manufacturer_tag(nmea::manufacturer_id::UNKNOWN).c_str());
30 EXPECT_STREQ("GRM", nmea::get_manufacturer_tag(nmea::manufacturer_id::GRM).c_str());
33 TEST_F(Test_nmea_manufacturer, get_manufacturer_name_from_id)
35 EXPECT_STREQ("NMEA", nmea::get_manufacturer_name(nmea::manufacturer_id::NMEA).c_str());
36 EXPECT_STREQ(
37 "UNKNOWN", nmea::get_manufacturer_name(nmea::manufacturer_id::UNKNOWN).c_str());
38 EXPECT_STREQ(
39 "GARMIN CORPORATION", nmea::get_manufacturer_name(nmea::manufacturer_id::GRM).c_str());
42 TEST_F(Test_nmea_manufacturer, get_manufacturer_id_from_sentence)
44 EXPECT_EQ(nmea::manufacturer_id::NMEA, nmea::get_manufacturer_id(nmea::rmc{}));
45 EXPECT_EQ(nmea::manufacturer_id::GRM, nmea::get_manufacturer_id(nmea::pgrme{}));
48 TEST_F(Test_nmea_manufacturer, get_supported_manufacturer_id)
50 const auto m = nmea::get_supported_manufacturer_id();
52 EXPECT_EQ(541u, m.size());
55 TEST_F(Test_nmea_manufacturer, test_manufacturer_tags)
57 for (const auto id : nmea::get_supported_manufacturer_id()) {
58 EXPECT_FALSE(nmea::get_manufacturer_tag(id).empty());
62 TEST_F(Test_nmea_manufacturer, test_manufacturer_names)
64 for (const auto id : nmea::get_supported_manufacturer_id()) {
65 EXPECT_FALSE(nmea::get_manufacturer_name(id).empty());