Skip to content

Commit a638644

Browse files
committed
Test support for incremental SMT traces containing C_bool
1 parent 7b288c0 commit a638644

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE
2+
stdbool_example.c
3+
--incremental-smt2-solver 'z3 --smt2 -in' --trace
4+
Passing problem to incremental SMT2 solving via "z3 --smt2 -in"
5+
VERIFICATION FAILED
6+
equal=FALSE\s*\([0 ]+\)
7+
equal=TRUE\s*\([0 ]+1\)
8+
^EXIT=10$
9+
^SIGNAL=0$
10+
--
11+
--
12+
Test that running cbmc with the `--incremental-smt2-solver` argument can be used
13+
to generate a trace including values of C bool variables.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <stdbool.h>
2+
3+
int main()
4+
{
5+
int x, y;
6+
bool equal = x == y;
7+
__CPROVER_assert(equal, "Assert of integer equality.");
8+
__CPROVER_assert(!equal, "Assert of not integer equality.");
9+
return 0;
10+
}

unit/solvers/smt2_incremental/construct_value_expr_from_smt.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <util/arith_tools.h>
44
#include <util/bitvector_types.h>
5+
#include <util/c_types.h>
56
#include <util/mp_arith.h>
67
#include <util/std_expr.h>
78
#include <util/std_types.h>
@@ -65,6 +66,8 @@ TEST_CASE("Value expr construction from smt.", "[core][smt2_incremental]")
6566
std::tie(input_term, expected_result) = GENERATE(
6667
rowt{smt_bool_literal_termt{true}, true_exprt{}},
6768
rowt{smt_bool_literal_termt{false}, false_exprt{}},
69+
rowt{smt_bit_vector_constant_termt{0, 8}, from_integer(0, c_bool_typet(8))},
70+
rowt{smt_bit_vector_constant_termt{1, 8}, from_integer(1, c_bool_typet(8))},
6871
UNSIGNED_BIT_VECTOR_TESTS(8),
6972
SIGNED_BIT_VECTOR_TESTS(8),
7073
UNSIGNED_BIT_VECTOR_TESTS(16),

0 commit comments

Comments
 (0)