diff --git a/fpsdk_common/src/gnss.cpp b/fpsdk_common/src/gnss.cpp index 051e33e..ef18525 100644 --- a/fpsdk_common/src/gnss.cpp +++ b/fpsdk_common/src/gnss.cpp @@ -350,9 +350,9 @@ const char* Sat::GetStr() const "C01", "C02", "C03", "C04", "C05", "C06", "C07", "C08", "C09", "C10", "C11", "C12", "C13", "C14", "C15", "C16", "C17", "C18", "C19", "C20", "C21", "C22", "C23", "C24", "C25", "C26", "C27", "C28", "C29", "C30", - "C31", "C32", "C33", "C34", "C35", "C36", "C37", "C38", "C30", "C40", - "C41", "C42", "C43", "C44", "C45", "C46", "C47", "C48", "C40", "C50", - "C51", "C52", "C53", "C54", "C55", "C56", "C57", "C58", "C50", "C60", + "C31", "C32", "C33", "C34", "C35", "C36", "C37", "C38", "C39", "C40", + "C41", "C42", "C43", "C44", "C45", "C46", "C47", "C48", "C49", "C50", + "C51", "C52", "C53", "C54", "C55", "C56", "C57", "C58", "C59", "C60", "C61", "C62", "C63" }}; // clang-format on const int ix = (int)svnr - (int)FIRST_BDS; diff --git a/fpsdk_common/test/gnss_test.cpp b/fpsdk_common/test/gnss_test.cpp index 4f28d41..1457993 100644 --- a/fpsdk_common/test/gnss_test.cpp +++ b/fpsdk_common/test/gnss_test.cpp @@ -15,6 +15,8 @@ #include #include #include +#include +#include /* EXTERNAL */ #include @@ -196,6 +198,9 @@ TEST(GnssTest, SatStr) EXPECT_EQ(std::string(Sat(Gnss::BDS, 5).GetStr()), std::string("C05")); EXPECT_EQ(std::string(Sat(Gnss::QZSS, 9).GetStr()), std::string("J09")); EXPECT_EQ(std::string(Sat(Gnss::GLO, 15).GetStr()), std::string("R15")); + EXPECT_EQ(std::string(Sat(Gnss::BDS, 39).GetStr()), std::string("C39")); + EXPECT_EQ(std::string(Sat(Gnss::BDS, 49).GetStr()), std::string("C49")); + EXPECT_EQ(std::string(Sat(Gnss::BDS, 59).GetStr()), std::string("C59")); // Invalid EXPECT_EQ(std::string(Sat(Gnss::GPS, 0).GetStr()), std::string("G??")); @@ -213,6 +218,27 @@ TEST(GnssTest, SatStr) // --------------------------------------------------------------------------------------------------------------------- +TEST(GnssTest, SatStrRoundtrip) +{ + const std::vector>> ranges = { + { Gnss::GPS, { FIRST_GPS, NUM_GPS } }, + { Gnss::SBAS, { FIRST_SBAS, NUM_SBAS } }, + { Gnss::GAL, { FIRST_GAL, NUM_GAL } }, + { Gnss::BDS, { FIRST_BDS, NUM_BDS } }, + { Gnss::QZSS, { FIRST_QZSS, NUM_QZSS } }, + { Gnss::GLO, { FIRST_GLO, NUM_GLO } }, + { Gnss::NAVIC, { FIRST_NAVIC, NUM_NAVIC } }, + }; + for (const auto& range : ranges) { + for (int n = range.second.first; n < (range.second.first + range.second.second); n++) { + const Sat sat(range.first, (SvNr)n); + EXPECT_EQ(Sat(sat.GetStr()), sat) << sat.GetStr() << " is not " << GnssStr(range.first) << " " << n; + } + } +} + +// --------------------------------------------------------------------------------------------------------------------- + TEST(GnssTest, StrSat) { // clang-format off