MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / TEST

Function TEST

pj_scene3D/tests/pointcloud_codecs_test.cpp:125–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123} // namespace
124
125TEST(PointcloudCodecs, DecodeCloudiniRoundTrip) {
126 const auto pts = makePoints(16);
127 const auto cloud = wrap(encodeCloudini(pts), "cloudini", "lidar_link", 123456789);
128
129 const auto result = pj::scene3d::decodeCloudini(cloud);
130 ASSERT_TRUE(result.has_value()) << result.error();
131 const auto& pc = result.value();
132
133 EXPECT_EQ(pc.width, 16u);
134 EXPECT_EQ(pc.height, 1u);
135 EXPECT_EQ(pc.frame_id, "lidar_link");
136 EXPECT_EQ(pc.timestamp_ns, 123456789);
137 ASSERT_EQ(pc.fields.size(), 4u);
138 ASSERT_GE(pc.data.size(), static_cast<size_t>(pc.width) * pc.point_step);
139
140 const PointField* fx = findField(pc, "x");
141 const PointField* fz = findField(pc, "z");
142 const PointField* fi = findField(pc, "intensity");
143 ASSERT_NE(fx, nullptr);
144 ASSERT_NE(fz, nullptr);
145 ASSERT_NE(fi, nullptr);
146 for (int i = 0; i < 16; ++i) {
147 EXPECT_FLOAT_EQ(readFloat(pc, i, *fx), static_cast<float>(i) * 0.1f);
148 EXPECT_FLOAT_EQ(readFloat(pc, i, *fz), static_cast<float>(i) * 0.3f);
149 EXPECT_FLOAT_EQ(readFloat(pc, i, *fi), static_cast<float>(i));
150 }
151}
152
153TEST(PointcloudCodecs, DecodeDracoRoundTrip) {
154 const auto pts = makePoints(16);

Callers

nothing calls this directly

Calls 15

makePointsFunction · 0.85
wrapFunction · 0.85
encodeCloudiniFunction · 0.85
decodeCloudiniFunction · 0.85
readFloatFunction · 0.85
encodeDracoFunction · 0.85
decodeDracoFunction · 0.85
encodeMethod · 0.80
findFieldFunction · 0.70
valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected