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 : : 13 : : #include <cvc5/c/cvc5.h> 14 : : #include <cvc5/c/cvc5_parser.h> 15 : : 16 : : #include <stdio.h> 17 : : #include <assert.h> 18 : : 19 : 1 : int main() 20 : : { 21 : 1 : Cvc5TermManager* tm = cvc5_term_manager_new(); 22 : 1 : Cvc5* slv = cvc5_new(tm); 23 : : 24 : 1 : Cvc5SymbolManager* sm = cvc5_symbol_manager_new(tm); 25 : : 26 : 1 : cvc5_set_logic(slv, "QF_BV"); 27 : : 28 : : // construct an input parser associated the solver above 29 : 1 : Cvc5InputParser* parser = cvc5_parser_new(slv, sm); 30 : : 31 : 1 : const char* input1 = "(declare-const x (_ BitVec 4))\n(assert (= x #b0001))\n"; 32 : 1 : cvc5_parser_set_inc_str_input( 33 : : parser, CVC5_INPUT_LANGUAGE_SMT_LIB_2_6, "myInput"); 34 : 1 : cvc5_parser_append_inc_str_input(parser, input1); 35 : : 36 : : // parse commands until finished 37 : : Cvc5Command cmd; 38 : : while (true) 39 : 2 : { 40 : : const char* error_msg; 41 : 3 : cmd = cvc5_parser_next_command(parser, &error_msg); 42 [ + + ]: 3 : if (cmd == NULL) 43 : : { 44 : 1 : break; 45 : : } 46 : 2 : (void)cvc5_cmd_invoke(cmd, slv, sm); 47 : : } 48 : 1 : Cvc5Result result = cvc5_check_sat(slv); 49 : 1 : printf("Result: %s\n", cvc5_result_to_string(result)); 50 : : 51 : 1 : const char* input2 = "(assert (= x #b0101))"; 52 : 1 : cvc5_parser_append_inc_str_input(parser, input2); 53 : : const char* error_msg; 54 : 1 : cmd = cvc5_parser_next_command(parser, &error_msg); 55 [ - + ]: 1 : assert(cmd != NULL); 56 : 1 : (void)cvc5_cmd_invoke(cmd, slv, sm); 57 : 1 : result = cvc5_check_sat(slv); 58 : 1 : printf("Result: %s\n", cvc5_result_to_string(result)); 59 [ - + ]: 1 : assert(cvc5_result_is_unsat(result)); 60 : : 61 : 1 : cvc5_parser_delete(parser); 62 : 1 : cvc5_symbol_manager_delete(sm); 63 : 1 : cvc5_delete(slv); 64 : 1 : cvc5_term_manager_delete(tm); 65 : : 66 : 1 : return 0; 67 : : }