首次提交

This commit is contained in:
2026-06-16 11:04:03 +08:00
commit 43012077ca
89 changed files with 25570 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
#ifdef _USE_GTEST
#ifndef TEST_BDS_INFERENCE_H
#define TEST_BDS_INFERENCE_H
#include "global.h"
class BdsTest : public ::testing::Test {
protected:
void SetUp() override {
// Any necessary setup can go here
}
};
TEST_F(BdsTest, TestBdsInfer) {
EXPECT_EQ(infer(hex2bin("8D406B902015A678D4D220AA4BDA")), "BDS08");
EXPECT_EQ(infer(hex2bin("8FC8200A3AB8F5F893096B000000")), "BDS06");
EXPECT_EQ(infer(hex2bin("8D40058B58C901375147EFD09357")), "BDS05");
EXPECT_EQ(infer(hex2bin("8D485020994409940838175B284F")), "BDS09");
EXPECT_EQ(infer(hex2bin("A800178D10010080F50000D5893C")), "BDS10");
EXPECT_EQ(infer(hex2bin("A0000638FA81C10000000081A92F")), "BDS17");
EXPECT_EQ(infer(hex2bin("A0001838201584F23468207CDFA5")), "BDS20");
EXPECT_EQ(infer(hex2bin("A0001839CA3800315800007448D9")), "BDS40");
EXPECT_EQ(infer(hex2bin("A000139381951536E024D4CCF6B5")), "BDS50");
EXPECT_EQ(infer(hex2bin("A00004128F39F91A7E27C46ADC21")), "BDS60");
// std::cout << infer("A0001838201584F23468207CDFA5").value();
}
TEST_F(BdsTest, TestBdsIs50Or60) {
auto result = is50or60(hex2bin("A0001838201584F23468207CDFA5"), 0, 0, 0);
EXPECT_EQ(result, ""); // Check if the optional is empty
EXPECT_EQ(is50or60(hex2bin("A8001EBCFFFB23286004A73F6A5B"), 320, 250, 14000), "BDS50");
EXPECT_EQ(is50or60(hex2bin("A8001EBCFE1B29287FDCA807BCFC"), 320, 250, 14000), "BDS50");
}
TEST_F(BdsTest, TestSurfacePosition) {
std::string msg0 = hex2bin("8FE48C033A9FA184B934E744C6FD");
std::string msg1 = hex2bin("8FE48C033A9FA68F7C3D39B1C2F0");
unsigned long long t0 = 1565608663102;
unsigned long long t1 = 1565608666214;
float lat_ref = -23.4265448;
float lon_ref = -46.4816258;
CPR::Position pos_ref(lat_ref, lon_ref);
// auto pos2 = CPR::surface_position(msg0, msg1, t0, t0, pos_ref).value();
auto pos = CPR::surface_position_with_ref(msg0, lat_ref, lon_ref, t0, t0).value();
// 为什么差那么 多
//std::cout << lat << " " << lon << std::endl;
EXPECT_LT(std::abs(lon_ref - pos.lon), 0.05);
}
#endif
#endif