Add Statement List regression tests

Includes tests for simple integer additions/multiplications, multiple
functions/function blocks and for dividing two floats.
This commit is contained in:
Matthias Weiss 2019-05-20 18:01:10 +01:00
parent b900edc734
commit 2ba1361886
12 changed files with 183 additions and 0 deletions

View File

@ -47,6 +47,7 @@ endif()
add_subdirectory(goto-cc-cbmc)
add_subdirectory(cbmc-cpp)
add_subdirectory(goto-cc-goto-analyzer)
add_subdirectory(statement-list)
add_subdirectory(systemc)
add_subdirectory(contracts)
add_subdirectory(goto-harness)

View File

@ -23,6 +23,7 @@ DIRS = cbmc \
goto-cc-cbmc \
cbmc-cpp \
goto-cc-goto-analyzer \
statement-list \
systemc \
contracts \
goto-cc-file-local \

View File

@ -0,0 +1,24 @@
FUNCTION_BLOCK "Add_Int"
VERSION : 0.1
VAR_INPUT
"I0.0" : Int;
"I0.1" : Int;
END_VAR
VAR_OUTPUT
"O0.0" : Int;
END_VAR
BEGIN
NETWORK
TITLE =
L #"I0.0";
L #"I0.1";
+I;
T #"O0.0";
NOP 0;
NETWORK
TITLE =
END_FUNCTION_BLOCK

View File

@ -0,0 +1,18 @@
CORE
main.awl
--show-parse-tree
^EXIT=0$
^SIGNAL=0$
^Name: "Add_Int"$
^Version: 0[.]1$
^ \* type: statement_list_int$
^ \* identifier: "I0[.]0"$
^ \* identifier: "I0[.]1"$
^ \* identifier: "O0[.]0"$
^statement_list_load "I0[.]0"$
^statement_list_load "I0[.]1"$
^statement_list_accu_int_add$
^statement_list_transfer "O0[.]0"$
^statement_list_nop 0$
--
^warning: ignoring

View File

@ -0,0 +1,3 @@
add_test_pl_tests(
"$<TARGET_FILE:cbmc>" -X smt-backend
)

View File

@ -0,0 +1,24 @@
FUNCTION_BLOCK "Div_Real"
VERSION : 0.1
VAR_INPUT
"I0.0" : Real;
"I0.1" : Real;
END_VAR
VAR_OUTPUT
"O0.0" : Real;
END_VAR
BEGIN
NETWORK
TITLE =
L #"I0.0";
L #"I0.1";
/R;
T #"O0.0";
NOP 0;
NETWORK
TITLE =
END_FUNCTION_BLOCK

View File

@ -0,0 +1,18 @@
CORE
main.awl
--show-parse-tree
^EXIT=0$
^SIGNAL=0$
^Name: "Div_Real"$
^Version: 0[.]1$
^ \* type: statement_list_real$
^ \* identifier: "I0[.]0"$
^ \* identifier: "I0[.]1"$
^ \* identifier: "O0[.]0"$
^statement_list_load "I0[.]0"$
^statement_list_load "I0[.]1"$
^statement_list_accu_real_div$
^statement_list_transfer "O0[.]0"$
^statement_list_nop 0$
--
^warning: ignoring

View File

@ -0,0 +1,18 @@
default: test
test:
@../test.pl -e -p -c "../../../src/cbmc/cbmc" -X smt-backend
tests.log: ../test.pl test
show:
@for dir in *; do \
if [ -d "$$dir" ]; then \
vim -o "$$dir/*.awl" "$$dir/*.out"; \
fi; \
done;
clean:
find -name '*.out' -execdir $(RM) '{}' \;
find -name '*.smt2' -execdir $(RM) '{}' \;
$(RM) tests.log

View File

@ -0,0 +1,24 @@
FUNCTION_BLOCK "Mul_DInt"
VERSION : 0.1
VAR_INPUT
"I0.0" : DInt;
"I0.1" : DInt;
END_VAR
VAR_OUTPUT
"O0.0" : DInt;
END_VAR
BEGIN
NETWORK
TITLE =
L #"I0.0";
L #"I0.1";
*D;
T #"O0.0";
NOP 0;
NETWORK
TITLE =
END_FUNCTION_BLOCK

View File

@ -0,0 +1,18 @@
CORE
main.awl
--show-parse-tree
^EXIT=0$
^SIGNAL=0$
^Name: "Mul_DInt"$
^Version: 0[.]1$
^ \* type: statement_list_dint$
^ \* identifier: "I0[.]0"$
^ \* identifier: "I0[.]1"$
^ \* identifier: "O0[.]0"$
^statement_list_load "I0[.]0"$
^statement_list_load "I0[.]1"$
^statement_list_accu_dint_mul$
^statement_list_transfer "O0[.]0"$
^statement_list_nop 0$
--
^warning: ignoring

View File

@ -0,0 +1,24 @@
FUNCTION_BLOCK "Mult_1"
VERSION : 0.1
BEGIN
NETWORK
TITLE =
END_FUNCTION_BLOCK
FUNCTION_BLOCK "Mult_2"
VERSION : 0.1
BEGIN
NETWORK
TITLE =
END_FUNCTION_BLOCK
FUNCTION "Mult_3" : Void
VERSION : 0.1
BEGIN
NETWORK
TITLE =
END_FUNCTION

View File

@ -0,0 +1,10 @@
CORE
main.awl
--show-parse-tree
^EXIT=0$
^SIGNAL=0$
^Name: "Mult_1"$
^Name: "Mult_2"$
^Name: "Mult_3"$
--
^warning: ignoring