Merge pull request #1284 from Project-OSRM/algo-test-fix
Fix DP unit test
This commit is contained in:
commit
2734a4aee4
@ -100,7 +100,7 @@ void DouglasPeucker::Run(RandomAccessIt begin, RandomAccessIt end, const unsigne
|
|||||||
std::prev(end)->necessary = true;
|
std::prev(end)->necessary = true;
|
||||||
|
|
||||||
{
|
{
|
||||||
BOOST_ASSERT_MSG(zoom_level < 19, "unsupported zoom level");
|
BOOST_ASSERT_MSG(zoom_level < DOUGLAS_PEUCKER_THRESHOLDS.size(), "unsupported zoom level");
|
||||||
RandomAccessIt left_border = begin;
|
RandomAccessIt left_border = begin;
|
||||||
RandomAccessIt right_border = std::next(begin);
|
RandomAccessIt right_border = std::next(begin);
|
||||||
// Sweep over array and identify those ranges that need to be checked
|
// Sweep over array and identify those ranges that need to be checked
|
||||||
|
@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(all_necessary_test)
|
|||||||
getTestInfo(5, 15, true)
|
getTestInfo(5, 15, true)
|
||||||
};
|
};
|
||||||
DouglasPeucker dp;
|
DouglasPeucker dp;
|
||||||
for (unsigned z = 0; z < 20; z++)
|
for (unsigned z = 0; z < DOUGLAS_PEUCKER_THRESHOLDS.size(); z++)
|
||||||
{
|
{
|
||||||
dp.Run(info, z);
|
dp.Run(info, z);
|
||||||
for (const auto& i : info)
|
for (const auto& i : info)
|
||||||
@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(all_necessary_test)
|
|||||||
BOOST_AUTO_TEST_CASE(remove_second_node_test)
|
BOOST_AUTO_TEST_CASE(remove_second_node_test)
|
||||||
{
|
{
|
||||||
DouglasPeucker dp;
|
DouglasPeucker dp;
|
||||||
for (unsigned z = 0; z < 19; z++)
|
for (unsigned z = 0; z < DOUGLAS_PEUCKER_THRESHOLDS.size(); z++)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* x--x
|
* x--x
|
||||||
@ -68,9 +68,8 @@ BOOST_AUTO_TEST_CASE(remove_second_node_test)
|
|||||||
getTestInfo(5 * COORDINATE_PRECISION + DOUGLAS_PEUCKER_THRESHOLDS[z],
|
getTestInfo(5 * COORDINATE_PRECISION + DOUGLAS_PEUCKER_THRESHOLDS[z],
|
||||||
15 * COORDINATE_PRECISION, true),
|
15 * COORDINATE_PRECISION, true),
|
||||||
};
|
};
|
||||||
std::cout << "Threshold: " << DOUGLAS_PEUCKER_THRESHOLDS[z] << std::endl;
|
BOOST_TEST_MESSAGE("Threshold (" << z << "): " << DOUGLAS_PEUCKER_THRESHOLDS[z]);
|
||||||
dp.Run(info, z);
|
dp.Run(info, z);
|
||||||
std::cout << "z: " << z << std::endl;
|
|
||||||
BOOST_CHECK_EQUAL(info[0].necessary, true);
|
BOOST_CHECK_EQUAL(info[0].necessary, true);
|
||||||
BOOST_CHECK_EQUAL(info[1].necessary, false);
|
BOOST_CHECK_EQUAL(info[1].necessary, false);
|
||||||
BOOST_CHECK_EQUAL(info[2].necessary, true);
|
BOOST_CHECK_EQUAL(info[2].necessary, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user