Adapts all unit tests and benchmarks to compile under v5 again

This commit is contained in:
Daniel J. Hofmann
2016-03-11 18:03:46 +01:00
committed by Patrick Niklaus
parent 0f0db4c823
commit 1486098065
5 changed files with 173 additions and 127 deletions
+10 -8
View File
@@ -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);
+9 -7
View File
@@ -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