Enable more clang-tidy checks. (#6270)

* Enable more clang-tidy checks
This commit is contained in:
Siarhei Fedartsou
2022-06-30 15:32:12 +02:00
committed by GitHub
parent 59953172e8
commit 3d2db20777
35 changed files with 69 additions and 79 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
#include <boost/test/unit_test.hpp>
#define REQUIRE_SIZE_RANGE(range, ref) BOOST_REQUIRE_EQUAL(range.size(), ref)
#define REQUIRE_SIZE_RANGE(range, ref) BOOST_REQUIRE_EQUAL((range).size(), ref)
#define CHECK_EQUAL_RANGE(range, ...) \
do \
{ \
+1 -1
View File
@@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE(incorrect_polylines)
};
util::Coordinate coord{util::FloatLongitude{0}, util::FloatLatitude{0}};
for (auto polyline : polylines)
for (const auto &polyline : polylines)
{
const auto result = decodePolyline(polyline);
BOOST_CHECK(result.size() == 1);
+4 -2
View File
@@ -12,10 +12,12 @@
#include "osrm/status.hpp"
osrm::Status run_match_json(const osrm::OSRM &osrm,
const MatchParameters &params,
json::Object &json_result,
const osrm::MatchParameters &params,
osrm::json::Object &json_result,
bool use_json_only_api)
{
using namespace osrm;
if (use_json_only_api)
{
return osrm.Match(params, json_result);
+1 -1
View File
@@ -34,7 +34,7 @@ osrm::Status run_tile(const osrm::OSRM &osrm,
}
#define CHECK_EQUAL_RANGE(R1, R2) \
BOOST_CHECK_EQUAL_COLLECTIONS(R1.begin(), R1.end(), R2.begin(), R2.end());
BOOST_CHECK_EQUAL_COLLECTIONS((R1).begin(), (R1).end(), (R2).begin(), (R2).end());
BOOST_AUTO_TEST_SUITE(tile)
+5 -3
View File
@@ -6,10 +6,10 @@
#include "osrm/json_container.hpp"
#include "util/exception.hpp"
using namespace osrm;
inline bool waypoint_check(json::Value waypoint)
inline bool waypoint_check(osrm::json::Value waypoint)
{
using namespace osrm;
if (!waypoint.is<mapbox::util::recursive_wrapper<util::json::Object>>())
{
throw util::exception("Must pass in a waypoint object");
@@ -24,6 +24,8 @@ inline bool waypoint_check(json::Value waypoint)
inline bool waypoint_check(const osrm::engine::api::fbresult::Waypoint *const waypoint)
{
using namespace osrm;
util::FloatLongitude lon{waypoint->location()->longitude()};
util::FloatLatitude lat{waypoint->location()->latitude()};
util::Coordinate location_coordinate(lon, lat);
@@ -3,7 +3,7 @@
#include "partitioner/bisection_to_partition.hpp"
#define CHECK_SIZE_RANGE(range, ref) BOOST_CHECK_EQUAL(range.end() - range.begin(), ref)
#define CHECK_SIZE_RANGE(range, ref) BOOST_CHECK_EQUAL((range).end() - (range).begin(), ref)
#define CHECK_EQUAL_RANGE(range, ref) \
do \
{ \
+5 -6
View File
@@ -7,8 +7,6 @@
#include <algorithm>
#include <vector>
using namespace osrm::util;
struct EdgeWithSomeAdditionalData
{
NodeID source;
@@ -16,16 +14,17 @@ struct EdgeWithSomeAdditionalData
unsigned important_data;
};
inline Coordinate
inline osrm::util::Coordinate
makeCoordinate(int x, int y, double step_size, double offset_x = 0, double offset_y = 0)
{
return {FloatLongitude{offset_x + x * step_size}, FloatLatitude{offset_y + y * step_size}};
return {osrm::util::FloatLongitude{offset_x + x * step_size},
osrm::util::FloatLatitude{offset_y + y * step_size}};
}
std::vector<Coordinate> inline makeGridCoordinates(
std::vector<osrm::util::Coordinate> inline makeGridCoordinates(
int rows, int columns, double step_size, double lon_base, double lat_base)
{
std::vector<Coordinate> result;
std::vector<osrm::util::Coordinate> result;
for (int r = 0; r < rows; ++r)
for (int c = 0; c < columns; ++c)
@@ -8,7 +8,7 @@
#include "partitioner/multi_level_partition.hpp"
#define CHECK_SIZE_RANGE(range, ref) BOOST_CHECK_EQUAL(range.second - range.first, ref)
#define CHECK_SIZE_RANGE(range, ref) BOOST_CHECK_EQUAL((range).second - (range).first, ref)
#define CHECK_EQUAL_RANGE(range, ref) \
do \
{ \
@@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(dividing_four_grid_cells)
RecursiveBisection bisection(graph, 120, 1.1, 0.25, 10, 1);
const auto result = bisection.BisectionIDs();
const auto &result = bisection.BisectionIDs();
// all same IDs withing a group
for (int i = 0; i < 4; ++i)
for (int j = 0; j < rows * cols; ++j)
@@ -5,7 +5,7 @@
#include "util/static_graph.hpp"
#define CHECK_SIZE_RANGE(range, ref) BOOST_CHECK_EQUAL(range.end() - range.begin(), ref)
#define CHECK_SIZE_RANGE(range, ref) BOOST_CHECK_EQUAL((range).end() - (range).begin(), ref)
#define CHECK_EQUAL_RANGE(range, ref) \
do \
{ \
+1 -1
View File
@@ -17,7 +17,7 @@
#include <boost/test/unit_test.hpp>
#define CHECK_EQUAL_RANGE(R1, R2) \
BOOST_CHECK_EQUAL_COLLECTIONS(R1.begin(), R1.end(), R2.begin(), R2.end());
BOOST_CHECK_EQUAL_COLLECTIONS((R1).begin(), (R1).end(), (R2).begin(), (R2).end());
BOOST_AUTO_TEST_SUITE(api_parameters_parser)
+1 -1
View File
@@ -23,7 +23,7 @@ std::ostream &operator<<(std::ostream &out, const osrm::server::api::ParsedURL &
#include <boost/test/unit_test.hpp>
#define CHECK_EQUAL_RANGE(R1, R2) \
BOOST_CHECK_EQUAL_COLLECTIONS(R1.begin(), R1.end(), R2.begin(), R2.end());
BOOST_CHECK_EQUAL_COLLECTIONS((R1).begin(), (R1).end(), (R2).begin(), (R2).end());
BOOST_AUTO_TEST_SUITE(api_url_parser)