Skip to content

Commit 19b2cae

Browse files
committed
Added regression tests for running in SMT2 mode
This commit introduces a new regression test suite for CBMC's SMT2 translation, and only tests the translation of structs.
1 parent caab966 commit 19b2cae

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_test_pl_tests(
2+
"$<TARGET_FILE:cbmc> --smt2 --z3"
3+
)

regression/cbmc-smt2-z3/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
default: tests.log
2+
3+
include ../../src/config.inc
4+
include ../../src/common
5+
6+
test: ../test.pl
7+
@../test.pl -e -p -c "../../../src/cbmc/cbmc --smt2 --z3"
8+
9+
tests.log: test
10+
11+
show:
12+
@for dir in *; do \
13+
if [ -d "$$dir" ]; then \
14+
vim -o "$$dir/*.c" "$$dir/*.out"; \
15+
fi; \
16+
done;
17+
18+
clean:
19+
$(RM) tests.log */*.out

regression/cbmc-smt2-z3/struct/main.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <assert.h>
2+
3+
struct test {
4+
unsigned int a;
5+
unsigned int b;
6+
};
7+
8+
int main()
9+
{
10+
struct test t;
11+
assert (t.a > 0);
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=6$
5+
^SIGNAL=0$
6+
^VERIFICATION ERROR$
7+
--
8+
--
9+
This test checks the encoding of C `struct`s using SMT2 data types.

0 commit comments

Comments
 (0)