Skip to content

Commit 2ba1361

Browse files
committed
Add Statement List regression tests
Includes tests for simple integer additions/multiplications, multiple functions/function blocks and for dividing two floats.
1 parent b900edc commit 2ba1361

File tree

12 files changed

+183
-0
lines changed

12 files changed

+183
-0
lines changed

regression/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ endif()
4747
add_subdirectory(goto-cc-cbmc)
4848
add_subdirectory(cbmc-cpp)
4949
add_subdirectory(goto-cc-goto-analyzer)
50+
add_subdirectory(statement-list)
5051
add_subdirectory(systemc)
5152
add_subdirectory(contracts)
5253
add_subdirectory(goto-harness)

regression/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ DIRS = cbmc \
2323
goto-cc-cbmc \
2424
cbmc-cpp \
2525
goto-cc-goto-analyzer \
26+
statement-list \
2627
systemc \
2728
contracts \
2829
goto-cc-file-local \
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FUNCTION_BLOCK "Add_Int"
2+
VERSION : 0.1
3+
VAR_INPUT
4+
"I0.0" : Int;
5+
"I0.1" : Int;
6+
END_VAR
7+
8+
VAR_OUTPUT
9+
"O0.0" : Int;
10+
END_VAR
11+
12+
13+
BEGIN
14+
NETWORK
15+
TITLE =
16+
L #"I0.0";
17+
L #"I0.1";
18+
+I;
19+
T #"O0.0";
20+
NOP 0;
21+
NETWORK
22+
TITLE =
23+
END_FUNCTION_BLOCK
24+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CORE
2+
main.awl
3+
--show-parse-tree
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^Name: "Add_Int"$
7+
^Version: 0[.]1$
8+
^ \* type: statement_list_int$
9+
^ \* identifier: "I0[.]0"$
10+
^ \* identifier: "I0[.]1"$
11+
^ \* identifier: "O0[.]0"$
12+
^statement_list_load "I0[.]0"$
13+
^statement_list_load "I0[.]1"$
14+
^statement_list_accu_int_add$
15+
^statement_list_transfer "O0[.]0"$
16+
^statement_list_nop 0$
17+
--
18+
^warning: ignoring
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>" -X smt-backend
3+
)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FUNCTION_BLOCK "Div_Real"
2+
VERSION : 0.1
3+
VAR_INPUT
4+
"I0.0" : Real;
5+
"I0.1" : Real;
6+
END_VAR
7+
8+
VAR_OUTPUT
9+
"O0.0" : Real;
10+
END_VAR
11+
12+
13+
BEGIN
14+
NETWORK
15+
TITLE =
16+
L #"I0.0";
17+
L #"I0.1";
18+
/R;
19+
T #"O0.0";
20+
NOP 0;
21+
NETWORK
22+
TITLE =
23+
END_FUNCTION_BLOCK
24+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CORE
2+
main.awl
3+
--show-parse-tree
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^Name: "Div_Real"$
7+
^Version: 0[.]1$
8+
^ \* type: statement_list_real$
9+
^ \* identifier: "I0[.]0"$
10+
^ \* identifier: "I0[.]1"$
11+
^ \* identifier: "O0[.]0"$
12+
^statement_list_load "I0[.]0"$
13+
^statement_list_load "I0[.]1"$
14+
^statement_list_accu_real_div$
15+
^statement_list_transfer "O0[.]0"$
16+
^statement_list_nop 0$
17+
--
18+
^warning: ignoring

regression/statement-list/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
default: test
2+
3+
test:
4+
@../test.pl -e -p -c "../../../src/cbmc/cbmc" -X smt-backend
5+
6+
tests.log: ../test.pl test
7+
8+
show:
9+
@for dir in *; do \
10+
if [ -d "$$dir" ]; then \
11+
vim -o "$$dir/*.awl" "$$dir/*.out"; \
12+
fi; \
13+
done;
14+
15+
clean:
16+
find -name '*.out' -execdir $(RM) '{}' \;
17+
find -name '*.smt2' -execdir $(RM) '{}' \;
18+
$(RM) tests.log
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FUNCTION_BLOCK "Mul_DInt"
2+
VERSION : 0.1
3+
VAR_INPUT
4+
"I0.0" : DInt;
5+
"I0.1" : DInt;
6+
END_VAR
7+
8+
VAR_OUTPUT
9+
"O0.0" : DInt;
10+
END_VAR
11+
12+
13+
BEGIN
14+
NETWORK
15+
TITLE =
16+
L #"I0.0";
17+
L #"I0.1";
18+
*D;
19+
T #"O0.0";
20+
NOP 0;
21+
NETWORK
22+
TITLE =
23+
END_FUNCTION_BLOCK
24+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CORE
2+
main.awl
3+
--show-parse-tree
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^Name: "Mul_DInt"$
7+
^Version: 0[.]1$
8+
^ \* type: statement_list_dint$
9+
^ \* identifier: "I0[.]0"$
10+
^ \* identifier: "I0[.]1"$
11+
^ \* identifier: "O0[.]0"$
12+
^statement_list_load "I0[.]0"$
13+
^statement_list_load "I0[.]1"$
14+
^statement_list_accu_dint_mul$
15+
^statement_list_transfer "O0[.]0"$
16+
^statement_list_nop 0$
17+
--
18+
^warning: ignoring
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FUNCTION_BLOCK "Mult_1"
2+
VERSION : 0.1
3+
4+
BEGIN
5+
NETWORK
6+
TITLE =
7+
END_FUNCTION_BLOCK
8+
9+
FUNCTION_BLOCK "Mult_2"
10+
VERSION : 0.1
11+
12+
BEGIN
13+
NETWORK
14+
TITLE =
15+
END_FUNCTION_BLOCK
16+
17+
FUNCTION "Mult_3" : Void
18+
VERSION : 0.1
19+
20+
BEGIN
21+
NETWORK
22+
TITLE =
23+
END_FUNCTION
24+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.awl
3+
--show-parse-tree
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^Name: "Mult_1"$
7+
^Name: "Mult_2"$
8+
^Name: "Mult_3"$
9+
--
10+
^warning: ignoring

0 commit comments

Comments
 (0)