#include "mlir/Analysis/Presburger/Barvinok.h" #include "./Utils.h" #include "Parser.h" #include <gmock/gmock.h> #include <gtest/gtest.h> usingnamespacemlir; usingnamespacepresburger; usingnamespacemlir::presburger::detail; /// The following are 3 randomly generated vectors with 4 /// entries each and define a cone's H-representation /// using these numbers. We check that the dual contains /// the same numbers. /// We do the same in the reverse case. TEST(BarvinokTest, getDual) { … } /// We randomly generate a nxn matrix to use as a cone /// with n inequalities in n variables and check for /// the determinant being equal to the index. TEST(BarvinokTest, getIndex) { … } // The following cones and vertices are randomly generated // (s.t. the cones are unimodular) and the generating functions // are computed. We check that the results contain the correct // matrices. TEST(BarvinokTest, unimodularConeGeneratingFunction) { … } // The following vectors are randomly generated. // We then check that the output of the function has non-zero // dot product with all non-null vectors. TEST(BarvinokTest, getNonOrthogonalVector) { … } // The following polynomials are randomly generated and the // coefficients are computed by hand. // Although the function allows the coefficients of the numerator // to be arbitrary quasipolynomials, we stick to constants for simplicity, // as the relevant arithmetic operations on quasipolynomials // are tested separately. TEST(BarvinokTest, getCoefficientInRationalFunction) { … } TEST(BarvinokTest, computeNumTermsCone) { … } /// We define some simple polyhedra with unimodular tangent cones and verify /// that the returned generating functions correspond to those calculated by /// hand. TEST(BarvinokTest, computeNumTermsPolytope) { … }