Skip to content

Commit c35044e

Browse files
authored
Merge pull request #527 from ValeevGroup/evaleev/fix/retile_more
[unit] fix `retile_suite/retile_more`
2 parents d53c40a + 4da4757 commit c35044e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/retile.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,19 @@ BOOST_AUTO_TEST_CASE(retile_more) {
7272
auto arr_target0 = TA::retile(arr_source0, tr_target);
7373

7474
auto get_elem = [](auto const& arr, auto const& eix) {
75+
using element_type = std::decay_t<decltype(arr)>::element_type;
7576
auto tix = arr.trange().element_to_tile(eix);
76-
auto&& tile = arr.find(tix).get(false);
77-
return tile(eix);
77+
if (arr.is_zero(tix))
78+
return element_type{};
79+
else {
80+
auto&& tile = arr.find(tix).get(false);
81+
return tile(eix);
82+
}
7883
};
7984

8085
for (auto&& eix : elem_rng) {
8186
auto tix = arr_source0.trange().element_to_tile(eix);
82-
BOOST_REQUIRE(arr_source0.is_zero(tix) == arr_target0.is_zero(tix));
83-
if (arr_source0.is_zero(tix)) continue;
87+
auto target_tix = arr_target0.trange().element_to_tile(eix);
8488
BOOST_REQUIRE(get_elem(arr_source0, eix) == get_elem(arr_target0, eix));
8589
}
8690

@@ -96,8 +100,6 @@ BOOST_AUTO_TEST_CASE(retile_more) {
96100

97101
for (auto&& eix : elem_rng) {
98102
auto tix = arr_source.trange().element_to_tile(eix);
99-
BOOST_REQUIRE(arr_source.is_zero(tix) == arr_target.is_zero(tix));
100-
if (arr_source.is_zero(tix)) continue;
101103
BOOST_REQUIRE(get_elem(arr_source, eix) == get_elem(arr_target, eix));
102104
}
103105
}

0 commit comments

Comments
 (0)