#include "Parser.h"
#include "Utils.h"
#include "mlir/Analysis/Presburger/PresburgerRelation.h"
#include "mlir/IR/MLIRContext.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <optional>
usingnamespacemlir;
usingnamespacepresburger;
static void testUnionAtPoints(const PresburgerSet &s, const PresburgerSet &t,
ArrayRef<SmallVector<int64_t, 4>> points) { … }
static void testIntersectAtPoints(const PresburgerSet &s,
const PresburgerSet &t,
ArrayRef<SmallVector<int64_t, 4>> points) { … }
static void testSubtractAtPoints(const PresburgerSet &s, const PresburgerSet &t,
ArrayRef<SmallVector<int64_t, 4>> points) { … }
static void testComplementAtPoints(const PresburgerSet &s,
ArrayRef<SmallVector<int64_t, 4>> points) { … }
static PresburgerSet makeSetFromPoly(unsigned numDims,
ArrayRef<IntegerPolyhedron> polys) { … }
TEST(SetTest, containsPoint) { … }
TEST(SetTest, Union) { … }
TEST(SetTest, Intersect) { … }
TEST(SetTest, Subtract) { … }
TEST(SetTest, Complement) { … }
TEST(SetTest, isEqual) { … }
void expectEqual(const PresburgerSet &s, const PresburgerSet &t) { … }
void expectEqual(const IntegerPolyhedron &s, const IntegerPolyhedron &t) { … }
void expectEmpty(const PresburgerSet &s) { … }
TEST(SetTest, divisions) { … }
void convertSuffixDimsToLocals(IntegerPolyhedron &poly, unsigned numLocals) { … }
inline IntegerPolyhedron
parseIntegerPolyhedronAndMakeLocals(StringRef str, unsigned numLocals) { … }
TEST(SetTest, divisionsDefByEq) { … }
TEST(SetTest, divisionNonDivLocals) { … }
TEST(SetTest, subtractDuplicateDivsRegression) { … }
void expectCoalesce(size_t expectedNumPoly, const PresburgerSet &set) { … }
TEST(SetTest, coalesceNoPoly) { … }
TEST(SetTest, coalesceContainedOneDim) { … }
TEST(SetTest, coalesceFirstEmpty) { … }
TEST(SetTest, coalesceSecondEmpty) { … }
TEST(SetTest, coalesceBothEmpty) { … }
TEST(SetTest, coalesceFirstUniv) { … }
TEST(SetTest, coalesceSecondUniv) { … }
TEST(SetTest, coalesceBothUniv) { … }
TEST(SetTest, coalesceFirstUnivSecondEmpty) { … }
TEST(SetTest, coalesceFirstEmptySecondUniv) { … }
TEST(SetTest, coalesceCutOneDim) { … }
TEST(SetTest, coalesceSeparateOneDim) { … }
TEST(SetTest, coalesceAdjEq) { … }
TEST(SetTest, coalesceContainedTwoDim) { … }
TEST(SetTest, coalesceCutTwoDim) { … }
TEST(SetTest, coalesceEqStickingOut) { … }
TEST(SetTest, coalesceSeparateTwoDim) { … }
TEST(SetTest, coalesceContainedEq) { … }
TEST(SetTest, coalesceCuttingEq) { … }
TEST(SetTest, coalesceSeparateEq) { … }
TEST(SetTest, coalesceContainedEqAsIneq) { … }
TEST(SetTest, coalesceContainedEqComplex) { … }
TEST(SetTest, coalesceThreeContained) { … }
TEST(SetTest, coalesceDoubleIncrement) { … }
TEST(SetTest, coalesceLastCoalesced) { … }
TEST(SetTest, coalesceDiv) { … }
TEST(SetTest, coalesceDivOtherContained) { … }
static void
expectComputedVolumeIsValidOverapprox(const PresburgerSet &set,
std::optional<int64_t> trueVolume,
std::optional<int64_t> resultBound) { … }
TEST(SetTest, computeVolume) { … }
void testComputeReprAtPoints(IntegerPolyhedron poly,
ArrayRef<SmallVector<int64_t, 4>> points,
unsigned numToProject) { … }
void testComputeRepr(IntegerPolyhedron poly, const PresburgerSet &expected,
unsigned numToProject) { … }
TEST(SetTest, computeReprWithOnlyDivLocals) { … }
TEST(SetTest, subtractOutputSizeRegression) { … }