Add namespace around all files
This commit is contained in:
@@ -5,7 +5,10 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_case_template.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(bearing)
|
||||
BOOST_AUTO_TEST_SUITE(bearing_test)
|
||||
|
||||
using namespace osrm;
|
||||
using namespace osrm::util;
|
||||
|
||||
// Verify that the bearing-bounds checking function behaves as expected
|
||||
BOOST_AUTO_TEST_CASE(bearing_range_test)
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(binary_heap)
|
||||
|
||||
using namespace osrm;
|
||||
using namespace osrm::util;
|
||||
|
||||
struct TestData
|
||||
{
|
||||
unsigned value;
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace osrm;
|
||||
using namespace osrm::util;
|
||||
|
||||
// Regression test for bug captured in #1347
|
||||
BOOST_AUTO_TEST_CASE(regression_test_1347)
|
||||
{
|
||||
|
||||
@@ -5,33 +5,36 @@
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(durations_are_valid)
|
||||
|
||||
using namespace osrm;
|
||||
using namespace osrm::util;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(all_necessary_test)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(durationIsValid("00:01"), true);
|
||||
BOOST_CHECK_EQUAL(durationIsValid("00:01:01"), true);
|
||||
BOOST_CHECK_EQUAL(durationIsValid("PT15M"), true);
|
||||
BOOST_CHECK_EQUAL(extractor::durationIsValid("00:01"), true);
|
||||
BOOST_CHECK_EQUAL(extractor::durationIsValid("00:01:01"), true);
|
||||
BOOST_CHECK_EQUAL(extractor::durationIsValid("PT15M"), true);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(common_durations_get_translated)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(parseDuration("00:01"), 60);
|
||||
BOOST_CHECK_EQUAL(parseDuration("00:01:01"), 61);
|
||||
BOOST_CHECK_EQUAL(parseDuration("01:01"), 3660);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("00:01"), 60);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("00:01:01"), 61);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("01:01"), 3660);
|
||||
|
||||
// check all combinations of iso duration tokens
|
||||
BOOST_CHECK_EQUAL(parseDuration("PT1M1S"), 61);
|
||||
BOOST_CHECK_EQUAL(parseDuration("PT1H1S"), 3601);
|
||||
BOOST_CHECK_EQUAL(parseDuration("PT15M"), 900);
|
||||
BOOST_CHECK_EQUAL(parseDuration("PT15S"), 15);
|
||||
BOOST_CHECK_EQUAL(parseDuration("PT15H"), 54000);
|
||||
BOOST_CHECK_EQUAL(parseDuration("PT1H15M"), 4500);
|
||||
BOOST_CHECK_EQUAL(parseDuration("PT1H15M1S"), 4501);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("PT1M1S"), 61);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("PT1H1S"), 3601);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("PT15M"), 900);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("PT15S"), 15);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("PT15H"), 54000);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("PT1H15M"), 4500);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("PT1H15M1S"), 4501);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(iso_8601_durations_case_insensitive)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(parseDuration("PT15m"), 900);
|
||||
BOOST_CHECK_EQUAL(parseDuration("PT1h15m"), 4500);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("PT15m"), 900);
|
||||
BOOST_CHECK_EQUAL(extractor::parseDuration("PT1h15m"), 4500);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(dynamic_graph)
|
||||
|
||||
using namespace osrm;
|
||||
using namespace osrm::util;
|
||||
|
||||
struct TestData
|
||||
{
|
||||
EdgeID id;
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
#include <numeric>
|
||||
#include <stxxl/vector>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(range_table)
|
||||
|
||||
using namespace osrm;
|
||||
using namespace osrm::util;
|
||||
|
||||
constexpr unsigned BLOCK_SIZE = 16;
|
||||
typedef RangeTable<BLOCK_SIZE, false> TestRangeTable;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(range_table)
|
||||
|
||||
void ConstructionTest(stxxl::vector<unsigned> lengths, std::vector<unsigned> offsets)
|
||||
{
|
||||
BOOST_ASSERT(lengths.size() == offsets.size() - 1);
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(static_graph)
|
||||
|
||||
using namespace osrm;
|
||||
using namespace osrm::util;
|
||||
|
||||
struct TestData
|
||||
{
|
||||
EdgeID id;
|
||||
|
||||
@@ -25,10 +25,13 @@
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(static_rtree)
|
||||
|
||||
using namespace osrm;
|
||||
using namespace osrm::util;
|
||||
|
||||
constexpr uint32_t TEST_BRANCHING_FACTOR = 8;
|
||||
constexpr uint32_t TEST_LEAF_NODE_SIZE = 64;
|
||||
|
||||
typedef EdgeBasedNode TestData;
|
||||
using TestData = extractor::EdgeBasedNode;
|
||||
using TestStaticRTree = StaticRTree<TestData,
|
||||
std::vector<FixedPointCoordinate>,
|
||||
false,
|
||||
@@ -108,7 +111,7 @@ template <unsigned NUM_NODES, unsigned NUM_EDGES> struct RandomGraphFixture
|
||||
{
|
||||
int lat = lat_udist(g);
|
||||
int lon = lon_udist(g);
|
||||
nodes.emplace_back(QueryNode(lat, lon, OSMNodeID(i)));
|
||||
nodes.emplace_back(extractor::QueryNode(lat, lon, OSMNodeID(i)));
|
||||
coords->emplace_back(FixedPointCoordinate(lat, lon));
|
||||
}
|
||||
|
||||
@@ -131,7 +134,7 @@ template <unsigned NUM_NODES, unsigned NUM_EDGES> struct RandomGraphFixture
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<QueryNode> nodes;
|
||||
std::vector<extractor::QueryNode> nodes;
|
||||
std::shared_ptr<std::vector<FixedPointCoordinate>> coords;
|
||||
std::vector<TestData> edges;
|
||||
};
|
||||
@@ -148,7 +151,7 @@ struct GraphFixture
|
||||
FixedPointCoordinate c(input_coords[i].first * COORDINATE_PRECISION,
|
||||
input_coords[i].second * COORDINATE_PRECISION);
|
||||
coords->emplace_back(c);
|
||||
nodes.emplace_back(QueryNode(c.lat, c.lon, OSMNodeID(i)));
|
||||
nodes.emplace_back(extractor::QueryNode(c.lat, c.lon, OSMNodeID(i)));
|
||||
}
|
||||
|
||||
for (const auto &pair : input_edges)
|
||||
@@ -166,7 +169,7 @@ struct GraphFixture
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<QueryNode> nodes;
|
||||
std::vector<extractor::QueryNode> nodes;
|
||||
std::shared_ptr<std::vector<FixedPointCoordinate>> coords;
|
||||
std::vector<TestData> edges;
|
||||
};
|
||||
@@ -252,7 +255,7 @@ void build_rtree(const std::string &prefix,
|
||||
boost::filesystem::ofstream node_stream(coords_path, std::ios::binary);
|
||||
const auto num_nodes = static_cast<unsigned>(fixture->nodes.size());
|
||||
node_stream.write((char *)&num_nodes, sizeof(unsigned));
|
||||
node_stream.write((char *)&(fixture->nodes[0]), num_nodes * sizeof(QueryNode));
|
||||
node_stream.write((char *)&(fixture->nodes[0]), num_nodes * sizeof(extractor::QueryNode));
|
||||
node_stream.close();
|
||||
|
||||
RTreeT r(fixture->edges, nodes_path, leaves_path, fixture->nodes);
|
||||
@@ -408,7 +411,7 @@ 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);
|
||||
GeospatialQuery<MiniStaticRTree> query(rtree, fixture.coords);
|
||||
engine::GeospatialQuery<MiniStaticRTree> query(rtree, fixture.coords);
|
||||
|
||||
FixedPointCoordinate input(5.0 * COORDINATE_PRECISION, 5.1 * COORDINATE_PRECISION);
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(string_util)
|
||||
|
||||
using namespace osrm;
|
||||
using namespace osrm::util;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(json_escaping)
|
||||
{
|
||||
std::string input{"\b\\"};
|
||||
|
||||
Reference in New Issue
Block a user