-
Notifications
You must be signed in to change notification settings - Fork 273
Test gen support string additional options #695
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
Closed
romainbrenguier
wants to merge
17
commits into
diffblue:test-gen-support
from
romainbrenguier:test-gen-support-string-additional-options
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f15ea75
Substitute array access by if-then-else expressions
romainbrenguier 0ef1a1f
Setting ui for temporary solver
romainbrenguier 4cff10e
Added option to the string solver for string length and printability
romainbrenguier 3a82a7f
Adding options to cbmc for parameters of the string solver
romainbrenguier 6bbf1f7
Remove the mode option from string solver
romainbrenguier cd010db
Setting the type for unknown values in substitute_array_access
romainbrenguier 4cbc28c
Adapt add_axioms_for_insert for 5 arguments #110
romainbrenguier de60c68
Fixed linting issue in string_constraint_generator_concat.cpp
romainbrenguier 48a92f6
Comment on the maximal length for string
romainbrenguier 4b321b6
Using max_string_length as the limit for refinement
romainbrenguier 20450ec
Using unsigned type for max string length
romainbrenguier a207787
Using const ref in substitute_array_with_expr
romainbrenguier 96cb157
making substitute_array_access do in-place substitution
romainbrenguier 920695a
Correcting type of max_string_length and length comparison functions
romainbrenguier 6a6858a
space before & sign instead of after
romainbrenguier cb2fb78
Putting each cbmc option on a separate line for easy merging
romainbrenguier 6898cca
Correcting initial_loop_bound type
romainbrenguier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ Author: Romain Brenguier, [email protected] | |
#ifndef CPROVER_SOLVERS_REFINEMENT_STRING_CONSTRAINT_GENERATOR_H | ||
#define CPROVER_SOLVERS_REFINEMENT_STRING_CONSTRAINT_GENERATOR_H | ||
|
||
#include <limits> | ||
#include <util/string_expr.h> | ||
#include <util/replace_expr.h> | ||
#include <util/refined_string_type.h> | ||
|
@@ -22,21 +23,19 @@ class string_constraint_generatort | |
{ | ||
public: | ||
// This module keeps a list of axioms. It has methods which generate | ||
// string constraints for different string funcitons and add them | ||
// string constraints for different string functions and add them | ||
// to the axiom list. | ||
|
||
string_constraint_generatort(): | ||
mode(ID_unknown) | ||
max_string_length(std::numeric_limits<unsigned long>::max()), | ||
force_printable_characters(false) | ||
{ } | ||
|
||
void set_mode(irep_idt _mode) | ||
{ | ||
// only C and java modes supported | ||
assert((_mode==ID_java) || (_mode==ID_C)); | ||
mode=_mode; | ||
} | ||
// Constraints on the maximal length of strings | ||
unsigned long max_string_length; | ||
|
||
irep_idt &get_mode() { return mode; } | ||
// Should we add constraints on the characters | ||
bool force_printable_characters; | ||
|
||
// Axioms are of three kinds: universally quantified string constraint, | ||
// not contains string constraints and simple formulas. | ||
|
@@ -74,6 +73,8 @@ class string_constraint_generatort | |
// Maps unresolved symbols to the string_exprt that was created for them | ||
std::map<irep_idt, string_exprt> unresolved_symbols; | ||
|
||
// Set of strings that have been created by the generator | ||
std::set<string_exprt> created_strings; | ||
|
||
string_exprt find_or_add_string_of_symbol( | ||
const symbol_exprt &sym, | ||
|
@@ -100,6 +101,7 @@ class string_constraint_generatort | |
|
||
static irep_idt extract_java_string(const symbol_exprt &s); | ||
|
||
void add_default_axioms(const string_exprt &s); | ||
exprt axiom_for_is_positive_index(const exprt &x); | ||
|
||
// The following functions add axioms for the returned value | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a long here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because length of string in java are 32 bits integer, while int in c++ on some systems could be 16 bits if I'm not mistaken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, minimum size of int is 16 bits. For Java, int32_t would make it independent of the system. For other languages, this might be different. Eg c++ string::max_size() tells me something close to 2^64 on my machine.