This removed mpl headers from the code base, where not needed. This mostly affects unit tests, where mpl's type list is actually only used once to automatically generate tests for multiple types (see ref). In addition, this commit also fixes the includes in the touched headers. Resulting in 1/ reduces build times and 2/ proper includes. Reference: - http://www.boost.org/doc/libs/1_59_0/libs/test/doc/html/boost_test/tests_organization/test_cases/test_organization_templates.html#ref_BOOST_AUTO_TEST_CASE_TEMPLATE
94 lines
3.0 KiB
C++
94 lines
3.0 KiB
C++
/*
|
|
|
|
Copyright (c) 2014, Project OSRM contributors
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
are permitted provided that the following conditions are met:
|
|
|
|
Redistributions of source code must retain the above copyright notice, this list
|
|
of conditions and the following disclaimer.
|
|
Redistributions in binary form must reproduce the above copyright notice, this
|
|
list of conditions and the following disclaimer in the documentation and/or
|
|
other materials provided with the distribution.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
#include "../../data_structures/dynamic_graph.hpp"
|
|
#include "../../typedefs.h"
|
|
|
|
#include <boost/test/unit_test.hpp>
|
|
#include <boost/test/test_case_template.hpp>
|
|
|
|
#include <vector>
|
|
|
|
BOOST_AUTO_TEST_SUITE(dynamic_graph)
|
|
|
|
struct TestData
|
|
{
|
|
EdgeID id;
|
|
};
|
|
|
|
typedef DynamicGraph<TestData> TestDynamicGraph;
|
|
typedef TestDynamicGraph::InputEdge TestInputEdge;
|
|
|
|
BOOST_AUTO_TEST_CASE(find_test)
|
|
{
|
|
/*
|
|
* (0) -1-> (1)
|
|
* ^ ^
|
|
* 2 5
|
|
* | |
|
|
* (3) -3-> (4)
|
|
* <-4-
|
|
*/
|
|
std::vector<TestInputEdge> input_edges = {
|
|
TestInputEdge{0, 1, TestData{1}},
|
|
TestInputEdge{3, 0, TestData{2}},
|
|
TestInputEdge{3, 0, TestData{5}},
|
|
TestInputEdge{3, 4, TestData{3}},
|
|
TestInputEdge{4, 3, TestData{4}}
|
|
};
|
|
TestDynamicGraph simple_graph(5, input_edges);
|
|
|
|
auto eit = simple_graph.FindEdge(0, 1);
|
|
BOOST_CHECK_EQUAL(simple_graph.GetEdgeData(eit).id, 1);
|
|
|
|
eit = simple_graph.FindEdge(1, 0);
|
|
BOOST_CHECK_EQUAL(eit, SPECIAL_EDGEID);
|
|
|
|
eit = simple_graph.FindEdgeInEitherDirection(1, 0);
|
|
BOOST_CHECK_EQUAL(simple_graph.GetEdgeData(eit).id, 1);
|
|
|
|
bool reverse = false;
|
|
eit = simple_graph.FindEdgeIndicateIfReverse(1, 0, reverse);
|
|
BOOST_CHECK_EQUAL(simple_graph.GetEdgeData(eit).id, 1);
|
|
BOOST_CHECK(reverse);
|
|
|
|
eit = simple_graph.FindEdge(3, 1);
|
|
BOOST_CHECK_EQUAL(eit, SPECIAL_EDGEID);
|
|
eit = simple_graph.FindEdge(0, 4);
|
|
BOOST_CHECK_EQUAL(eit, SPECIAL_EDGEID);
|
|
|
|
eit = simple_graph.FindEdge(3, 4);
|
|
BOOST_CHECK_EQUAL(simple_graph.GetEdgeData(eit).id, 3);
|
|
eit = simple_graph.FindEdgeInEitherDirection(3, 4);
|
|
BOOST_CHECK_EQUAL(simple_graph.GetEdgeData(eit).id, 3);
|
|
|
|
eit = simple_graph.FindEdge(3, 0);
|
|
BOOST_CHECK_EQUAL(simple_graph.GetEdgeData(eit).id, 2);
|
|
}
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|