22 lines
683 B
C++
22 lines
683 B
C++
#include "io/gpr/GprGeometry.hpp"
|
|
#include "io/gpr/IprHeader.hpp"
|
|
#include <gtest/gtest.h>
|
|
using namespace geopro::io::gpr;
|
|
|
|
TEST(GprGeometry, ParsesActiveChannelOffsets) {
|
|
const std::string ord = "0 -0.686000 -1.5 1\n1 -0.581000 -1.5 1\n14 0 -1.5 0\n";
|
|
auto xs = parseChannelXOffsets(ord);
|
|
ASSERT_EQ(xs.size(), 2u); // 仅 2 个有效(末列=1)
|
|
EXPECT_NEAR(xs[0], -0.686, 1e-6);
|
|
EXPECT_NEAR(xs[1], -0.581, 1e-6);
|
|
}
|
|
|
|
TEST(GprGeometry, DepthOfLastSampleMatchesPhysics) {
|
|
IprHeader h{};
|
|
h.samples = 821;
|
|
h.timeWindowNs = 160.352;
|
|
h.soilVelocity = 1e8; // m/s
|
|
EXPECT_NEAR(depthOfSample(820, h), 8.0, 0.05); // ~8m
|
|
EXPECT_NEAR(depthOfSample(0, h), 0.0, 1e-9);
|
|
}
|