| 1 |
#include "polly/Support/ISLTools.h" |
| 2 |
#include "gmock/gmock.h" |
| 3 |
#include "gtest/gtest.h" |
| 4 |
|
| 5 |
namespace isl { |
| 6 |
static bool operator==(const isl::basic_set &A, const isl::basic_set &B) { |
| 7 |
return A.is_equal(B); |
| 8 |
} |
| 9 |
} // namespace isl |
| 10 |
|
| 11 |
TEST(Support, isl_iterator) { |
| 12 |
std::unique_ptr<isl_ctx, decltype(&isl_ctx_free)> RawCtx(isl_ctx_alloc(), |
| 13 |
&isl_ctx_free); |
| 14 |
isl::ctx Ctx(RawCtx.get()); |
| 15 |
|
| 16 |
isl::basic_set A( |
| 17 |
Ctx, "{ [x, y] : 0 <= x <= 5 and y >= 0 and x > 0 and 0 < y <= 5 }"); |
| 18 |
isl::basic_set B( |
| 19 |
Ctx, "{ [x, y] : 0 <= x <= 5 and y >= 0 and x <= 4 and y <= 3 + x }"); |
| 20 |
isl::set S = A.unite(B); |
| 21 |
|
| 22 |
ASSERT_EQ(S.n_basic_set().release(), 2); |
| 23 |
std::vector<isl::basic_set> Sets; |
| 24 |
for (auto BS : S.get_basic_set_list()) |
| 25 |
Sets.push_back(BS); |
| 26 |
EXPECT_THAT(Sets, testing::UnorderedElementsAre(A, B)); |
| 27 |
} |