-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial unit tests setup for typed libosrm services
- Loading branch information
1 parent
fe12907
commit 59a6d13
Showing
8 changed files
with
225 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef OSRM_UNIT_TEST_ARGS | ||
#define OSRM_UNIT_TEST_ARGS | ||
|
||
#include <vector> | ||
#include <string> | ||
|
||
inline std::vector<std::string> get_args() | ||
{ | ||
// Split off argv[0], store actual positional arguments in args | ||
const auto argc = boost::unit_test::framework::master_test_suite().argc - 1; | ||
const auto argv = boost::unit_test::framework::master_test_suite().argv + 1; | ||
|
||
return {argv, argv + argc}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,39 @@ | ||
#include <boost/test/unit_test.hpp> | ||
#include <boost/test/test_case_template.hpp> | ||
|
||
#include "args.h" | ||
|
||
#include "osrm/match_parameters.hpp" | ||
|
||
#include "osrm/coordinate.hpp" | ||
#include "osrm/engine_config.hpp" | ||
#include "osrm/json_container.hpp" | ||
#include "osrm/status.hpp" | ||
#include "osrm/osrm.hpp" | ||
|
||
BOOST_AUTO_TEST_SUITE(match) | ||
|
||
BOOST_AUTO_TEST_CASE(test_match) {} | ||
BOOST_AUTO_TEST_CASE(test_match) | ||
{ | ||
const auto args = get_args(); | ||
BOOST_REQUIRE_EQUAL(args.size(), 1); | ||
|
||
using namespace osrm; | ||
|
||
EngineConfig config{args[0]}; | ||
config.use_shared_memory = false; | ||
|
||
OSRM osrm{config}; | ||
|
||
/* | ||
MatchParameters params; | ||
json::Object result; | ||
const auto rc = osrm.Match(params, result); | ||
BOOST_CHECK(rc == Status::Ok || rc == Status::Error); | ||
*/ | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <boost/test/unit_test.hpp> | ||
#include <boost/test/test_case_template.hpp> | ||
|
||
#include "args.h" | ||
|
||
#include "osrm/nearest_parameters.hpp" | ||
|
||
#include "osrm/coordinate.hpp" | ||
#include "osrm/engine_config.hpp" | ||
#include "osrm/json_container.hpp" | ||
#include "osrm/status.hpp" | ||
#include "osrm/osrm.hpp" | ||
|
||
BOOST_AUTO_TEST_SUITE(nearest) | ||
|
||
BOOST_AUTO_TEST_CASE(test_nearest) | ||
{ | ||
const auto args = get_args(); | ||
BOOST_REQUIRE_EQUAL(args.size(), 1); | ||
|
||
using namespace osrm; | ||
|
||
EngineConfig config{args[0]}; | ||
config.use_shared_memory = false; | ||
|
||
OSRM osrm{config}; | ||
|
||
/* | ||
NearestParameters params; | ||
json::Object result; | ||
const auto rc = osrm.Nearest(params, result); | ||
BOOST_CHECK(rc == Status::Ok || rc == Status::Error); | ||
*/ | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,40 @@ | ||
#include <boost/test/unit_test.hpp> | ||
#include <boost/test/test_case_template.hpp> | ||
|
||
#include "args.h" | ||
|
||
#include "osrm/route_parameters.hpp" | ||
|
||
#include "osrm/coordinate.hpp" | ||
#include "osrm/engine_config.hpp" | ||
#include "osrm/json_container.hpp" | ||
#include "osrm/status.hpp" | ||
#include "osrm/osrm.hpp" | ||
|
||
BOOST_AUTO_TEST_SUITE(route) | ||
|
||
BOOST_AUTO_TEST_CASE(test_route) {} | ||
BOOST_AUTO_TEST_CASE(test_route) | ||
{ | ||
const auto args = get_args(); | ||
BOOST_REQUIRE_EQUAL(args.size(), 1); | ||
|
||
using namespace osrm; | ||
|
||
EngineConfig config{args[0]}; | ||
config.use_shared_memory = false; | ||
|
||
OSRM osrm{config}; | ||
|
||
RouteParameters params; | ||
|
||
params.coordinates.emplace_back(util::FloatLongitude{}, util::FloatLatitude{}); | ||
params.coordinates.emplace_back(util::FloatLongitude{}, util::FloatLatitude{}); | ||
|
||
json::Object result; | ||
|
||
const auto rc = osrm.Route(params, result); | ||
|
||
BOOST_CHECK(rc == Status::Ok || rc == Status::Error); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <boost/test/unit_test.hpp> | ||
#include <boost/test/test_case_template.hpp> | ||
|
||
#include "args.h" | ||
|
||
#include "osrm/table_parameters.hpp" | ||
|
||
#include "osrm/coordinate.hpp" | ||
#include "osrm/engine_config.hpp" | ||
#include "osrm/json_container.hpp" | ||
#include "osrm/status.hpp" | ||
#include "osrm/osrm.hpp" | ||
|
||
BOOST_AUTO_TEST_SUITE(table) | ||
|
||
BOOST_AUTO_TEST_CASE(test_table) | ||
{ | ||
const auto args = get_args(); | ||
BOOST_REQUIRE_EQUAL(args.size(), 1); | ||
|
||
using namespace osrm; | ||
|
||
EngineConfig config{args[0]}; | ||
config.use_shared_memory = false; | ||
|
||
OSRM osrm{config}; | ||
|
||
/* | ||
TableParameters params; | ||
json::Object result; | ||
const auto rc = osrm.Table(params, result); | ||
BOOST_CHECK(rc == Status::Ok || rc == Status::Error); | ||
*/ | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,40 @@ | ||
#include <boost/test/unit_test.hpp> | ||
#include <boost/test/test_case_template.hpp> | ||
|
||
#include "args.h" | ||
|
||
#include "osrm/tile_parameters.hpp" | ||
|
||
#include "osrm/coordinate.hpp" | ||
#include "osrm/engine_config.hpp" | ||
#include "osrm/json_container.hpp" | ||
#include "osrm/status.hpp" | ||
#include "osrm/osrm.hpp" | ||
|
||
BOOST_AUTO_TEST_SUITE(tile) | ||
|
||
BOOST_AUTO_TEST_CASE(test_tile) {} | ||
BOOST_AUTO_TEST_CASE(test_tile) | ||
{ | ||
const auto args = get_args(); | ||
BOOST_REQUIRE_EQUAL(args.size(), 1); | ||
|
||
using namespace osrm; | ||
|
||
EngineConfig config{args[0]}; | ||
config.use_shared_memory = false; | ||
|
||
OSRM osrm{config}; | ||
|
||
/* | ||
TileParameters params{0, 0, 0}; | ||
// TODO(daniel-j-h): why does the API expect a string? | ||
std::string result; | ||
const auto rc = osrm.Tile(params, result); | ||
BOOST_CHECK(rc == Status::Ok || rc == Status::Error); | ||
*/ | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,39 @@ | ||
#include <boost/test/unit_test.hpp> | ||
#include <boost/test/test_case_template.hpp> | ||
|
||
#include "args.h" | ||
|
||
#include "osrm/trip_parameters.hpp" | ||
|
||
#include "osrm/coordinate.hpp" | ||
#include "osrm/engine_config.hpp" | ||
#include "osrm/json_container.hpp" | ||
#include "osrm/status.hpp" | ||
#include "osrm/osrm.hpp" | ||
|
||
BOOST_AUTO_TEST_SUITE(trip) | ||
|
||
BOOST_AUTO_TEST_CASE(test_trip) {} | ||
BOOST_AUTO_TEST_CASE(test_trip) | ||
{ | ||
const auto args = get_args(); | ||
BOOST_REQUIRE_EQUAL(args.size(), 1); | ||
|
||
using namespace osrm; | ||
|
||
EngineConfig config{args[0]}; | ||
config.use_shared_memory = false; | ||
|
||
OSRM osrm{config}; | ||
|
||
/* | ||
TripParameters params; | ||
json::Object result; | ||
const auto rc = osrm.Trip(params, result); | ||
BOOST_CHECK(rc == Status::Ok || rc == Status::Error); | ||
*/ | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |