1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
/******************************************************************************
* Top contributors (to current version):
* Andrew Reynolds
*
* This file is part of the cvc5 project.
*
* Copyright (c) 2009-2025 by the authors listed in the file AUTHORS
* 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.
* ****************************************************************************
*
* Test for issue #11069.
*/
#include <cvc5/cvc5.h>
#include <cvc5/cvc5_parser.h>
#include <cassert>
#include <iostream>
using namespace cvc5;
using namespace cvc5::parser;
int main()
{
TermManager tm;
Solver slv(tm);
SymbolManager sm(tm);
slv.setLogic("QF_BV");
// construct an input parser associated the solver above
InputParser parser(&slv, &sm);
std::string input1("(declare-const x (_ BitVec 4))\n(assert (= x #b0001))\n");
parser.setIncrementalStringInput(modes::InputLanguage::SMT_LIB_2_6,
"myInput");
parser.appendIncrementalStringInput(input1);
// parse commands until finished
Command cmd;
while (true)
{
cmd = parser.nextCommand();
if (cmd.isNull())
{
break;
}
cmd.invoke(&slv, &sm, std::cout);
}
Result result = slv.checkSat();
std::cout << "Result:" << result << std::endl;
std::string input2("(assert (= x #b0101))");
parser.appendIncrementalStringInput(input2);
cmd = parser.nextCommand();
assert(!cmd.isNull());
cmd.invoke(&slv, &sm, std::cout);
result = slv.checkSat();
std::cout << "Result:" << result << std::endl;
assert(result.isUnsat());
return 0;
}
|