#include "Parser.h"
#include "Utils.h"
#include "mlir/Analysis/Presburger/IntegerRelation.h"
#include "mlir/Analysis/Presburger/PWMAFunction.h"
#include "mlir/Analysis/Presburger/Simplex.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <numeric>
#include <optional>
usingnamespacemlir;
usingnamespacepresburger;
ElementsAre;
enum class TestFunction { … };
static IntegerPolyhedron
makeSetFromConstraints(unsigned ids, ArrayRef<SmallVector<int64_t, 4>> ineqs,
ArrayRef<SmallVector<int64_t, 4>> eqs,
unsigned syms = 0) { … }
static void dump(ArrayRef<DynamicAPInt> vec) { … }
static void checkSample(bool hasSample, const IntegerPolyhedron &poly,
TestFunction fn = TestFunction::Sample) { … }
static void checkPermutationsSample(bool hasSample, unsigned nDim,
ArrayRef<SmallVector<int64_t, 4>> ineqs,
ArrayRef<SmallVector<int64_t, 4>> eqs,
TestFunction fn = TestFunction::Sample) { … }
TEST(IntegerPolyhedronTest, removeInequality) { … }
TEST(IntegerPolyhedronTest, removeEquality) { … }
TEST(IntegerPolyhedronTest, clearConstraints) { … }
TEST(IntegerPolyhedronTest, removeIdRange) { … }
TEST(IntegerPolyhedronTest, FindSampleTest) { … }
TEST(IntegerPolyhedronTest, IsIntegerEmptyTest) { … }
TEST(IntegerPolyhedronTest, removeRedundantConstraintsTest) { … }
TEST(IntegerPolyhedronTest, addConstantUpperBound) { … }
TEST(IntegerPolyhedronTest, addConstantLowerBound) { … }
static void checkDivisionRepresentation(
IntegerPolyhedron &poly,
const std::vector<SmallVector<int64_t, 8>> &expectedDividends,
ArrayRef<int64_t> expectedDenominators) { … }
TEST(IntegerPolyhedronTest, computeLocalReprSimple) { … }
TEST(IntegerPolyhedronTest, computeLocalReprConstantFloorDiv) { … }
TEST(IntegerPolyhedronTest, computeLocalReprRecursive) { … }
TEST(IntegerPolyhedronTest, computeLocalReprTightUpperBound) { … }
TEST(IntegerPolyhedronTest, computeLocalReprFromEquality) { … }
TEST(IntegerPolyhedronTest, computeLocalReprFromEqualityAndInequality) { … }
TEST(IntegerPolyhedronTest, computeLocalReprNoRepr) { … }
TEST(IntegerPolyhedronTest, computeLocalReprNegConstNormalize) { … }
TEST(IntegerPolyhedronTest, simplifyLocalsTest) { … }
TEST(IntegerPolyhedronTest, mergeDivisionsSimple) { … }
TEST(IntegerPolyhedronTest, mergeDivisionsNestedDivsions) { … }
TEST(IntegerPolyhedronTest, mergeDivisionsConstants) { … }
TEST(IntegerPolyhedronTest, mergeDivisionsDuplicateInSameSet) { … }
TEST(IntegerPolyhedronTest, negativeDividends) { … }
void expectRationalLexMin(const IntegerPolyhedron &poly,
ArrayRef<Fraction> min) { … }
void expectNoRationalLexMin(OptimumKind kind, const IntegerPolyhedron &poly) { … }
TEST(IntegerPolyhedronTest, findRationalLexMin) { … }
void expectIntegerLexMin(const IntegerPolyhedron &poly, ArrayRef<int64_t> min) { … }
void expectNoIntegerLexMin(OptimumKind kind, const IntegerPolyhedron &poly) { … }
TEST(IntegerPolyhedronTest, findIntegerLexMin) { … }
void expectSymbolicIntegerLexMin(
StringRef polyStr,
ArrayRef<std::pair<StringRef, StringRef>> expectedLexminRepr,
ArrayRef<StringRef> expectedUnboundedDomainRepr) { … }
void expectSymbolicIntegerLexMin(
StringRef polyStr, ArrayRef<std::pair<StringRef, StringRef>> result) { … }
TEST(IntegerPolyhedronTest, findSymbolicIntegerLexMin) { … }
static void
expectComputedVolumeIsValidOverapprox(const IntegerPolyhedron &poly,
std::optional<int64_t> trueVolume,
std::optional<int64_t> resultBound) { … }
TEST(IntegerPolyhedronTest, computeVolume) { … }
bool containsPointNoLocal(const IntegerPolyhedron &poly,
ArrayRef<int64_t> point) { … }
TEST(IntegerPolyhedronTest, containsPointNoLocal) { … }
TEST(IntegerPolyhedronTest, truncateEqualityRegressionTest) { … }