Skip to content

SMT2 strings tests #4015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions regression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ add_subdirectory(cpp)
add_subdirectory(cbmc-cover)
add_subdirectory(goto-instrument-typedef)
add_subdirectory(smt2_solver)
add_subdirectory(smt2_strings)
add_subdirectory(strings)
add_subdirectory(invariants)
add_subdirectory(goto-diff)
Expand Down
1 change: 1 addition & 0 deletions regression/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ DIRS = cbmc \
cbmc-cover \
goto-instrument-typedef \
smt2_solver \
smt2_strings \
strings \
invariants \
goto-diff \
Expand Down
1 change: 1 addition & 0 deletions regression/smt2_strings/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.smt2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would mean that Makefile, CMakeLists.txt, *.desc are also ignore, which doesn't seem right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. I need to discard the ignore that is introduced here:
https://github.com/diffblue/cbmc/blob/develop/.gitignore#L59
and which is useful on the regression tests where cbmc is run with the --smt2 option.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I wasn't aware of that interaction.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that cbmc still writes the file on disk when run with --smt2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 changes: 3 additions & 0 deletions regression/smt2_strings/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_test_pl_tests(
"$<TARGET_FILE:smt2_solver>"
)
18 changes: 18 additions & 0 deletions regression/smt2_strings/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
default: tests.log

test:
@../test.pl -p -c ../../../src/solvers/smt2_solver

tests.log: ../test.pl
@../test.pl -p -c ../../../src/solvers/smt2_solver

show:
@for dir in *; do \
if [ -d "$$dir" ]; then \
vim -o "$$dir/*.c" "$$dir/*.out"; \
fi; \
done;

clean:
find -name '*.out' -execdir $(RM) '{}' \;
$(RM) tests.log
14 changes: 14 additions & 0 deletions regression/smt2_strings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test Suite for SMT2 String Operations
=====================================

The purpose of this suite is to test the level of string support of cbmc's smt2
backend.

It can also be used to test the level of string support of any smt2 solver, by
using a command such as:
```
../test.pl -p -F -c <path_to_solver_binary>
```

(note the `-F` option to consider all tests tagged as "FUTURE").

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
concat_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (= (str.++ "abc" "def" "" "gh") "abcdefgh"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
concat_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (= (str.++ "abc" "cdef") "abcde"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
contains_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.contains "abcdef" "bcd"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
contains_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.contains "abcdef" "dc"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
indexof_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (= (str.indexof "abcdef" "cde" 1) 2))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
indexof_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (= (str.indexof "abcdef" "cde" 1) 1))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
int_to_str_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (= (int.to.str 1234567890) "1234567890"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
int_to_str_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (= (int.to.str 1234567890) "1234467890"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
length_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (= (str.len "abc") 3))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
length_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (= (str.len "abc") 4))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
lex_order_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.< "abc" "acc"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
lex_order_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.< "abc" "aac"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
prefixof_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.prefixof "abc" "abcdef"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
prefixof_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.prefixof "bc" "abcdef"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
reflexive_lex_order_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.<= "abc" "acc"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
reflexive_lex_order_const_sat2.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.<= "abc" "abc"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
reflexive_lex_order_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.<= "acc" "abc"))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_all_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "abc" (re.* re.all)))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_allchar_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "aaabbb" (re.++ (re.* (str.to.re "a")) (re.* re.allchar))))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_allchar_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "a" (re.++ (re.+ (str.to.re "a")) (re.+ re.allchar))))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_concat_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "aaabbb" (re.++ (re.* (str.to.re "a")) (re.* (str.to.re "b")))))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_concat_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "aaabbbc" (re.++ (re.* (str.to.re "a")) (re.* (str.to.re "b")))))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_inter_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "e" (re.inter (re.range "a" "h") (re.range "d" "w"))))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_inter_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "e" (re.inter (re.range "a" "b") (re.range "b" "w"))))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_loop_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "aaa" ((_ re.loop 3 3) (str.to.re "a"))))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_loop_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "aaa" ((_ re.loop 1 2) (str.to.re "a"))))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_nostr_const_unsat.smt2

^EXIT=0$
^SIGNAL=0$
^unsat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "a" re.nostr))
(check-sat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
regexp_opt_const_sat.smt2

^EXIT=0$
^SIGNAL=0$
^sat$
--
error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(assert (str.in.re "aaab" (re.++ (re.+ (str.to.re "a")) (re.opt (str.to.re "b")))))
(check-sat)
Loading