-
Notifications
You must be signed in to change notification settings - Fork 4
Add and use CProverString.ofCharArray #9
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
Conversation
f42ccdf
to
dda318a
Compare
* | ||
* @diffblue.noSupport | ||
* @diffblue.fullSupport | ||
* @diffblue.untested |
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.
How is this going to be tested?
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.
It's tested by this PR diffblue/cbmc#2374 but maybe we should have more tests in the models library.
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.
Only some documentation changes requested.
@@ -216,11 +237,11 @@ public String(char value[]) { | |||
* characters outside the bounds of the {@code value} array | |||
* | |||
* @diffblue.limitedSupport |
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 limitedSupport
now?
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.
The reasons are detailed below: count limited by unwind, and value cannot be null.
* Converts an array of characters to a string. This uses a loop and | ||
* therefore in test-generation the {@code count} will be limited by the | ||
* unwind parameter. | ||
* This assumes {@code value} is not null, its length is greater or equal to |
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 assumes
is a bit ambiguous. It looks like a precondition to the function. Maybe This constrains {@code value} to be not null...
?
* | ||
* @param value Array of characters which is the source to copy from | ||
* @param offset Index in {@code value} of the first character to copy | ||
* @param count Number of characters to copy |
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.
We don't usually start the parameter description with an upper-case char.
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.
Hm. True, lower case seems standard in javadoc.
* therefore in test-generation the {@code count} will be limited by the | ||
* unwind parameter. | ||
* This assumes {@code value} is not null, its length is greater or equal to | ||
* {@code offset + count} and {@code offset} and {@code count} are positive. |
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.
positive
-> non-negative
.
dda318a
to
598f37f
Compare
* | ||
* @param value Array of characters which is the source to copy from | ||
* @param offset Index in {@code value} of the first character to copy | ||
* @param count Number of characters to copy |
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.
Hm. True, lower case seems standard in javadoc.
* @return The created String | ||
*/ | ||
public static String ofCharArray(char value[], int offset, int count) { | ||
org.cprover.CProver.assume(value != null); |
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.
import
598f37f
to
da73286
Compare
This adds a function for converting char arrays to strings and use it for a String constructor.
da73286
to
b7ca9fd
Compare
This adds a function for converting char arrays to strings and use it
for a String constructor.