MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / test_tile_speeds

Function test_tile_speeds

unit_tests/library/tile.cpp:350–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348BOOST_AUTO_TEST_CASE(test_tile_turns_mld_new_api) { test_tile_turns_mld(false); }
349
350void test_tile_speeds(const osrm::OSRM &osrm, bool use_string_only_api)
351{
352 using namespace osrm;
353
354 // Small tile so we can test all the values
355 // TileParameters params{272953, 191177, 19};
356 TileParameters params{136477, 95580, 18};
357
358 std::string str_result;
359 const auto rc = run_tile(osrm, params, str_result, use_string_only_api);
360 BOOST_CHECK(rc == Status::Ok);
361
362 BOOST_CHECK_GT(str_result.size(), 128);
363
364 vtzero::vector_tile tile{str_result};
365
366 auto layer = tile.next_layer();
367 BOOST_CHECK_EQUAL(to_string(layer.name()), "speeds");
368
369 std::vector<std::string> actual_names;
370 while (auto feature = layer.next_feature())
371 {
372 auto props = vtzero::create_properties_map<std::map<std::string, variant_type>>(feature);
373
374 BOOST_CHECK(std::holds_alternative<std::string>(props["name"]));
375 actual_names.push_back(std::get<std::string>(props["name"]));
376 }
377 std::sort(actual_names.begin(), actual_names.end());
378 const std::vector<std::string> expected_names = {"Avenue du Carnier",
379 "Avenue du Carnier",
380 "Avenue du Carnier",
381 "Avenue du Carnier",
382 "Avenue du Carnier",
383 "Avenue du Maréchal Foch",
384 "Avenue du Maréchal Foch",
385 "Avenue du Maréchal Foch",
386 "Avenue du Maréchal Foch",
387 "Avenue du Maréchal Foch",
388 "Avenue du Maréchal Foch",
389 "Avenue du Professeur Langevin",
390 "Avenue du Professeur Langevin",
391 "Avenue du Professeur Langevin",
392 "Montée de la Crémaillère",
393 "Montée de la Crémaillère",
394 "Rue Jules Ferry",
395 "Rue Jules Ferry",
396 "Rue Professeur Calmette",
397 "Rue Professeur Calmette"};
398 BOOST_CHECK(actual_names == expected_names);
399}
400
401void test_tile_speeds_ch(osrm::EngineConfig::Algorithm algorithm, bool use_string_only_api)
402{

Callers 2

test_tile_speeds_chFunction · 0.85
test_tile_speeds_mldFunction · 0.85

Calls 7

run_tileFunction · 0.85
to_stringFunction · 0.85
sizeMethod · 0.45
nameMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected