llvm/mlir/unittests/Analysis/Presburger/Utils.h

//===- Utils.h - Utils for Presburger Tests ---------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines helper functions for Presburger unittests.
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_UNITTESTS_ANALYSIS_PRESBURGER_UTILS_H
#define MLIR_UNITTESTS_ANALYSIS_PRESBURGER_UTILS_H

#include "mlir/Analysis/Presburger/GeneratingFunction.h"
#include "mlir/Analysis/Presburger/IntegerRelation.h"
#include "mlir/Analysis/Presburger/Matrix.h"
#include "mlir/Analysis/Presburger/QuasiPolynomial.h"

#include <gtest/gtest.h>
#include <optional>

namespace mlir {
namespace presburger {
dynamicAPIntFromInt64;

inline IntMatrix makeIntMatrix(unsigned numRow, unsigned numColumns,
                               ArrayRef<SmallVector<int, 8>> matrix) {}

inline FracMatrix makeFracMatrix(unsigned numRow, unsigned numColumns,
                                 ArrayRef<SmallVector<Fraction, 8>> matrix) {}

inline void EXPECT_EQ_INT_MATRIX(IntMatrix a, IntMatrix b) {}

inline void EXPECT_EQ_FRAC_MATRIX(FracMatrix a, FracMatrix b) {}

// Check the coefficients (in order) of two generating functions.
// Note that this is not a true equality check.
inline void EXPECT_EQ_REPR_GENERATINGFUNCTION(detail::GeneratingFunction a,
                                              detail::GeneratingFunction b) {}

// Check the coefficients (in order) of two quasipolynomials.
// Note that this is not a true equality check.
inline void EXPECT_EQ_REPR_QUASIPOLYNOMIAL(QuasiPolynomial a,
                                           QuasiPolynomial b) {}

/// lhs and rhs represent non-negative integers or positive infinity. The
/// infinity case corresponds to when the Optional is empty.
inline bool infinityOrUInt64LE(std::optional<DynamicAPInt> lhs,
                               std::optional<DynamicAPInt> rhs) {}

/// Expect that the computed volume is a valid overapproximation of
/// the true volume `trueVolume`, while also being at least as good an
/// approximation as `resultBound`.
inline void expectComputedVolumeIsValidOverapprox(
    const std::optional<DynamicAPInt> &computedVolume,
    const std::optional<DynamicAPInt> &trueVolume,
    const std::optional<DynamicAPInt> &resultBound) {}

inline void expectComputedVolumeIsValidOverapprox(
    const std::optional<DynamicAPInt> &computedVolume,
    std::optional<int64_t> trueVolume, std::optional<int64_t> resultBound) {}

} // namespace presburger
} // namespace mlir

#endif // MLIR_UNITTESTS_ANALYSIS_PRESBURGER_UTILS_H