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

Function TEST

test/unit/filters/AssignFilterTest.cpp:44–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42using namespace pdal;
43
44TEST(AssignFilterTest, value)
45{
46 Options ro;
47 ro.add("filename", Support::datapath("autzen/autzen-dd.las"));
48
49 StageFactory factory;
50 Stage& r = *(factory.createStage("readers.las"));
51 r.setOptions(ro);
52
53 Options fo;
54 /**
55 fo.add("assignment", "X[:]=27.5");
56 fo.add("assignment", "Classification[:]=0");
57 fo.add("assignment", "GpsTime[:]=3000");
58 fo.add("assignment", "Red[:]=255");
59 **/
60 fo.add("value", "X = 27.5");
61 fo.add("value", "Classification = 0");
62 fo.add("value", "GpsTime = 3000");
63 fo.add("value", "Red = 255");
64
65 Stage& f = *(factory.createStage("filters.assign"));
66 f.setInput(r);
67 f.setOptions(fo);
68
69 std::string tempfile(Support::temppath("out.las"));
70
71 Options wo;
72 wo.add("filename", tempfile);
73 Stage& w = *(factory.createStage("writers.las"));
74 w.setInput(f);
75 w.setOptions(wo);
76
77 FileUtils::deleteFile(tempfile);
78 PointTable t1;
79 w.prepare(t1);
80 w.execute(t1);
81
82 Options testOptions;
83 testOptions.add("filename", tempfile);
84
85 Stage& test = *(factory.createStage("readers.las"));
86 test.setOptions(testOptions);
87
88 PointTable t2;
89 test.prepare(t2);
90 PointViewSet s = test.execute(t2);
91 PointViewPtr v = *s.begin();
92 for (PointId i = 0; i < v->size(); ++i)
93 {
94 EXPECT_DOUBLE_EQ(v->getFieldAs<double>(Dimension::Id::X, i), 27.5);
95 EXPECT_EQ(v->getFieldAs<uint8_t>(
96 Dimension::Id::Classification, i), ClassLabel::CreatedNeverClassified);
97 EXPECT_DOUBLE_EQ(v->getFieldAs<double>(
98 Dimension::Id::GpsTime, i), 3000.0);
99 EXPECT_EQ(v->getFieldAs<int>(
100 Dimension::Id::Red, i), 255);
101 }

Callers

nothing calls this directly

Calls 12

datapathFunction · 0.85
temppathFunction · 0.85
deleteFileFunction · 0.85
createStageMethod · 0.80
setOptionsMethod · 0.80
addMethod · 0.45
prepareMethod · 0.45
executeMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
findDimMethod · 0.45
dimTypeMethod · 0.45

Tested by

no test coverage detected