Skip to content

Commit 0f95852

Browse files
committed
Add the second-degree polynomial test for the new SMT backend.
1 parent b98515a commit 0f95852

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <stdbool.h>
2+
3+
int main()
4+
{
5+
int x;
6+
__CPROVER_assume(x < 100);
7+
__CPROVER_assume(x > -100);
8+
bool quadratic_solved = (x + 8) * (x - 42) == 0;
9+
10+
if(x < 0)
11+
__CPROVER_assert(!quadratic_solved, "No negative solution");
12+
else
13+
__CPROVER_assert(!quadratic_solved, "No positive solution");
14+
15+
return 0;
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CORE
2+
polynomial.c
3+
--incremental-smt2-solver 'z3 --smt2 -in' --trace
4+
\[main\.assertion\.1\] line \d+ No negative solution: FAILURE
5+
\[main\.assertion\.2\] line \d+ No positive solution: FAILURE
6+
x=-8\ \(11111111 11111111 11111111 11111000\)
7+
x=42\ \(00000000 00000000 00000000 00101010\)
8+
^VERIFICATION FAILED$
9+
^EXIT=10$
10+
^SIGNAL=0$
11+
--
12+
--
13+
This is an end-to-end test making sure that CBMC has encoded
14+
the problem and sent it to the SMT solver, and we manage to
15+
get the solutions to the polynomial back through the trace.

0 commit comments

Comments
 (0)