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

@@ -15,7 +15,12 @@
namespace cluster_finder_tests
{
enum class Type { T1 = 1, T2, T3 };
enum class Type
{
T1 = 1,
T2,
T3
};
std::string DebugPrint(Type const & t)
{
@@ -25,7 +30,10 @@ std::string DebugPrint(Type const & t)
struct NamedPoint
{
NamedPoint(m2::PointD const & point, Type const & type, std::string const & name)
: m_point(point), m_type(type), m_name(name) {}
: m_point(point)
, m_type(type)
, m_name(name)
{}
size_t m_id = m_counter++;
m2::PointD m_point;
@@ -55,7 +63,8 @@ std::string DebugPrint(NamedPoint const & t)
auto const getRadiusMFunction = [](NamedPoint const & p)
{
switch (p.m_type) {
switch (p.m_type)
{
case Type::T1: return 4000;
case Type::T2: return 8000;
case Type::T3: return 16000;
@@ -64,21 +73,14 @@ auto const getRadiusMFunction = [](NamedPoint const & p)
};
auto const isSameFunction = [](NamedPoint const & left, NamedPoint const & right)
{
return left.m_name == right.m_name && left.m_type == right.m_type;
};
{ return left.m_name == right.m_name && left.m_type == right.m_type; };
using ClusterT = std::vector<NamedPoint const *>;
void Sort(std::vector<ClusterT> & data)
{
for (auto & d : data)
{
std::sort(std::begin(d), std::end(d), [](NamedPoint const * l, NamedPoint const * r)
{
return l->m_id < r->m_id;
});
}
std::sort(std::begin(d), std::end(d), [](NamedPoint const * l, NamedPoint const * r) { return l->m_id < r->m_id; });
std::sort(std::begin(data), std::end(data), [](ClusterT const & l, ClusterT const & r)
{
TEST(!l.empty(), ());
@@ -111,10 +113,7 @@ UNIT_TEST(ClustersFinder_OneElement)
UNIT_TEST(ClustersFinder_TwoElements)
{
std::vector<NamedPoint> in{
NamedPoint({0.0, 0.0}, Type::T1, "name"),
NamedPoint({0.0001, 0.0001}, Type::T1, "name")
};
std::vector<NamedPoint> in{NamedPoint({0.0, 0.0}, Type::T1, "name"), NamedPoint({0.0001, 0.0001}, Type::T1, "name")};
std::vector<ClusterT> expected{{&in[0], &in[1]}};
Test(in, expected);
@@ -123,19 +122,14 @@ UNIT_TEST(ClustersFinder_TwoElements)
UNIT_TEST(ClustersFinder_TwoClusters)
{
{
std::vector<NamedPoint> in{
NamedPoint({0.0, 0.0}, Type::T1, "name1"),
NamedPoint({0.0001, 0.0001}, Type::T1, "name2")
};
std::vector<NamedPoint> in{NamedPoint({0.0, 0.0}, Type::T1, "name1"),
NamedPoint({0.0001, 0.0001}, Type::T1, "name2")};
std::vector<ClusterT> expected{{&in[1]}, {&in[0]}};
Test(in, expected);
}
{
std::vector<NamedPoint> in{
NamedPoint({0.0, 0.0}, Type::T1, "name"),
NamedPoint({0.1, 0.1}, Type::T1, "name")
};
std::vector<NamedPoint> in{NamedPoint({0.0, 0.0}, Type::T1, "name"), NamedPoint({0.1, 0.1}, Type::T1, "name")};
std::vector<ClusterT> expected{{&in[0]}, {&in[1]}};
Test(in, expected);
@@ -145,16 +139,13 @@ UNIT_TEST(ClustersFinder_TwoClusters)
UNIT_TEST(ClustersFinder_ThreeClusters)
{
std::vector<NamedPoint> in{
NamedPoint({0.0, 0.0}, Type::T1, "name"),
NamedPoint({0.0, 0.00001}, Type::T1, "name"),
NamedPoint({0.0001, 0.0000}, Type::T1, "name"),
NamedPoint({0.0, 0.0}, Type::T1, "name"), NamedPoint({0.0, 0.00001}, Type::T1, "name"),
NamedPoint({0.0001, 0.0000}, Type::T1, "name"),
NamedPoint({0.0, 0.0}, Type::T2, "name"),
NamedPoint({0.0, 0.001}, Type::T2, "name"),
NamedPoint({0.001, 0.0000}, Type::T2, "name"),
NamedPoint({0.0, 0.0}, Type::T2, "name"), NamedPoint({0.0, 0.001}, Type::T2, "name"),
NamedPoint({0.001, 0.0000}, Type::T2, "name"),
NamedPoint({0.0, 0.0}, Type::T1, "name21")
};
NamedPoint({0.0, 0.0}, Type::T1, "name21")};
std::vector<ClusterT> expected{{&in[1], &in[0], &in[2]}, {&in[3], &in[5], &in[4]}, {&in[6]}};
Test(in, expected);