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

Function TEST

test/unit/filters/HAGFilterTest.cpp:47–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45{
46
47TEST(HAGFilterTest, delaunay)
48{
49 Options ro;
50 ro.add("filename", Support::datapath("filters/hagtest.txt"));
51
52 StageFactory factory;
53 Stage& r = *(factory.createStage("readers.text"));
54 r.setOptions(ro);
55
56 Options fo;
57 fo.add("count", 10);
58 Stage& f = *(factory.createStage("filters.hag_delaunay"));
59 f.setInput(r);
60 f.setOptions(fo);
61
62 PointTable t1;
63 f.prepare(t1);
64 PointViewSet s = f.execute(t1);
65 PointViewPtr v = *s.begin();
66
67 for (PointId i = 0; i < v->size(); ++i)
68 {
69 double x = v->getFieldAs<double>(Dimension::Id::X, i);
70 double y = v->getFieldAs<double>(Dimension::Id::Y, i);
71 double z = v->getFieldAs<double>(Dimension::Id::Z, i);
72 double hag = v->getFieldAs<double>(Dimension::Id::HeightAboveGround, i);
73 uint8_t c = v->getFieldAs<uint8_t>(Dimension::Id::Classification, i);
74 if (c == ClassLabel::Ground)
75 EXPECT_EQ(hag, 0);
76 auto check = [&x, &y, &z, &hag](double xv, double yv, double zv,
77 double hagv)
78 {
79 EXPECT_EQ(x, xv) << "Bad X Value";
80 EXPECT_EQ(y, yv) << "Bad Y Value";
81 EXPECT_EQ(z, zv) << "Bad Z Value";
82 EXPECT_EQ(hag, hagv) << "Bad HAG Value";
83 };
84
85 if (i == 0)
86 check (-2, 4, 20, 10);
87 if (i == 1)
88 check(4, 1, 20, 11);
89 if (i == 2)
90 check(2, 3, 20, 14);
91 if (i == 3)
92 check(4, 4, 20, 16);
93 }
94}
95
96TEST(HAGFilterTest, neighbors)
97{

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected