| 15 | using namespace osrm::engine; |
| 16 | |
| 17 | BOOST_AUTO_TEST_CASE(decode) |
| 18 | { |
| 19 | // Polyline string for the 5 coordinates |
| 20 | const std::string polyline = "_c`|@_c`|@o}@_pRo}@_pRo}@_pRo}@_pR"; |
| 21 | const auto coords = decodePolyline(polyline); |
| 22 | |
| 23 | // Test coordinates; these would be the coordinates we give the loc parameter, |
| 24 | // e.g. loc=10.00,10.0&loc=10.01,10.1... |
| 25 | util::Coordinate coord1(10.0_lon, 10.00_lat); |
| 26 | util::Coordinate coord2(10.1_lon, 10.01_lat); |
| 27 | util::Coordinate coord3(10.2_lon, 10.02_lat); |
| 28 | util::Coordinate coord4(10.3_lon, 10.03_lat); |
| 29 | util::Coordinate coord5(10.4_lon, 10.04_lat); |
| 30 | |
| 31 | // Put the test coordinates into the vector for comparison |
| 32 | std::vector<util::Coordinate> cmp_coords = {coord1, coord2, coord3, coord4, coord5}; |
| 33 | |
| 34 | BOOST_CHECK_EQUAL(cmp_coords.size(), coords.size()); |
| 35 | |
| 36 | for (std::size_t i = 0; i < cmp_coords.size(); ++i) |
| 37 | { |
| 38 | BOOST_CHECK_CLOSE(static_cast<double>(util::toFloating(coords[i].lat)), |
| 39 | static_cast<double>(util::toFloating(cmp_coords[i].lat)), |
| 40 | 0.0001); |
| 41 | BOOST_CHECK_CLOSE(static_cast<double>(util::toFloating(coords[i].lon)), |
| 42 | static_cast<double>(util::toFloating(cmp_coords[i].lon)), |
| 43 | 0.0001); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | BOOST_AUTO_TEST_CASE(encode) |
| 48 | { |
nothing calls this directly
no test coverage detected