Skip to content

Commit

Permalink
less this
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasaunai committed Nov 9, 2024
1 parent 80c5501 commit 34f4111
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions tests/core/data/tiles/test_tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = Box<int, this->dimension>{tile.lower, tile.upper};
auto const box2 = Box<int, this->dimension>{other.lower, other.upper};
auto const box1 = Box<int, dim>{tile.lower, tile.upper};
auto const box2 = Box<int, dim>{other.lower, other.upper};
auto overlap = box1 * box2;
EXPECT_FALSE(overlap.has_value());
}
Expand All @@ -126,8 +127,8 @@ TYPED_TEST(TileTestBoxShapeNotMultipleTileSize, tileHasNoOverlapWithOthers)

TYPED_TEST(TileTestBoxShapeNotMultipleTileSize, retrieveTilesFromBoxOverlap)
{
Box<int, this->dimension> selection_box{ConstArray<int, this->dimension>(11),
ConstArray<int, this->dimension>(34)};
auto constexpr dim = TypeParam::dimension;
Box<int, dim> selection_box{ConstArray<int, dim>(11), ConstArray<int, dim>(34)};

auto expected_nbr = std::pow(7, this->dimension);
auto overlapeds = this->tileSet.export_overlaped_with(selection_box);
Expand All @@ -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));
}


Expand All @@ -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 = Box<int, this->dimension>{ConstArray<int, this->dimension>(12),
ConstArray<int, this->dimension>(15)};
auto const expected_box = Box<int, dim>{ConstArray<int, dim>(12), ConstArray<int, dim>(15)};
EXPECT_TRUE(*tile == expected_box);
}

Expand Down

0 comments on commit 34f4111

Please sign in to comment.