Adapts all unit tests and benchmarks to compile under v5 again
This commit is contained in:
parent
0f0db4c823
commit
1486098065
@ -1,14 +1,16 @@
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "util/static_rtree.hpp"
|
||||
#include "extractor/edge_based_node.hpp"
|
||||
#include "engine/geospatial_query.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/edge_based_node.hpp"
|
||||
#include "util/static_rtree.hpp"
|
||||
#include "util/timing_util.hpp"
|
||||
#include "mocks/mock_datafacade.hpp"
|
||||
#include "util/coordinate.hpp"
|
||||
#include "mocks/mock_datafacade.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace benchmarks
|
||||
@ -77,7 +79,8 @@ void benchmark(BenchStaticRTree &rtree, BenchQuery &geo_query, unsigned num_quer
|
||||
std::vector<util::Coordinate> queries;
|
||||
for (unsigned i = 0; i < num_queries; i++)
|
||||
{
|
||||
queries.emplace_back(lat_udist(mt_rand), lon_udist(mt_rand));
|
||||
queries.emplace_back(util::FixedLongitude{lon_udist(mt_rand)},
|
||||
util::FixedLatitude{lat_udist(mt_rand)});
|
||||
}
|
||||
|
||||
benchmarkQuery(queries, "raw RTree queries (1 result)", [&rtree](const util::Coordinate &q)
|
||||
@ -126,9 +129,8 @@ int main(int argc, char **argv)
|
||||
auto coords = osrm::benchmarks::loadCoordinates(nodes_path);
|
||||
|
||||
osrm::benchmarks::BenchStaticRTree rtree(ram_path, file_path, coords);
|
||||
std::unique_ptr<osrm::benchmarks::MockDataFacade> mockfacade_ptr(
|
||||
new osrm::benchmarks::MockDataFacade);
|
||||
osrm::benchmarks::BenchQuery query(rtree, coords, *mockfacade_ptr);
|
||||
osrm::test::MockDataFacade mockfacade;
|
||||
osrm::benchmarks::BenchQuery query(rtree, coords, mockfacade);
|
||||
|
||||
osrm::benchmarks::benchmark(rtree, query, 10000);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
|
||||
#include "util/string_util.hpp"
|
||||
#include "util/trigonometry_table.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
@ -8,6 +7,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@ -260,11 +260,13 @@ double computeAngle(const Coordinate first, const Coordinate second, const Coord
|
||||
Coordinate interpolateLinear(double factor, const Coordinate from, const Coordinate to)
|
||||
{
|
||||
BOOST_ASSERT(0 <= factor && factor <= 1.0);
|
||||
return {
|
||||
from.lon +
|
||||
toFixed(FloatLongitude(factor * static_cast<double>(toFloating(to.lon - from.lon)))),
|
||||
from.lat +
|
||||
toFixed(FloatLatitude(factor * static_cast<double>(toFloating(to.lat - from.lat))))};
|
||||
|
||||
FloatLongitude interpolated_lon{((1. - factor) * static_cast<std::int32_t>(from.lon)) +
|
||||
(factor * static_cast<std::int32_t>(to.lon))};
|
||||
FloatLatitude interpolated_lat{((1. - factor) * static_cast<std::int32_t>(from.lat)) +
|
||||
(factor * static_cast<std::int32_t>(to.lat))};
|
||||
|
||||
return {std::move(interpolated_lon), std::move(interpolated_lat)};
|
||||
}
|
||||
|
||||
namespace mercator
|
||||
|
@ -31,16 +31,15 @@ BOOST_AUTO_TEST_CASE(long_road_test)
|
||||
CompressedEdgeContainer container;
|
||||
|
||||
std::vector<InputEdge> edges = {
|
||||
// source, target, distance, edge_id, name_id, access_restricted, reversed, roundabout,
|
||||
// travel_mode
|
||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{2, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{3, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{3, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{4, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT}};
|
||||
// src, tgt, dist, edge_id, name_id, access_restricted, fwd, bkwd, roundabout, travel_mode
|
||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{2, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{3, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{3, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{4, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE}};
|
||||
|
||||
BOOST_ASSERT(edges[0].data.IsCompatibleTo(edges[2].data));
|
||||
BOOST_ASSERT(edges[2].data.IsCompatibleTo(edges[4].data));
|
||||
@ -72,20 +71,19 @@ BOOST_AUTO_TEST_CASE(loop_test)
|
||||
CompressedEdgeContainer container;
|
||||
|
||||
std::vector<InputEdge> edges = {
|
||||
// source, target, distance, edge_id, name_id, access_restricted, forward, backward,
|
||||
// roundabout, travel_mode
|
||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{0, 5, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{2, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{3, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{3, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{4, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{4, 5, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{5, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{5, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
// src, tgt, dist, edge_id, name_id, access_restricted, fwd, bkwd, roundabout, travel_mode
|
||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{0, 5, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{2, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{3, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{3, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{4, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{4, 5, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{5, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{5, 4, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
};
|
||||
|
||||
BOOST_ASSERT(edges.size() == 12);
|
||||
@ -129,14 +127,13 @@ BOOST_AUTO_TEST_CASE(t_intersection)
|
||||
CompressedEdgeContainer container;
|
||||
|
||||
std::vector<InputEdge> edges = {
|
||||
// source, target, distance, edge_id, name_id, access_restricted, reversed, roundabout,
|
||||
// travel_mode
|
||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{3, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
// src, tgt, dist, edge_id, name_id, access_restricted, fwd, bkwd, roundabout, travel_mode
|
||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 3, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{3, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
};
|
||||
|
||||
BOOST_ASSERT(edges[0].data.IsCompatibleTo(edges[1].data));
|
||||
@ -167,12 +164,11 @@ BOOST_AUTO_TEST_CASE(street_name_changes)
|
||||
CompressedEdgeContainer container;
|
||||
|
||||
std::vector<InputEdge> edges = {
|
||||
// source, target, distance, edge_id, name_id, access_restricted, forward, backward,
|
||||
// roundabout, travel_mode
|
||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 2, 1, SPECIAL_EDGEID, 1, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{2, 1, 1, SPECIAL_EDGEID, 1, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
// src, tgt, dist, edge_id, name_id, access_restricted, fwd, bkwd, roundabout, travel_mode
|
||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 2, 1, SPECIAL_EDGEID, 1, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{2, 1, 1, SPECIAL_EDGEID, 1, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
};
|
||||
|
||||
BOOST_ASSERT(edges[0].data.IsCompatibleTo(edges[1].data));
|
||||
@ -199,12 +195,11 @@ BOOST_AUTO_TEST_CASE(direction_changes)
|
||||
CompressedEdgeContainer container;
|
||||
|
||||
std::vector<InputEdge> edges = {
|
||||
// source, target, distance, edge_id, name_id, access_restricted, reverse, roundabout,
|
||||
// travel_mode
|
||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, true, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_DEFAULT},
|
||||
// src, tgt, dist, edge_id, name_id, access_restricted, fwd, bkwd, roundabout, travel_mode
|
||||
{0, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 0, 1, SPECIAL_EDGEID, 0, false, true, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{1, 2, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
{2, 1, 1, SPECIAL_EDGEID, 0, false, false, false, true, TRAVEL_MODE_INACCESSIBLE},
|
||||
};
|
||||
|
||||
Graph graph(5, edges);
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
// implements all data storage when shared memory _IS_ used
|
||||
|
||||
#include "extractor/guidance/turn_instruction.hpp"
|
||||
#include "engine/datafacade/datafacade_base.hpp"
|
||||
#include "contractor/query_edge.hpp"
|
||||
|
||||
@ -11,18 +12,17 @@ namespace osrm
|
||||
namespace test
|
||||
{
|
||||
|
||||
template <class EdgeDataT>
|
||||
class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade<EdgeDataT>
|
||||
class MockDataFacade final : public engine::datafacade::BaseDataFacade
|
||||
{
|
||||
private:
|
||||
EdgeDataT foo;
|
||||
EdgeData foo;
|
||||
|
||||
public:
|
||||
unsigned GetNumberOfNodes() const { return 0; }
|
||||
unsigned GetNumberOfEdges() const { return 0; }
|
||||
unsigned GetOutDegree(const NodeID /* n */) const { return 0; }
|
||||
NodeID GetTarget(const EdgeID /* e */) const { return SPECIAL_NODEID; }
|
||||
const EdgeDataT &GetEdgeData(const EdgeID /* e */) const { return foo; }
|
||||
const EdgeData &GetEdgeData(const EdgeID /* e */) const { return foo; }
|
||||
EdgeID BeginEdges(const NodeID /* n */) const { return SPECIAL_EDGEID; }
|
||||
EdgeID EndEdges(const NodeID /* n */) const { return SPECIAL_EDGEID; }
|
||||
osrm::engine::datafacade::EdgeRange GetAdjacentEdgeRange(const NodeID /* node */) const
|
||||
@ -40,10 +40,9 @@ class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade<Ed
|
||||
{
|
||||
return SPECIAL_EDGEID;
|
||||
}
|
||||
util::FixedPointCoordinate GetCoordinateOfNode(const unsigned /* id */) const
|
||||
util::Coordinate GetCoordinateOfNode(const unsigned /* id */) const
|
||||
{
|
||||
FixedPointCoordinate foo(0, 0);
|
||||
return foo;
|
||||
return {util::FixedLongitude{0}, util::FixedLatitude{0}};
|
||||
}
|
||||
bool EdgeIsCompressed(const unsigned /* id */) const { return false; }
|
||||
unsigned GetGeometryIndexForEdgeID(const unsigned /* id */) const { return SPECIAL_NODEID; }
|
||||
@ -55,48 +54,99 @@ class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade<Ed
|
||||
std::vector<EdgeWeight> & /* result_weights */) const
|
||||
{
|
||||
}
|
||||
extractor::TurnInstruction GetTurnInstructionForEdgeID(const unsigned /* id */) const
|
||||
extractor::guidance::TurnInstruction GetTurnInstructionForEdgeID(const unsigned /* id */) const
|
||||
{
|
||||
return osrm::extractor::TurnInstruction::NoTurn;
|
||||
return extractor::guidance::TurnInstruction::NO_TURN();
|
||||
}
|
||||
extractor::TravelMode GetTravelModeForEdgeID(const unsigned /* id */) const
|
||||
{
|
||||
return TRAVEL_MODE_DEFAULT;
|
||||
return TRAVEL_MODE_INACCESSIBLE;
|
||||
}
|
||||
std::vector<typename osrm::engine::datafacade::BaseDataFacade<EdgeDataT>::RTreeLeaf>
|
||||
GetEdgesInBox(const util::FixedPointCoordinate & /* south_west */,
|
||||
const util::FixedPointCoordinate & /*north_east */)
|
||||
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate /* south_west */,
|
||||
const util::Coordinate /*north_east */)
|
||||
{
|
||||
std::vector<typename osrm::engine::datafacade::BaseDataFacade<EdgeDataT>::RTreeLeaf> foo;
|
||||
return foo;
|
||||
return {};
|
||||
}
|
||||
std::vector<osrm::engine::PhantomNodeWithDistance>
|
||||
NearestPhantomNodesInRange(const util::FixedPointCoordinate /* input_coordinate */,
|
||||
const float /* max_distance */,
|
||||
const int /* bearing = 0 */,
|
||||
const int /* bearing_range = 180 */)
|
||||
|
||||
std::vector<engine::PhantomNodeWithDistance>
|
||||
NearestPhantomNodesInRange(const util::Coordinate /*input_coordinate*/,
|
||||
const float /*max_distance*/,
|
||||
const int /*bearing*/,
|
||||
const int /*bearing_range*/)
|
||||
{
|
||||
std::vector<osrm::engine::PhantomNodeWithDistance> foo;
|
||||
return foo;
|
||||
return {};
|
||||
}
|
||||
std::vector<osrm::engine::PhantomNodeWithDistance>
|
||||
NearestPhantomNodes(const util::FixedPointCoordinate /* input_coordinate */,
|
||||
const unsigned /* max_results */,
|
||||
const int /* bearing = 0 */,
|
||||
const int /* bearing_range = 180 */)
|
||||
|
||||
std::vector<engine::PhantomNodeWithDistance>
|
||||
NearestPhantomNodesInRange(const util::Coordinate /*input_coordinate*/,
|
||||
const float /*max_distance*/)
|
||||
{
|
||||
std::vector<osrm::engine::PhantomNodeWithDistance> foo;
|
||||
return foo;
|
||||
return {};
|
||||
}
|
||||
std::pair<osrm::engine::PhantomNode, osrm::engine::PhantomNode>
|
||||
NearestPhantomNodeWithAlternativeFromBigComponent(
|
||||
const util::FixedPointCoordinate /* input_coordinate */,
|
||||
const int /* bearing = 0 */,
|
||||
const int /* bearing_range = 180 */)
|
||||
|
||||
std::vector<engine::PhantomNodeWithDistance>
|
||||
NearestPhantomNodes(const util::Coordinate /*input_coordinate*/,
|
||||
const unsigned /*max_results*/,
|
||||
const double /*max_distance*/,
|
||||
const int /*bearing*/,
|
||||
const int /*bearing_range*/)
|
||||
{
|
||||
std::pair<osrm::engine::PhantomNode, osrm::engine::PhantomNode> foo;
|
||||
return foo;
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<engine::PhantomNodeWithDistance>
|
||||
NearestPhantomNodes(const util::Coordinate /*input_coordinate*/,
|
||||
const unsigned /*max_results*/,
|
||||
const int /*bearing*/,
|
||||
const int /*bearing_range*/)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<engine::PhantomNodeWithDistance>
|
||||
NearestPhantomNodes(const util::Coordinate /*input_coordinate*/, const unsigned /*max_results*/)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<engine::PhantomNodeWithDistance>
|
||||
NearestPhantomNodes(const util::Coordinate /*input_coordinate*/,
|
||||
const unsigned /*max_results*/,
|
||||
const double /*max_distance*/)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::pair<engine::PhantomNode, engine::PhantomNode>
|
||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::pair<engine::PhantomNode, engine::PhantomNode>
|
||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/,
|
||||
const double /*max_distance*/)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::pair<engine::PhantomNode, engine::PhantomNode>
|
||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/,
|
||||
const double /*max_distance*/,
|
||||
const int /*bearing*/,
|
||||
const int /*bearing_range*/)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::pair<engine::PhantomNode, engine::PhantomNode>
|
||||
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/,
|
||||
const int /*bearing*/,
|
||||
const int /*bearing_range*/)
|
||||
{
|
||||
return {};
|
||||
};
|
||||
|
||||
unsigned GetCheckSum() const { return 0; }
|
||||
bool IsCoreNode(const NodeID /* id */) const { return false; }
|
||||
unsigned GetNameIndexFromEdgeID(const unsigned /* id */) const { return 0; }
|
||||
@ -105,9 +155,7 @@ class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade<Ed
|
||||
std::string GetTimestamp() const { return ""; }
|
||||
bool GetUTurnsDefault() const override { return true; }
|
||||
};
|
||||
|
||||
using MockDataFacade = MockDataFacadeT<contractor::QueryEdge::EdgeData>;
|
||||
} // osrm::test::
|
||||
} // osrm::
|
||||
} // ns test
|
||||
} // ns osrm
|
||||
|
||||
#endif // MOCK_DATAFACADE_HPP
|
||||
|
@ -307,8 +307,7 @@ BOOST_AUTO_TEST_CASE(regression_test)
|
||||
Coord{FloatLongitude{5.0}, FloatLatitude{35.0}}, //
|
||||
Coord{FloatLongitude{5.0},
|
||||
FloatLatitude{
|
||||
5.0,
|
||||
}}, //
|
||||
5.0, }}, //
|
||||
Coord{FloatLongitude{10.0}, FloatLatitude{0.0}}, //
|
||||
Coord{FloatLongitude{10.0}, FloatLatitude{20.0}}, //
|
||||
Coord{FloatLongitude{5.0}, FloatLatitude{20.0}}, //
|
||||
@ -408,9 +407,9 @@ BOOST_AUTO_TEST_CASE(bearing_tests)
|
||||
std::string nodes_path;
|
||||
build_rtree<GraphFixture, MiniStaticRTree>("test_bearing", &fixture, leaves_path, nodes_path);
|
||||
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
|
||||
std::unique_ptr<MockDataFacade> mockfacade_ptr(new MockDataFacade);
|
||||
MockDataFacade mockfacade;
|
||||
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(rtree, fixture.coords,
|
||||
*mockfacade_ptr);
|
||||
mockfacade);
|
||||
|
||||
Coordinate input(FloatLongitude(5.1), FloatLatitude(5.0));
|
||||
|
||||
@ -474,20 +473,20 @@ BOOST_AUTO_TEST_CASE(bbox_search_tests)
|
||||
std::string nodes_path;
|
||||
build_rtree<GraphFixture, MiniStaticRTree>("test_bbox", &fixture, leaves_path, nodes_path);
|
||||
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
|
||||
std::unique_ptr<MockDataFacade> mockfacade_ptr(new MockDataFacade);
|
||||
MockDataFacade mockfacade;
|
||||
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(rtree, fixture.coords,
|
||||
*mockfacade_ptr);
|
||||
mockfacade);
|
||||
|
||||
{
|
||||
RectangleInt2D bbox = {FloatLongitude(0.5), FloatLongitude(1.5), FloatLatitude(0.5),
|
||||
FloatLatitude(1.5)};
|
||||
RectangleInt2D bbox = {
|
||||
FloatLongitude(0.5), FloatLongitude(1.5), FloatLatitude(0.5), FloatLatitude(1.5)};
|
||||
auto results = query.Search(bbox);
|
||||
BOOST_CHECK_EQUAL(results.size(), 2);
|
||||
}
|
||||
|
||||
{
|
||||
RectangleInt2D bbox = {FloatLongitude(1.5), FloatLongitude(3.5), FloatLatitude(1.5),
|
||||
FloatLatitude(3.5)};
|
||||
RectangleInt2D bbox = {
|
||||
FloatLongitude(1.5), FloatLongitude(3.5), FloatLatitude(1.5), FloatLatitude(3.5)};
|
||||
auto results = query.Search(bbox);
|
||||
BOOST_CHECK_EQUAL(results.size(), 3);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user