Upgrade clang-format to version 15 (#6859)
This commit is contained in:
@@ -82,7 +82,8 @@ BOOST_AUTO_TEST_CASE(removed_middle_test_zoom_sensitive)
|
||||
BOOST_AUTO_TEST_CASE(remove_second_node_test)
|
||||
{
|
||||
// derived from the degreeToPixel function
|
||||
const auto delta_pixel_to_delta_degree = [](const int pixel, const unsigned zoom) {
|
||||
const auto delta_pixel_to_delta_degree = [](const int pixel, const unsigned zoom)
|
||||
{
|
||||
const double shift = (1u << zoom) * 256;
|
||||
const double b = shift / 2.0;
|
||||
return pixel * 180. / b;
|
||||
|
||||
@@ -40,17 +40,18 @@ BOOST_AUTO_TEST_CASE(simple_intersection_connectivity)
|
||||
// ↓
|
||||
// 4
|
||||
const auto unit_edge =
|
||||
[](const NodeID from, const NodeID to, bool allowed, AnnotationID annotation) {
|
||||
return InputEdge{from,
|
||||
to,
|
||||
EdgeWeight{1},
|
||||
EdgeDuration{1},
|
||||
EdgeDistance{1},
|
||||
GeometryID{0, false},
|
||||
!allowed,
|
||||
NodeBasedEdgeClassification(),
|
||||
annotation};
|
||||
};
|
||||
[](const NodeID from, const NodeID to, bool allowed, AnnotationID annotation)
|
||||
{
|
||||
return InputEdge{from,
|
||||
to,
|
||||
EdgeWeight{1},
|
||||
EdgeDuration{1},
|
||||
EdgeDistance{1},
|
||||
GeometryID{0, false},
|
||||
!allowed,
|
||||
NodeBasedEdgeClassification(),
|
||||
annotation};
|
||||
};
|
||||
|
||||
std::vector<InputEdge> edges = {unit_edge(0, 2, true, 1),
|
||||
unit_edge(0, 5, true, 0),
|
||||
@@ -102,7 +103,8 @@ BOOST_AUTO_TEST_CASE(simple_intersection_connectivity)
|
||||
RestrictionGraph restriction_graph = constructRestrictionGraph(restrictions);
|
||||
RestrictionMap restriction_map(restriction_graph);
|
||||
|
||||
const auto connectivity_matrix = [&](NodeID node) {
|
||||
const auto connectivity_matrix = [&](NodeID node)
|
||||
{
|
||||
std::vector<bool> result;
|
||||
const auto incoming_edges = getIncomingEdges(graph, node);
|
||||
const auto outgoing_edges = getOutgoingEdges(graph, node);
|
||||
@@ -167,7 +169,8 @@ BOOST_AUTO_TEST_CASE(roundabout_intersection_connectivity)
|
||||
// 0
|
||||
// ↙ ↑ ↘
|
||||
// 4 5 6
|
||||
const auto unit_edge = [](const NodeID from, const NodeID to, bool allowed, bool roundabout) {
|
||||
const auto unit_edge = [](const NodeID from, const NodeID to, bool allowed, bool roundabout)
|
||||
{
|
||||
return InputEdge{from,
|
||||
to,
|
||||
EdgeWeight{1},
|
||||
@@ -226,7 +229,8 @@ BOOST_AUTO_TEST_CASE(roundabout_intersection_connectivity)
|
||||
RestrictionGraph restriction_graph = constructRestrictionGraph(restrictions);
|
||||
RestrictionMap restriction_map(restriction_graph);
|
||||
|
||||
const auto connectivity_matrix = [&](NodeID node) {
|
||||
const auto connectivity_matrix = [&](NodeID node)
|
||||
{
|
||||
std::vector<bool> result;
|
||||
const auto incoming_edges = getIncomingEdges(graph, node);
|
||||
const auto outgoing_edges = getOutgoingEdges(graph, node);
|
||||
@@ -274,7 +278,8 @@ BOOST_AUTO_TEST_CASE(skip_degree_two_nodes)
|
||||
// ↑ ↕ ↕
|
||||
// 6 8 ↔ 9
|
||||
//
|
||||
const auto unit_edge = [](const NodeID from, const NodeID to, bool allowed) {
|
||||
const auto unit_edge = [](const NodeID from, const NodeID to, bool allowed)
|
||||
{
|
||||
return InputEdge{from,
|
||||
to,
|
||||
EdgeWeight{1},
|
||||
|
||||
@@ -56,14 +56,12 @@ void checkInstructions(RestrictionGraph::RestrictionRange restrictions,
|
||||
});
|
||||
std::sort(actual_instructions.begin(),
|
||||
actual_instructions.end(),
|
||||
[](const auto &lhs, const auto &rhs) {
|
||||
return (lhs.to < rhs.to) || (lhs.to == rhs.to && lhs.is_only);
|
||||
});
|
||||
[](const auto &lhs, const auto &rhs)
|
||||
{ return (lhs.to < rhs.to) || (lhs.to == rhs.to && lhs.is_only); });
|
||||
std::sort(expected_instructions.begin(),
|
||||
expected_instructions.end(),
|
||||
[](const auto &lhs, const auto &rhs) {
|
||||
return (lhs.to < rhs.to) || (lhs.to == rhs.to && lhs.is_only);
|
||||
});
|
||||
[](const auto &lhs, const auto &rhs)
|
||||
{ return (lhs.to < rhs.to) || (lhs.to == rhs.to && lhs.is_only); });
|
||||
|
||||
BOOST_REQUIRE_EQUAL_COLLECTIONS(actual_instructions.begin(),
|
||||
actual_instructions.end(),
|
||||
@@ -88,10 +86,11 @@ void checkEdges(RestrictionGraph::EdgeRange edges, std::vector<NodeID> expected_
|
||||
std::map<NodeID, size_t> nextEdges(RestrictionGraph::EdgeRange edges)
|
||||
{
|
||||
std::map<NodeID, size_t> res;
|
||||
std::transform(
|
||||
edges.begin(), edges.end(), std::inserter(res, res.end()), [&](const auto &edge) {
|
||||
return std::make_pair(edge.node_based_to, edge.target);
|
||||
});
|
||||
std::transform(edges.begin(),
|
||||
edges.end(),
|
||||
std::inserter(res, res.end()),
|
||||
[&](const auto &edge)
|
||||
{ return std::make_pair(edge.node_based_to, edge.target); });
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -132,12 +131,12 @@ validateViaRestrictionNode(RestrictionGraph &graph,
|
||||
BOOST_REQUIRE_GE(graph.via_edge_to_node.count({from, to}), 1);
|
||||
auto node_match_it = graph.via_edge_to_node.equal_range({from, to});
|
||||
|
||||
BOOST_REQUIRE_MESSAGE(
|
||||
std::any_of(node_match_it.first,
|
||||
node_match_it.second,
|
||||
[&](const auto node_match) { return node_match.second == via_node_idx; }),
|
||||
"Could not find expected via_node_idx " << via_node_idx << " for graph edge " << from << ","
|
||||
<< to);
|
||||
BOOST_REQUIRE_MESSAGE(std::any_of(node_match_it.first,
|
||||
node_match_it.second,
|
||||
[&](const auto node_match)
|
||||
{ return node_match.second == via_node_idx; }),
|
||||
"Could not find expected via_node_idx "
|
||||
<< via_node_idx << " for graph edge " << from << "," << to);
|
||||
|
||||
BOOST_REQUIRE_LT(via_node_idx, graph.num_via_nodes);
|
||||
return checkNode(
|
||||
|
||||
@@ -87,9 +87,9 @@ void validate_feature_layer(vtzero::layer layer)
|
||||
}
|
||||
|
||||
auto number_of_uint_values =
|
||||
std::count_if(layer.value_table().begin(), layer.value_table().end(), [](auto v) {
|
||||
return v.type() == vtzero::property_value_type::uint_value;
|
||||
});
|
||||
std::count_if(layer.value_table().begin(),
|
||||
layer.value_table().end(),
|
||||
[](auto v) { return v.type() == vtzero::property_value_type::uint_value; });
|
||||
BOOST_CHECK_EQUAL(number_of_uint_values, 79);
|
||||
}
|
||||
|
||||
@@ -129,9 +129,9 @@ void validate_turn_layer(vtzero::layer layer)
|
||||
}
|
||||
|
||||
auto number_of_float_values =
|
||||
std::count_if(layer.value_table().begin(), layer.value_table().end(), [](auto v) {
|
||||
return v.type() == vtzero::property_value_type::float_value;
|
||||
});
|
||||
std::count_if(layer.value_table().begin(),
|
||||
layer.value_table().end(),
|
||||
[](auto v) { return v.type() == vtzero::property_value_type::float_value; });
|
||||
|
||||
BOOST_CHECK_EQUAL(number_of_float_values, 73);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ BOOST_AUTO_TEST_CASE(access_nodes)
|
||||
const auto to_row = [cols](const NodeID nid) { return nid / cols; };
|
||||
const auto to_col = [cols](const NodeID nid) { return nid % cols; };
|
||||
|
||||
const auto get_expected = [&](const NodeID id) {
|
||||
const auto get_expected = [&](const NodeID id)
|
||||
{
|
||||
const auto expected_lon = FloatLongitude{to_col(id) * step_size};
|
||||
const auto expected_lat = FloatLatitude{to_row(id) * step_size};
|
||||
Coordinate compare(expected_lon, expected_lat);
|
||||
|
||||
@@ -40,7 +40,8 @@ BOOST_AUTO_TEST_SUITE(cell_storage_tests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(mutable_cell_storage)
|
||||
{
|
||||
const auto fill_range = [](auto range, const std::vector<EdgeWeight> &values) {
|
||||
const auto fill_range = [](auto range, const std::vector<EdgeWeight> &values)
|
||||
{
|
||||
auto iter = range.begin();
|
||||
for (auto v : values)
|
||||
*iter++ = v;
|
||||
|
||||
@@ -21,11 +21,13 @@ BOOST_AUTO_TEST_CASE(horizontal_cut_between_two_grids)
|
||||
const int cols = 10;
|
||||
|
||||
// build a small grid (10*10) and a (100 * 10) below (to make the different steps unique)
|
||||
auto graph = [&]() {
|
||||
auto graph = [&]()
|
||||
{
|
||||
std::vector<Coordinate> grid_coordinates;
|
||||
std::vector<EdgeWithSomeAdditionalData> grid_edges;
|
||||
|
||||
const auto connect = [&grid_edges](const NodeID from, const NodeID to) {
|
||||
const auto connect = [&grid_edges](const NodeID from, const NodeID to)
|
||||
{
|
||||
grid_edges.push_back({from, to, 1});
|
||||
grid_edges.push_back({to, from, 1});
|
||||
};
|
||||
|
||||
@@ -192,9 +192,10 @@ BOOST_AUTO_TEST_CASE(large_cell_number)
|
||||
|
||||
for (auto l : util::irange<size_t>(1UL, num_levels))
|
||||
{
|
||||
std::transform(levels[l - 1].begin(), levels[l - 1].end(), levels[l].begin(), [](auto val) {
|
||||
return val / 2;
|
||||
});
|
||||
std::transform(levels[l - 1].begin(),
|
||||
levels[l - 1].end(),
|
||||
levels[l].begin(),
|
||||
[](auto val) { return val / 2; });
|
||||
levels_to_num_cells[l] = levels_to_num_cells[l - 1] / 2;
|
||||
}
|
||||
|
||||
@@ -244,7 +245,8 @@ BOOST_AUTO_TEST_CASE(cell_64_bits)
|
||||
std::vector<CellID>(level_cells[0]));
|
||||
std::vector<uint32_t> levels_to_num_cells(level_cells.size());
|
||||
|
||||
const auto set_level_cells = [&](size_t level, auto const num_cells) {
|
||||
const auto set_level_cells = [&](size_t level, auto const num_cells)
|
||||
{
|
||||
for (auto val : util::irange<size_t>(0ULL, NUM_PARTITIONS))
|
||||
{
|
||||
levels[level][val] = std::min(val, num_cells - 1);
|
||||
@@ -273,7 +275,8 @@ BOOST_AUTO_TEST_CASE(cell_overflow_bits)
|
||||
std::vector<CellID>(level_cells[0]));
|
||||
std::vector<uint32_t> levels_to_num_cells(level_cells.size());
|
||||
|
||||
const auto set_level_cells = [&](size_t level, auto const num_cells) {
|
||||
const auto set_level_cells = [&](size_t level, auto const num_cells)
|
||||
{
|
||||
for (auto val : util::irange<size_t>(0ULL, NUM_PARTITIONS))
|
||||
{
|
||||
levels[level][val] = std::min(val, num_cells - 1);
|
||||
|
||||
@@ -20,18 +20,19 @@ BOOST_AUTO_TEST_CASE(dividing_four_grid_cells)
|
||||
const int cols = 10;
|
||||
const int cut_edges = 4;
|
||||
|
||||
auto graph = [&]() {
|
||||
auto graph = [&]()
|
||||
{
|
||||
std::vector<Coordinate> grid_coordinates;
|
||||
std::vector<EdgeWithSomeAdditionalData> grid_edges;
|
||||
|
||||
const auto connect =
|
||||
[&grid_edges](int min_left, int max_left, int min_right, int max_right) {
|
||||
const NodeID source = (rand() % (max_left - min_left)) + min_left;
|
||||
const NodeID target = (rand() % (max_right - min_right)) + min_right;
|
||||
const auto connect = [&grid_edges](int min_left, int max_left, int min_right, int max_right)
|
||||
{
|
||||
const NodeID source = (rand() % (max_left - min_left)) + min_left;
|
||||
const NodeID target = (rand() % (max_right - min_right)) + min_right;
|
||||
|
||||
grid_edges.push_back({source, target, 1});
|
||||
grid_edges.push_back({target, source, 1});
|
||||
};
|
||||
grid_edges.push_back({source, target, 1});
|
||||
grid_edges.push_back({target, source, 1});
|
||||
};
|
||||
|
||||
// generate 10 big components
|
||||
for (int i = 0; i < 4; ++i)
|
||||
|
||||
@@ -21,7 +21,8 @@ BOOST_AUTO_TEST_CASE(graph_views_on_components)
|
||||
|
||||
const int num_components = 10;
|
||||
|
||||
auto graph = [&]() {
|
||||
auto graph = [&]()
|
||||
{
|
||||
std::vector<Coordinate> grid_coordinates;
|
||||
std::vector<EdgeWithSomeAdditionalData> grid_edges;
|
||||
|
||||
@@ -56,14 +57,14 @@ BOOST_AUTO_TEST_CASE(graph_views_on_components)
|
||||
const auto &view = views[comp];
|
||||
BOOST_CHECK(views[comp].NumberOfNodes() == 10);
|
||||
|
||||
const auto to_component_id = [&](const auto &node) {
|
||||
return node.original_id / (rows * cols + 1);
|
||||
};
|
||||
const auto to_component_id = [&](const auto &node)
|
||||
{ return node.original_id / (rows * cols + 1); };
|
||||
|
||||
std::size_t expected_component_id = to_component_id(view.Node(0));
|
||||
BOOST_CHECK(std::all_of(view.Begin(), view.End(), [&](const auto &node) {
|
||||
return to_component_id(node) == expected_component_id;
|
||||
}));
|
||||
BOOST_CHECK(std::all_of(view.Begin(),
|
||||
view.End(),
|
||||
[&](const auto &node)
|
||||
{ return to_component_id(node) == expected_component_id; }));
|
||||
|
||||
for (const auto &node : view.Nodes())
|
||||
{
|
||||
|
||||
@@ -201,7 +201,8 @@ BOOST_AUTO_TEST_CASE(write_huge_tar_file, *boost::unit_test::disabled())
|
||||
{
|
||||
storage::tar::FileWriter writer(tmp.path, storage::tar::FileWriter::GenerateFingerprint);
|
||||
std::uint64_t value = 0;
|
||||
const std::function<std::uint64_t()> encode_function = [&]() -> std::uint64_t {
|
||||
const std::function<std::uint64_t()> encode_function = [&]() -> std::uint64_t
|
||||
{
|
||||
reference_checksum += value;
|
||||
return value++;
|
||||
};
|
||||
|
||||
@@ -113,12 +113,10 @@ BOOST_AUTO_TEST_CASE(check_max_size)
|
||||
std::vector<unsigned char> name_data(0x1000000, '#');
|
||||
std::vector<std::uint32_t> name_offsets;
|
||||
|
||||
auto test_variable = [&name_offsets, &name_data]() {
|
||||
test_rw<IndexedData<VariableGroupBlock<16, std::string>>>(name_offsets, name_data);
|
||||
};
|
||||
auto test_fixed = [&name_offsets, &name_data]() {
|
||||
test_rw<IndexedData<FixedGroupBlock<16, std::string>>>(name_offsets, name_data);
|
||||
};
|
||||
auto test_variable = [&name_offsets, &name_data]()
|
||||
{ test_rw<IndexedData<VariableGroupBlock<16, std::string>>>(name_offsets, name_data); };
|
||||
auto test_fixed = [&name_offsets, &name_data]()
|
||||
{ test_rw<IndexedData<FixedGroupBlock<16, std::string>>>(name_offsets, name_data); };
|
||||
|
||||
name_offsets = {0, 0x1000000};
|
||||
BOOST_CHECK_THROW(test_variable(), osrm::util::exception);
|
||||
|
||||
@@ -61,8 +61,8 @@ template <typename DataT> class LinearSearchNN
|
||||
std::vector<DataT> local_edges(edges);
|
||||
|
||||
auto projected_input = web_mercator::fromWGS84(input_coordinate);
|
||||
const auto segment_comparator = [this, &projected_input](const DataT &lhs,
|
||||
const DataT &rhs) {
|
||||
const auto segment_comparator = [this, &projected_input](const DataT &lhs, const DataT &rhs)
|
||||
{
|
||||
using web_mercator::fromWGS84;
|
||||
const auto lhs_result = coordinate_calculation::projectPointOnSegment(
|
||||
fromWGS84(coords[lhs.u]), fromWGS84(coords[lhs.v]), projected_input);
|
||||
|
||||
Reference in New Issue
Block a user