mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-07 13:03:54 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -36,10 +36,8 @@ UNIT_TEST(Kml_MinzoomQuadtree_PopulationGrowthRate)
|
||||
size_t const kMaxDepth = 5;
|
||||
double const step = 1.0 / (1 << kMaxDepth);
|
||||
for (int x = 0; x < (1 << kMaxDepth); ++x)
|
||||
{
|
||||
for (int y = 0; y < (1 << kMaxDepth); ++y)
|
||||
minZoomQuadtree.Add(MakeGlobalPoint((0.5 + x) * step, (0.5 + y) * step), 0.0 /* rank */);
|
||||
}
|
||||
double const kCountPerTile = 1.0;
|
||||
std::map<int /* zoom */, size_t> populationCount;
|
||||
auto const incZoomPopulation = [&](double & rank, int zoom)
|
||||
@@ -59,16 +57,13 @@ UNIT_TEST(Kml_MinzoomQuadtree_PopulationGrowthRate)
|
||||
TEST_EQUAL(partialSums.front(), 1, ());
|
||||
TEST_EQUAL(partialSums.back(), (1 << (kMaxDepth * 2)), ());
|
||||
auto const isGrowthExponential = [](size_t lhs, size_t rhs) { return rhs != 4 * lhs; };
|
||||
TEST(std::adjacent_find(partialSums.cbegin(), partialSums.cend(), isGrowthExponential) ==
|
||||
partialSums.cend(), (partialSums));
|
||||
TEST(std::adjacent_find(partialSums.cbegin(), partialSums.cend(), isGrowthExponential) == partialSums.cend(),
|
||||
(partialSums));
|
||||
}
|
||||
|
||||
std::mt19937 g(0);
|
||||
|
||||
auto const gen = [&g]
|
||||
{
|
||||
return std::generate_canonical<double, std::numeric_limits<uint32_t>::digits>(g);
|
||||
};
|
||||
auto const gen = [&g] { return std::generate_canonical<double, std::numeric_limits<uint32_t>::digits>(g); };
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
@@ -100,7 +95,8 @@ UNIT_TEST(Kml_MinzoomQuadtree_PopulationGrowthRate)
|
||||
for (size_t i = 0; i < partialSums.size(); ++i)
|
||||
{
|
||||
auto const maxAbsErr = 4.0 * std::ceil(std::sqrt(kCountPerTile * areaScale)) + 4.0;
|
||||
TEST_LESS_OR_EQUAL(partialSums[i], kCountPerTile * areaScale + maxAbsErr, (kCountPerTile, maxAbsErr, partialSums));
|
||||
TEST_LESS_OR_EQUAL(partialSums[i], kCountPerTile * areaScale + maxAbsErr,
|
||||
(kCountPerTile, maxAbsErr, partialSums));
|
||||
areaScale *= 4.0;
|
||||
}
|
||||
}
|
||||
@@ -123,10 +119,7 @@ UNIT_TEST(Kml_MinzoomQuadtree_CornerCases)
|
||||
{
|
||||
kml::MinZoomQuadtree<double /* rank */, std::less<double>> minZoomQuadtree{{} /* less */};
|
||||
double const kCountPerTile = 100.0;
|
||||
auto const unreachable = [&](double & /* rank */, int /* zoom */)
|
||||
{
|
||||
TEST(false, ());
|
||||
};
|
||||
auto const unreachable = [&](double & /* rank */, int /* zoom */) { TEST(false, ()); };
|
||||
minZoomQuadtree.SetMinZoom(kCountPerTile, scales::GetUpperStyleScale(), unreachable);
|
||||
}
|
||||
}
|
||||
@@ -137,10 +130,8 @@ UNIT_TEST(Kml_MinzoomQuadtree_MaxZoom)
|
||||
size_t const kMaxDepth = 5;
|
||||
double const step = 1.0 / (1 << kMaxDepth);
|
||||
for (int x = 0; x < (1 << kMaxDepth); ++x)
|
||||
{
|
||||
for (int y = 0; y < (1 << kMaxDepth); ++y)
|
||||
minZoomQuadtree.Add(MakeGlobalPoint((0.5 + x) * step, (0.5 + y) * step), 0.0 /* rank */);
|
||||
}
|
||||
double const kCountPerTile = 1.0;
|
||||
std::map<int /* zoom */, size_t> populationCount;
|
||||
auto const incZoomPopulation = [&](double & rank, int zoom)
|
||||
@@ -162,6 +153,7 @@ UNIT_TEST(Kml_MinzoomQuadtree_MaxZoom)
|
||||
TEST_EQUAL(partialSums.back(), (1 << (kMaxDepth * 2)), ());
|
||||
auto const isGrowthExponential = [](size_t lhs, size_t rhs) { return rhs != 4 * lhs; };
|
||||
TEST(std::adjacent_find(partialSums.cbegin(), std::prev(partialSums.cend()), isGrowthExponential) ==
|
||||
std::prev(partialSums.cend()), (partialSums));
|
||||
std::prev(partialSums.cend()),
|
||||
(partialSums));
|
||||
TEST_LESS_OR_EQUAL(4 * *std::prev(partialSums.cend(), 2), partialSums.back(), ());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user