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