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