From 34f4111900e43f3a1a79664a9b31df152bdc5ba6 Mon Sep 17 00:00:00 2001 From: Nicolas Aunai Date: Sat, 9 Nov 2024 14:27:29 +0100 Subject: [PATCH] less this --- tests/core/data/tiles/test_tile.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/core/data/tiles/test_tile.cpp b/tests/core/data/tiles/test_tile.cpp index 8890c7209..c38d14331 100644 --- a/tests/core/data/tiles/test_tile.cpp +++ b/tests/core/data/tiles/test_tile.cpp @@ -108,14 +108,15 @@ TYPED_TEST(TileTestBoxShapeNotMultipleTileSize, totalTileSetSurfaceIsEqualToBoxS TYPED_TEST(TileTestBoxShapeNotMultipleTileSize, tileHasNoOverlapWithOthers) { + auto constexpr dim = TypeParam::dimension; for (auto const& tile : this->tileSet) { for (auto const& other : this->tileSet) { if (&tile != &other) { - auto const box1 = Boxdimension>{tile.lower, tile.upper}; - auto const box2 = Boxdimension>{other.lower, other.upper}; + auto const box1 = Box{tile.lower, tile.upper}; + auto const box2 = Box{other.lower, other.upper}; auto overlap = box1 * box2; EXPECT_FALSE(overlap.has_value()); } @@ -126,8 +127,8 @@ TYPED_TEST(TileTestBoxShapeNotMultipleTileSize, tileHasNoOverlapWithOthers) TYPED_TEST(TileTestBoxShapeNotMultipleTileSize, retrieveTilesFromBoxOverlap) { - Boxdimension> selection_box{ConstArraydimension>(11), - ConstArraydimension>(34)}; + auto constexpr dim = TypeParam::dimension; + Box selection_box{ConstArray(11), ConstArray(34)}; auto expected_nbr = std::pow(7, this->dimension); auto overlapeds = this->tileSet.export_overlaped_with(selection_box); @@ -143,8 +144,8 @@ TYPED_TEST(TileTestBoxShapeNotMultipleTileSize, retrieveTilesFromBoxOverlap) else ++incompletes; } - EXPECT_EQ(completes, std::pow(5, this->dimension)); - EXPECT_EQ(incompletes, std::pow(7, this->dimension) - std::pow(5, this->dimension)); + EXPECT_EQ(completes, std::pow(5, dim)); + EXPECT_EQ(incompletes, std::pow(7, dim) - std::pow(5, dim)); } @@ -159,16 +160,16 @@ TYPED_TEST(TileTest, cannotCreateTileWithTileSizeBiggerThanBox) TYPED_TEST(TileTestBoxShapeNotMultipleTileSize, canRetrieveTileFromCell) { - auto tile = [&]() { - if constexpr (this->dimension == 1) + auto constexpr dim = TypeParam::dimension; + auto tile = [&]() { + if constexpr (dim == 1) return this->tileSet.at(13); - else if constexpr (this->dimension == 2) + else if constexpr (dim == 2) return this->tileSet.at(13, 13); - else if constexpr (this->dimension == 3) + else if constexpr (dim == 3) return this->tileSet.at(13, 13, 13); }(); - auto const expected_box = Boxdimension>{ConstArraydimension>(12), - ConstArraydimension>(15)}; + auto const expected_box = Box{ConstArray(12), ConstArray(15)}; EXPECT_TRUE(*tile == expected_box); }