/srv/osrm/osrm-backend/unit_tests/library
NameSizeModeActions
algorithm.cpp9590644editdlrm
contract.cpp5160644editdlrm
coordinates.hpp12380644editdlrm
customize.cpp5220644editdlrm
equal_json.hpp7210644editdlrm
extract.cpp62130644editdlrm
fixture.hpp6410644editdlrm
json.cpp21320644editdlrm
limits.cpp61220644editdlrm
match.cpp81910644editdlrm
nearest.cpp83640644editdlrm
options.cpp10820644editdlrm
partition.cpp5220644editdlrm
route.cpp290230644editdlrm
table.cpp155810644editdlrm
tile.cpp212470644editdlrm
trip.cpp216070644editdlrm
waypoint_check.hpp12310644editdlrm
Edit: /srv/osrm/osrm-backend/unit_tests/library/json.cpp (2132B)
#include #include "coordinates.hpp" #include "equal_json.hpp" #include "engine/api/json_factory.hpp" #include "osrm/coordinate.hpp" #include using namespace osrm; BOOST_AUTO_TEST_SUITE(json) BOOST_AUTO_TEST_CASE(test_json_linestring) { const std::vector locations{get_dummy_location(), // get_dummy_location(), // get_dummy_location()}; // auto geom = engine::api::json::makeGeoJSONGeometry(begin(locations), end(locations)); const auto type = geom.values["type"].get().value; BOOST_CHECK_EQUAL(type, "LineString"); const auto coords = geom.values["coordinates"].get().values; BOOST_CHECK_EQUAL(coords.size(), 3); // array of three location arrays for (const auto &each : coords) { const auto loc = each.get().values; BOOST_CHECK_EQUAL(loc.size(), 2); const auto lon = loc[0].get().value; const auto lat = loc[1].get().value; (void)lon; (void)lat; // cast fails if type do not match } } BOOST_AUTO_TEST_CASE(test_json_single_point) { const std::vector locations{get_dummy_location()}; auto geom = engine::api::json::makeGeoJSONGeometry(begin(locations), end(locations)); const auto type = geom.values["type"].get().value; BOOST_CHECK_EQUAL(type, "LineString"); const auto coords = geom.values["coordinates"].get().values; BOOST_CHECK_EQUAL(coords.size(), 2); // array of two location arrays for (const auto &each : coords) { const auto loc = each.get().values; BOOST_CHECK_EQUAL(loc.size(), 2); const auto lon = loc[0].get().value; const auto lat = loc[1].get().value; (void)lon; (void)lat; // cast fails if type do not match } } BOOST_AUTO_TEST_SUITE_END()