2023-10-02 10:51:32 -05:00
|
|
|
/******************************************************************************
|
|
|
|
|
* Top contributors (to current version):
|
2024-03-12 09:35:09 -07:00
|
|
|
* Andrew Reynolds, Aina Niemetz, Mudathir Mohamed
|
2023-10-02 10:51:32 -05:00
|
|
|
*
|
|
|
|
|
* This file is part of the cvc5 project.
|
|
|
|
|
*
|
2025-01-23 09:54:20 -08:00
|
|
|
* Copyright (c) 2009-2025 by the authors listed in the file AUTHORS
|
2023-10-02 10:51:32 -05:00
|
|
|
* in the top-level source directory and their institutional affiliations.
|
|
|
|
|
* All rights reserved. See the file COPYING in the top-level source
|
|
|
|
|
* directory for licensing information.
|
|
|
|
|
* ****************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* Black box testing of cvc5::parser::InputParser SMT-LIbv2 inputs.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <cvc5/cvc5.h>
|
|
|
|
|
#include <cvc5/cvc5_parser.h>
|
|
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
|
|
#include "base/output.h"
|
|
|
|
|
#include "options/base_options.h"
|
|
|
|
|
#include "options/language.h"
|
|
|
|
|
#include "options/options.h"
|
|
|
|
|
#include "test_parser.h"
|
|
|
|
|
|
|
|
|
|
using namespace cvc5::parser;
|
|
|
|
|
|
|
|
|
|
namespace cvc5::internal {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
class TestApiBlackInputParser : public TestParser
|
2023-10-02 10:51:32 -05:00
|
|
|
{
|
|
|
|
|
protected:
|
2024-06-29 13:35:58 -07:00
|
|
|
TestApiBlackInputParser() {}
|
|
|
|
|
virtual ~TestApiBlackInputParser() {}
|
2023-10-02 10:51:32 -05:00
|
|
|
|
|
|
|
|
Command parseLogicCommand(InputParser& p, const std::string& logic)
|
|
|
|
|
{
|
|
|
|
|
p.setIncrementalStringInput(modes::InputLanguage::SMT_LIB_2_6,
|
|
|
|
|
"input_parser_black");
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
ss << "(set-logic " << logic << ")" << std::endl;
|
|
|
|
|
p.appendIncrementalStringInput(ss.str());
|
|
|
|
|
return p.nextCommand();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, constructSymbolManager)
|
2024-06-24 16:19:01 -07:00
|
|
|
{
|
|
|
|
|
(void)SymbolManager(d_tm);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, getSolver)
|
2023-10-02 10:51:32 -05:00
|
|
|
{
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
|
|
|
|
ASSERT_EQ(p.getSolver(), d_solver.get());
|
2023-10-02 10:51:32 -05:00
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, getSymbolManager)
|
2023-10-02 10:51:32 -05:00
|
|
|
{
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
2023-10-02 10:51:32 -05:00
|
|
|
// a symbol manager is allocated
|
|
|
|
|
ASSERT_NE(p.getSymbolManager(), nullptr);
|
|
|
|
|
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p2(d_solver.get(), d_symman.get());
|
2023-10-02 10:51:32 -05:00
|
|
|
ASSERT_EQ(p2.getSymbolManager(), d_symman.get());
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, setFileInput)
|
2023-10-03 19:24:08 -05:00
|
|
|
{
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
2023-10-03 19:24:08 -05:00
|
|
|
ASSERT_THROW(
|
|
|
|
|
p.setFileInput(modes::InputLanguage::SMT_LIB_2_6, "nonexistent.smt2"),
|
|
|
|
|
CVC5ApiException);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, setStreamInput)
|
2023-10-02 10:51:32 -05:00
|
|
|
{
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
2023-10-02 10:51:32 -05:00
|
|
|
std::stringstream ss;
|
|
|
|
|
ss << "(set-logic QF_LIA)" << std::endl;
|
|
|
|
|
ss << "(declare-fun a () Bool)" << std::endl;
|
|
|
|
|
ss << "(declare-fun b () Int)" << std::endl;
|
|
|
|
|
p.setStreamInput(modes::InputLanguage::SMT_LIB_2_6, ss, "input_parser_black");
|
2023-10-03 19:24:08 -05:00
|
|
|
ASSERT_EQ(p.done(), false);
|
2023-10-02 10:51:32 -05:00
|
|
|
Command cmd;
|
|
|
|
|
std::stringstream out;
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
if (cmd.isNull())
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
2023-10-02 10:51:32 -05:00
|
|
|
}
|
2023-10-03 19:24:08 -05:00
|
|
|
ASSERT_EQ(p.done(), true);
|
2023-10-02 10:51:32 -05:00
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, setAndAppendIncrementalStringInput)
|
2023-12-15 13:50:57 -06:00
|
|
|
{
|
|
|
|
|
std::stringstream out;
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
2023-12-15 13:50:57 -06:00
|
|
|
p.setIncrementalStringInput(modes::InputLanguage::SMT_LIB_2_6,
|
|
|
|
|
"input_parser_black");
|
2024-07-09 18:51:41 -07:00
|
|
|
ASSERT_EQ(p.done(), false);
|
2023-12-15 13:50:57 -06:00
|
|
|
Command cmd;
|
|
|
|
|
p.appendIncrementalStringInput("(set-logic ALL)");
|
|
|
|
|
p.appendIncrementalStringInput("(declare-fun a () Bool)");
|
|
|
|
|
p.appendIncrementalStringInput("(declare-fun b () Int)");
|
|
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_NE(cmd.isNull(), true);
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
2023-12-15 13:50:57 -06:00
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_NE(cmd.isNull(), true);
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
2023-12-15 13:50:57 -06:00
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_NE(cmd.isNull(), true);
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
2024-07-09 18:51:41 -07:00
|
|
|
ASSERT_EQ(p.done(), false);
|
|
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_TRUE(cmd.isNull());
|
|
|
|
|
ASSERT_EQ(p.done(), true);
|
2023-12-15 13:50:57 -06:00
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, setAndAppendIncrementalStringInputInterleave)
|
2023-10-02 10:51:32 -05:00
|
|
|
{
|
|
|
|
|
std::stringstream out;
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
2023-10-02 10:51:32 -05:00
|
|
|
p.setIncrementalStringInput(modes::InputLanguage::SMT_LIB_2_6,
|
|
|
|
|
"input_parser_black");
|
2024-07-09 18:51:41 -07:00
|
|
|
ASSERT_EQ(p.done(), false);
|
2023-10-02 10:51:32 -05:00
|
|
|
Command cmd;
|
|
|
|
|
p.appendIncrementalStringInput("(set-logic ALL)");
|
|
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_NE(cmd.isNull(), true);
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
2023-10-02 10:51:32 -05:00
|
|
|
p.appendIncrementalStringInput("(declare-fun a () Bool)");
|
|
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_NE(cmd.isNull(), true);
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
2023-10-02 10:51:32 -05:00
|
|
|
p.appendIncrementalStringInput("(declare-fun b () Int)");
|
|
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_NE(cmd.isNull(), true);
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
2024-07-09 18:51:41 -07:00
|
|
|
ASSERT_EQ(p.done(), false);
|
|
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_TRUE(cmd.isNull());
|
|
|
|
|
ASSERT_EQ(p.done(), true);
|
2023-10-02 10:51:32 -05:00
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, appendIncrementalNoSet)
|
2023-12-15 13:50:57 -06:00
|
|
|
{
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
2023-12-15 13:50:57 -06:00
|
|
|
ASSERT_THROW(p.appendIncrementalStringInput("(set-logic ALL)"),
|
|
|
|
|
CVC5ApiException);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, setStringInput)
|
2023-12-15 13:50:57 -06:00
|
|
|
{
|
|
|
|
|
std::stringstream out;
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
2023-12-15 13:50:57 -06:00
|
|
|
Command cmd;
|
|
|
|
|
p.setStringInput(modes::InputLanguage::SMT_LIB_2_6,
|
|
|
|
|
"(set-logic ALL)",
|
|
|
|
|
"input_parser_black");
|
|
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_NE(cmd.isNull(), true);
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
2023-12-15 13:50:57 -06:00
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_EQ(cmd.isNull(), true);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, nextCommand)
|
2023-10-02 10:51:32 -05:00
|
|
|
{
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
2023-10-02 10:51:32 -05:00
|
|
|
ASSERT_THROW(p.nextCommand(), CVC5ApiException);
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
p.setStreamInput(modes::InputLanguage::SMT_LIB_2_6, ss, "input_parser_black");
|
|
|
|
|
Command cmd = p.nextCommand();
|
|
|
|
|
ASSERT_EQ(cmd.isNull(), true);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, nextCommandNoInput)
|
2023-12-15 13:50:57 -06:00
|
|
|
{
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
2023-12-15 13:50:57 -06:00
|
|
|
p.setIncrementalStringInput(modes::InputLanguage::SMT_LIB_2_6,
|
|
|
|
|
"input_parser_black");
|
|
|
|
|
Command cmd = p.nextCommand();
|
|
|
|
|
ASSERT_EQ(cmd.isNull(), true);
|
|
|
|
|
Term t = p.nextTerm();
|
|
|
|
|
ASSERT_EQ(t.isNull(), true);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, nextTerm)
|
2023-10-02 10:51:32 -05:00
|
|
|
{
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get());
|
2023-10-02 10:51:32 -05:00
|
|
|
ASSERT_THROW(p.nextTerm(), CVC5ApiException);
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
p.setStreamInput(modes::InputLanguage::SMT_LIB_2_6, ss, "input_parser_black");
|
|
|
|
|
ASSERT_EQ(p.nextTerm().isNull(), true);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, nextTerm2)
|
2023-10-02 10:51:32 -05:00
|
|
|
{
|
|
|
|
|
std::stringstream out;
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get(), d_symman.get());
|
2023-10-02 10:51:32 -05:00
|
|
|
p.setIncrementalStringInput(modes::InputLanguage::SMT_LIB_2_6,
|
|
|
|
|
"input_parser_black");
|
|
|
|
|
// parse a declaration command
|
2023-12-15 13:50:57 -06:00
|
|
|
p.appendIncrementalStringInput("(declare-fun a () Int)\n");
|
2023-10-02 10:51:32 -05:00
|
|
|
Command cmd = p.nextCommand();
|
|
|
|
|
ASSERT_NE(cmd.isNull(), true);
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
2023-10-02 10:51:32 -05:00
|
|
|
// now parse some terms
|
|
|
|
|
Term t;
|
2023-12-15 13:50:57 -06:00
|
|
|
p.appendIncrementalStringInput("45\n");
|
2023-10-02 10:51:32 -05:00
|
|
|
ASSERT_NO_THROW(t = p.nextTerm());
|
|
|
|
|
ASSERT_EQ(t.isNull(), false);
|
2023-12-15 13:50:57 -06:00
|
|
|
p.appendIncrementalStringInput("(+ a 1)\n");
|
2023-10-02 10:51:32 -05:00
|
|
|
ASSERT_NO_THROW(t = p.nextTerm());
|
|
|
|
|
ASSERT_EQ(t.isNull(), false);
|
|
|
|
|
ASSERT_EQ(t.getKind(), Kind::ADD);
|
2023-12-15 13:50:57 -06:00
|
|
|
p.appendIncrementalStringInput("(+ b 1)\n");
|
2023-10-02 10:51:32 -05:00
|
|
|
ASSERT_THROW(t = p.nextTerm(), ParserException);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, multipleParsers)
|
2023-10-02 10:51:32 -05:00
|
|
|
{
|
|
|
|
|
std::stringstream out;
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get(), d_symman.get());
|
2023-10-02 10:51:32 -05:00
|
|
|
// set a logic for the parser
|
|
|
|
|
Command cmd = parseLogicCommand(p, "QF_LIA");
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
|
|
|
|
ASSERT_EQ(d_solver->isLogicSet(), true);
|
|
|
|
|
ASSERT_EQ(d_solver->getLogic(), "QF_LIA");
|
2023-10-02 10:51:32 -05:00
|
|
|
ASSERT_EQ(d_symman->isLogicSet(), true);
|
|
|
|
|
ASSERT_EQ(d_symman->getLogic(), "QF_LIA");
|
|
|
|
|
// cannot set logic on solver now
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_THROW(d_solver->setLogic("QF_LRA"), CVC5ApiException);
|
2023-10-02 10:51:32 -05:00
|
|
|
|
|
|
|
|
// possible to construct another parser with the same solver and symbol
|
|
|
|
|
// manager
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p2(d_solver.get(), p.getSymbolManager());
|
2023-10-02 10:51:32 -05:00
|
|
|
|
|
|
|
|
// possible to construct another parser with a fresh solver
|
2024-03-08 11:39:13 -08:00
|
|
|
Solver s2(d_tm);
|
2023-10-02 10:51:32 -05:00
|
|
|
InputParser p3(&s2, d_symman.get());
|
|
|
|
|
p3.setIncrementalStringInput(modes::InputLanguage::SMT_LIB_2_6,
|
|
|
|
|
"input_parser_black");
|
|
|
|
|
// logic is automatically set on the solver
|
|
|
|
|
ASSERT_EQ(s2.isLogicSet(), true);
|
|
|
|
|
ASSERT_EQ(s2.getLogic(), "QF_LIA");
|
|
|
|
|
// we cannot set the logic since it has already been set
|
|
|
|
|
ASSERT_THROW(parseLogicCommand(p3, "QF_LRA"), ParserException);
|
|
|
|
|
|
|
|
|
|
// using a solver with the same logic is allowed
|
2024-03-08 11:39:13 -08:00
|
|
|
Solver s3(d_tm);
|
2023-10-02 10:51:32 -05:00
|
|
|
s3.setLogic("QF_LIA");
|
|
|
|
|
InputParser p4(&s3, d_symman.get());
|
|
|
|
|
p4.setIncrementalStringInput(modes::InputLanguage::SMT_LIB_2_6,
|
|
|
|
|
"input_parser_black");
|
|
|
|
|
|
|
|
|
|
// using a solver with a different logic is not allowed
|
2024-03-08 11:39:13 -08:00
|
|
|
Solver s4(d_tm);
|
2023-10-02 10:51:32 -05:00
|
|
|
s4.setLogic("QF_LRA");
|
|
|
|
|
InputParser p5(&s4, d_symman.get());
|
|
|
|
|
ASSERT_THROW(p5.setIncrementalStringInput(modes::InputLanguage::SMT_LIB_2_6,
|
|
|
|
|
"input_parser_black"),
|
|
|
|
|
CVC5ApiException);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, ParserExceptions)
|
2023-12-01 07:02:25 -08:00
|
|
|
{
|
|
|
|
|
ParserException defaultConstructor;
|
|
|
|
|
std::string message = "error";
|
|
|
|
|
const char* cMessage = "error";
|
|
|
|
|
std::string filename = "file.smt2";
|
|
|
|
|
ParserException stringConstructor(message);
|
|
|
|
|
ParserException cStringConstructor(cMessage);
|
|
|
|
|
ParserException exception(message, filename, 10, 11);
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
exception.toStream(ss);
|
|
|
|
|
ASSERT_EQ(message, exception.getMessage());
|
|
|
|
|
ASSERT_EQ(message, exception.getMessage());
|
|
|
|
|
ASSERT_EQ(filename, exception.getFilename());
|
|
|
|
|
ASSERT_EQ(10, exception.getLine());
|
|
|
|
|
ASSERT_EQ(11, exception.getColumn());
|
|
|
|
|
|
|
|
|
|
ParserEndOfFileException eofDefault;
|
2023-12-04 08:32:52 -06:00
|
|
|
ParserEndOfFileException eofString(message);
|
|
|
|
|
ParserEndOfFileException eofCMessage(cMessage);
|
|
|
|
|
ParserEndOfFileException eof(message, filename, 10, 11);
|
2023-12-01 07:02:25 -08:00
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, incrementalSetString)
|
2024-01-11 09:04:20 -06:00
|
|
|
{
|
2024-03-08 11:39:13 -08:00
|
|
|
InputParser p(d_solver.get(), d_symman.get());
|
2024-01-11 09:04:20 -06:00
|
|
|
Command cmd;
|
|
|
|
|
std::stringstream out;
|
2024-06-29 13:35:58 -07:00
|
|
|
std::vector<std::string> strs{"(set-logic ALL)",
|
|
|
|
|
"(push)",
|
|
|
|
|
"(declare-fun x () Int)",
|
|
|
|
|
"(pop)",
|
|
|
|
|
"(declare-fun x () Int)"};
|
|
|
|
|
for (size_t i = 0; i < strs.size(); i++)
|
2024-01-11 09:04:20 -06:00
|
|
|
{
|
2024-06-29 13:35:58 -07:00
|
|
|
p.setStringInput(
|
|
|
|
|
modes::InputLanguage::SMT_LIB_2_6, strs[i], "input_parser_black");
|
2024-01-11 09:04:20 -06:00
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_NE(cmd.isNull(), true);
|
2024-03-08 11:39:13 -08:00
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
2024-01-11 09:04:20 -06:00
|
|
|
}
|
|
|
|
|
ASSERT_EQ(out.str().empty(), true);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 13:35:58 -07:00
|
|
|
TEST_F(TestApiBlackInputParser, getDeclaredTermsAndSorts)
|
2024-03-19 13:39:35 -05:00
|
|
|
{
|
|
|
|
|
InputParser p(d_solver.get(), d_symman.get());
|
|
|
|
|
Command cmd;
|
|
|
|
|
std::stringstream out;
|
|
|
|
|
p.setIncrementalStringInput(modes::InputLanguage::SMT_LIB_2_6,
|
|
|
|
|
"input_parser_black");
|
|
|
|
|
p.appendIncrementalStringInput("(set-logic ALL)");
|
|
|
|
|
p.appendIncrementalStringInput("(declare-sort U 0)");
|
|
|
|
|
p.appendIncrementalStringInput("(declare-fun x () U)");
|
|
|
|
|
for (size_t i = 0; i < 3; i++)
|
|
|
|
|
{
|
|
|
|
|
cmd = p.nextCommand();
|
|
|
|
|
ASSERT_NE(cmd.isNull(), true);
|
|
|
|
|
ASSERT_NO_THROW(cmd.invoke(d_solver.get(), d_symman.get(), out));
|
|
|
|
|
}
|
|
|
|
|
std::vector<Sort> sorts = d_symman->getDeclaredSorts();
|
|
|
|
|
std::vector<Term> terms = d_symman->getDeclaredTerms();
|
|
|
|
|
ASSERT_EQ(sorts.size(), 1);
|
|
|
|
|
ASSERT_EQ(terms.size(), 1);
|
|
|
|
|
ASSERT_EQ(terms[0].getSort(), sorts[0]);
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-02 10:51:32 -05:00
|
|
|
} // namespace test
|
|
|
|
|
} // namespace cvc5::internal
|