diff --git a/docs/testing.md b/docs/testing.md index 96940c9c1..884ff8488 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -28,6 +28,29 @@ This dataset is a small extract and may not even contain all tags or edge cases. Furthermore this dataset is not in sync with what you see in up-to-date OSM maps or on the demo server. See the library tests for how to add new dataset dependent tests. +To prepare the test data simply `cd test/data/` and then run `make`. + +### Running Tests + +To build the unit tests: + +``` +cd build +cmake .. +make tests +``` + +You should see the compiled binaries in `build/unit_tests`, you can then run each suite individually: + +``` +./engine-tests +``` + +For `library-tests` you will need to provide a path to the test data: + +``` +./library-tests ../../test/data/monaco.osrm +``` ## Cucumber diff --git a/unit_tests/library/args.hpp b/unit_tests/library/args.hpp index 3244d4ef9..512b612dd 100644 --- a/unit_tests/library/args.hpp +++ b/unit_tests/library/args.hpp @@ -3,6 +3,7 @@ #include #include +#include inline std::vector get_args() { @@ -10,6 +11,11 @@ inline std::vector get_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; + if (argc == 0) + { + std::cout << "You must provide a path to the test data, please see the unit testing docs" << std::endl; + } + return {argv, argv + argc}; }