152025af1SPhilip Pfaffe #include "polly/Support/ISLTools.h"
252025af1SPhilip Pfaffe #include "gmock/gmock.h"
352025af1SPhilip Pfaffe #include "gtest/gtest.h"
452025af1SPhilip Pfaffe
552025af1SPhilip Pfaffe namespace isl {
operator ==(const isl::basic_set & A,const isl::basic_set & B)652025af1SPhilip Pfaffe static bool operator==(const isl::basic_set &A, const isl::basic_set &B) {
752025af1SPhilip Pfaffe return A.is_equal(B);
852025af1SPhilip Pfaffe }
9da82da8aSTobias Grosser } // namespace isl
1052025af1SPhilip Pfaffe
TEST(Support,isl_iterator)1152025af1SPhilip Pfaffe TEST(Support, isl_iterator) {
1252025af1SPhilip Pfaffe std::unique_ptr<isl_ctx, decltype(&isl_ctx_free)> RawCtx(isl_ctx_alloc(),
1352025af1SPhilip Pfaffe &isl_ctx_free);
1452025af1SPhilip Pfaffe isl::ctx Ctx(RawCtx.get());
1552025af1SPhilip Pfaffe
1652025af1SPhilip Pfaffe isl::basic_set A(
1752025af1SPhilip Pfaffe Ctx, "{ [x, y] : 0 <= x <= 5 and y >= 0 and x > 0 and 0 < y <= 5 }");
1852025af1SPhilip Pfaffe isl::basic_set B(
1952025af1SPhilip Pfaffe Ctx, "{ [x, y] : 0 <= x <= 5 and y >= 0 and x <= 4 and y <= 3 + x }");
2052025af1SPhilip Pfaffe isl::set S = A.unite(B);
2152025af1SPhilip Pfaffe
22*d3fdbda6SRiccardo Mori ASSERT_EQ(S.n_basic_set().release(), 2);
2352025af1SPhilip Pfaffe std::vector<isl::basic_set> Sets;
2452025af1SPhilip Pfaffe for (auto BS : S.get_basic_set_list())
2552025af1SPhilip Pfaffe Sets.push_back(BS);
2652025af1SPhilip Pfaffe EXPECT_THAT(Sets, testing::UnorderedElementsAre(A, B));
2752025af1SPhilip Pfaffe }
28