Skip to content

Commit

Permalink
get create option for filters.selector working properly, with test
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Sep 10, 2012
1 parent 3f009da commit c0f4a16
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/filters/Selector.cpp
Expand Up @@ -147,7 +147,7 @@ void Selector::checkImpedance()
size = ops.getValueOrDefault<boost::uint32_t>("size", 1);

description = ops.getValueOrDefault<std::string>("description", "");
interpretation = ops.getValueOrThrow<std::string>("interpretation");
interpretation = ops.getValueOrDefault<std::string>("interpretation", "int32_t");

std::string endy = ops.getValueOrDefault<std::string>("endianness", "little");
if (boost::iequals(endy, "big"))
Expand Down
2 changes: 1 addition & 1 deletion test/data/pipeline/pipeline_selector.xml
Expand Up @@ -53,7 +53,7 @@
<Option name="offset">
10.6
</Option>
</Options
</Options>
</Option>
</Options>
</Option>
Expand Down
22 changes: 16 additions & 6 deletions test/unit/filters/SelectorFilterTest.cpp
Expand Up @@ -64,18 +64,28 @@ BOOST_AUTO_TEST_CASE(test1)
BOOST_CHECK_EQUAL(numRead, 1000u);
}

// pdal::Schema const& new_schema = data.getSchema();

// FIXME: not done yet
// BOOST_CHECK_THROW(new_schema.getDimension("Red"), pdal::dimension_not_found);
// BOOST_CHECK_THROW(new_schema.getDimension("Green"), pdal::dimension_not_found);
// BOOST_CHECK_THROW(new_schema.getDimension("Blue"), pdal::dimension_not_found);

pdal::Schema const& new_schema = data.getSchema();

// std::cout << new_schema << std::endl;

BOOST_CHECK_EQUAL(new_schema.getDimension("Red").isIgnored(), true);
BOOST_CHECK_EQUAL(new_schema.getDimension("Green").isIgnored(), true);
BOOST_CHECK_EQUAL(new_schema.getDimension("Blue").isIgnored(), true);

// ignore by default is true because not set on the pipeline
BOOST_CHECK_EQUAL(new_schema.getDimension("PointSourceId").isIgnored(), true);

// We explicitly kept X
BOOST_CHECK_EQUAL(new_schema.getDimension("X").isIgnored(), false);

// We created Greenish
BOOST_CHECK_EQUAL(new_schema.getDimension("Greenish").isIgnored(), false);

return;
}




BOOST_AUTO_TEST_SUITE_END()

0 comments on commit c0f4a16

Please sign in to comment.