You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
1.3 KiB

2 months ago
  1. #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
  2. #include "doctest.h"
  3. #include "carl-parser/Parser.h"
  4. using namespace carlparser;
  5. TEST_CASE("testing the parse") {
  6. auto res = carlparser::deserialize<carl::MultivariatePolynomial<mpq_class>>("(/ 12 12)");
  7. DOCTEST_CHECK_EQ(check_type(res), carlparser::ParserReturnType::Rational);
  8. res = carlparser::deserialize<carl::MultivariatePolynomial<mpq_class>>("x");
  9. DOCTEST_CHECK_EQ(check_type(res), carlparser::ParserReturnType::Variable);
  10. res = carlparser::deserialize<carl::MultivariatePolynomial<mpq_class>>("-1");
  11. DOCTEST_CHECK_EQ(check_type(res), carlparser::ParserReturnType::Rational);
  12. res = carlparser::deserialize<carl::MultivariatePolynomial<mpq_class>>("(+ x 1)");
  13. DOCTEST_CHECK_EQ(check_type(res), carlparser::ParserReturnType::Polynomial);
  14. res = carlparser::deserialize<carl::MultivariatePolynomial<mpq_class>>("(< x 1)");
  15. DOCTEST_CHECK_EQ(check_type(res), carlparser::ParserReturnType::Constraint);
  16. res = carlparser::deserialize<carl::MultivariatePolynomial<mpq_class>>("(<= (* (- 1) pL) 0)");
  17. DOCTEST_CHECK_EQ(check_type(res), carlparser::ParserReturnType::Constraint);
  18. res = carlparser::deserialize<carl::MultivariatePolynomial<mpq_class>>("(!= pK 0)");
  19. DOCTEST_CHECK_EQ(check_type(res), carlparser::ParserReturnType::Constraint);
  20. }