Unit testing docs (#3698)
* Updating library-tests and associated documentation to be more informative * Fixing heading markup for updated unit testing docs
This commit is contained in:
parent
38a1edfe3c
commit
1ed1bae249
@ -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.
|
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.
|
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
|
## Cucumber
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
inline std::vector<std::string> get_args()
|
inline std::vector<std::string> get_args()
|
||||||
{
|
{
|
||||||
@ -10,6 +11,11 @@ inline std::vector<std::string> get_args()
|
|||||||
const auto argc = boost::unit_test::framework::master_test_suite().argc - 1;
|
const auto argc = boost::unit_test::framework::master_test_suite().argc - 1;
|
||||||
const auto argv = boost::unit_test::framework::master_test_suite().argv + 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};
|
return {argv, argv + argc};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user