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

Function TEST

test/unit/filters/VoxelCenterNearestNeighborFilterTest.cpp:44–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42{
43
44TEST(VoxelCenterNearestNeighborFilterTest, center)
45{
46 StageFactory fac;
47
48 Stage *reader = fac.createStage("readers.las");
49 Options ro;
50 ro.add("filename", Support::datapath("las/autzen_trim.las"));
51 reader->setOptions(ro);
52
53 Stage *filter = fac.createStage("filters.voxelcenternearestneighbor");
54 Options fo;
55 fo.add("cell", 10);
56 filter->setOptions(fo);
57 filter->setInput(*reader);
58
59 PointTable t;
60 filter->prepare(t);
61 PointViewSet set = filter->execute(t);
62 EXPECT_EQ(set.size(), 1U);
63 PointViewPtr v = *set.begin();
64 EXPECT_EQ(v->size(), 7820U);
65
66 // This is just a poor man's checksum. If the algorithm gets changed in
67 // a way that actually SHOULD change the output, this test will break.
68 PointId sums[] = { 39811016, 35546903, 38699916, 43843400, 51999906,
69 69590553, 75163027, 50946932 };
70 PointId sum;
71 PointId id;
72 size_t iter = 0;
73 for (id = 0; id < v->size(); ++id)
74 {
75 if (id % 1000 == 0)
76 {
77 if (id)
78 EXPECT_EQ(sums[iter++], sum);
79 sum = 0;
80 }
81 sum += v->index(id);
82 }
83 EXPECT_EQ(sums[iter], sum);
84}
85
86TEST(VoxelCenterNearestNeighborFilterTest, center_value)
87{

Callers

nothing calls this directly

Calls 9

datapathFunction · 0.85
createStageMethod · 0.80
setOptionsMethod · 0.80
addMethod · 0.45
prepareMethod · 0.45
executeMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected