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

Function testFilter

test/unit/filters/HeadTailFilterTest.cpp:47–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46
47void testFilter(bool head, bool invert)
48{
49 BOX3D srcBounds(0.0, 0.0, 1.0, 0.0, 0.0, 10.0);
50
51 Options ops;
52 ops.add("bounds", srcBounds);
53 ops.add("mode", "ramp");
54 ops.add("count", 10);
55
56 FauxReader reader;
57 reader.setOptions(ops);
58
59 Options ops2;
60 ops2.add("count", 4);
61 ops2.add("invert", invert);
62
63 StageFactory fac;
64 Stage& f = *(fac.createStage(head ? "filters.head" : "filters.tail"));
65 f.setOptions(ops2);
66 f.setInput(reader);
67
68 PointTable t;
69 f.prepare(t);
70 PointViewSet s = f.execute(t);
71 PointViewPtr v = *s.begin();
72 EXPECT_EQ(v->size(), invert ? 6u : 4u);
73
74 int min { 0 };
75 if (head)
76 min = invert ? 5 : 1;
77 else
78 min = invert ? 1 : 7;
79
80 for (PointId i = 0; i < v->size(); ++i)
81 {
82 int z = v->getFieldAs<int>(Dimension::Id::Z, i);
83 EXPECT_EQ(z, min);
84 min++;
85 }
86
87}
88
89TEST(HeadTailFilterTest, t1)
90{

Callers 1

TESTFunction · 0.85

Calls 7

setOptionsMethod · 0.80
createStageMethod · 0.80
addMethod · 0.45
prepareMethod · 0.45
executeMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected