Format all C++ and Java code via clang-format

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-17 14:32:37 +07:00
parent 9f0290c0ec
commit bfffa1fff4
2169 changed files with 56441 additions and 64188 deletions

View File

@@ -2,15 +2,14 @@
#include "testing/testing.hpp"
#include "geometry/rect_intersect.hpp"
#include "geometry/angles.hpp"
#include "geometry/rect_intersect.hpp"
using namespace test;
namespace
{
typedef m2::PointD P;
typedef m2::PointD P;
}
m2::PointD get_point(m2::RectD const & r, int ind)
@@ -21,9 +20,7 @@ m2::PointD get_point(m2::RectD const & r, int ind)
case 1: return r.LeftTop();
case 2: return r.RightTop();
case 3: return r.RightBottom();
default:
ASSERT ( false, () );
return m2::PointD();
default: ASSERT(false, ()); return m2::PointD();
}
}
@@ -31,14 +28,16 @@ void make_section_longer(m2::PointD & p1, m2::PointD & p2, double sm)
{
if (p1.x == p2.x)
{
if (p1.y > p2.y) sm = -sm;
if (p1.y > p2.y)
sm = -sm;
p1.y -= sm;
p2.y += sm;
}
else if (p1.y == p2.y)
{
if (p1.x > p2.x) sm = -sm;
if (p1.x > p2.x)
sm = -sm;
p1.x -= sm;
p2.x += sm;
@@ -74,8 +73,8 @@ void check_intersect_boundaries(m2::RectD const & r)
{
for (int i = 0; i < 4; ++i)
{
check_full_equal(r, get_point(r, i), get_point(r, i+1), strict_equal());
check_inside(r, get_point(r, i), get_point(r, i+1));
check_full_equal(r, get_point(r, i), get_point(r, i + 1), strict_equal());
check_inside(r, get_point(r, i), get_point(r, i + 1));
}
}
@@ -83,8 +82,8 @@ void check_intersect_diagonal(m2::RectD const & r)
{
for (int i = 0; i < 4; ++i)
{
check_full_equal(r, get_point(r, i), get_point(r, i+2), epsilon_equal());
check_inside(r, get_point(r, i), get_point(r, i+2));
check_full_equal(r, get_point(r, i), get_point(r, i + 2), epsilon_equal());
check_inside(r, get_point(r, i), get_point(r, i + 2));
}
}
@@ -92,8 +91,8 @@ void check_sides(m2::RectD const & r)
{
for (int i = 0; i < 4; ++i)
{
m2::PointD p1 = (get_point(r, i) + get_point(r, i+1)) / 2.0;
m2::PointD p2 = (get_point(r, i + 2) + get_point(r, i+3)) / 2.0;
m2::PointD p1 = (get_point(r, i) + get_point(r, i + 1)) / 2.0;
m2::PointD p2 = (get_point(r, i + 2) + get_point(r, i + 3)) / 2.0;
check_full_equal(r, p1, p2, strict_equal());
check_inside(r, p1, p2);
}
@@ -107,7 +106,7 @@ void check_eps_boundaries(m2::RectD const & r, double eps = 1.0E-6)
for (int i = 0; i < 4; ++i)
{
m2::PointD p1 = get_point(rr, i);
m2::PointD p2 = get_point(rr, i+1);
m2::PointD p2 = get_point(rr, i + 1);
TEST(!m2::Intersect(r, p1, p2), ());
}
@@ -116,7 +115,7 @@ void check_eps_boundaries(m2::RectD const & r, double eps = 1.0E-6)
rr.Inflate(-eps, -eps);
for (int i = 0; i < 4; ++i)
check_inside(r, get_point(rr, i), get_point(rr, i+1));
check_inside(r, get_point(rr, i), get_point(rr, i + 1));
}
UNIT_TEST(IntersectRect_Section)
@@ -130,15 +129,15 @@ UNIT_TEST(IntersectRect_Section)
namespace
{
void check_point_in_rect(m2::RectD const & r, m2::PointD const & p)
{
m2::PointD p1 = p;
m2::PointD p2 = p;
void check_point_in_rect(m2::RectD const & r, m2::PointD const & p)
{
m2::PointD p1 = p;
m2::PointD p2 = p;
TEST(m2::Intersect(r, p1, p2), ());
TEST(p == p1 && p == p2, ());
}
TEST(m2::Intersect(r, p1, p2), ());
TEST(p == p1 && p == p2, ());
}
} // namespace
UNIT_TEST(IntersectRect_Point)
{
@@ -147,14 +146,14 @@ UNIT_TEST(IntersectRect_Point)
for (int i = 0; i < 4; ++i)
{
check_point_in_rect(r, get_point(r, i));
check_point_in_rect(r, (get_point(r, i) + get_point(r, i+1)) / 2.0);
check_point_in_rect(r, (get_point(r, i) + get_point(r, i + 1)) / 2.0);
}
}
{
m2::RectD r(-1000, -1000, 1000, 1000);
double const eps = 1.0E-6;
P sm[] = { P(-eps, -eps), P(-eps, eps), P(eps, eps), P(eps, -eps) };
P sm[] = {P(-eps, -eps), P(-eps, eps), P(eps, eps), P(eps, -eps)};
for (int i = 0; i < 4; ++i)
{
P p1 = get_point(r, i);