Skip to content

Constant propagation of CProverString.setLength() and CProverString.setCharAt() #5134

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

danpoe
Copy link
Contributor

@danpoe danpoe commented Sep 27, 2019

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

Looks good, few missing test cases


public class Test
{
public void testSuccess1()
Copy link
Contributor

Choose a reason for hiding this comment

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

No negative tests? Setting out of range for example?

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've not included test cases for the error cases here as those will be handled by the models in the future. I'll add tests for those cases once we have models that use the CProverString primitives.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure but we should check that they aren't accidentally const propagated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough, added more tests.

public void testSuccess1()
{
StringBuffer sb = new StringBuffer("abc");
CProverString.setLength(sb, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Test setting to same length (i.e. 3 in this case)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


public void testSuccess3()
{
StringBuffer sb = new StringBuffer("abc");
Copy link
Contributor

Choose a reason for hiding this comment

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

Test extension by more than one char

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@danpoe danpoe force-pushed the feature/constant-propagation-of-string-operations branch 3 times, most recently from ac6103a to a966852 Compare September 27, 2019 15:19
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

✔️
Passed Diffblue compatibility checks (cbmc commit: a966852).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/129478144

@danpoe danpoe force-pushed the feature/constant-propagation-of-string-operations branch from a966852 to 2c6c2a9 Compare September 29, 2019 10:18
Only minimal tests are added at this point. The error conditions (like index out
of bounds) will be handled by the models. Once we have models that use
CProverString.setLength(), more comprehensive tests will be added.
Only minimal tests are added at this point. The error conditions (like index out
of bounds) will be handled by the models. Once we have models that use
CProverString.setCharAt(), more comprehensive tests will be added.
@danpoe danpoe force-pushed the feature/constant-propagation-of-string-operations branch from 2c6c2a9 to 4bb03aa Compare September 29, 2019 11:55
@danpoe danpoe merged commit d8ed6fe into diffblue:develop Sep 29, 2019
@danpoe danpoe deleted the feature/constant-propagation-of-string-operations branch June 2, 2020 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants