Skip to content
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

smarter stop method 'constant' #121

Open
arnobl opened this issue Mar 2, 2020 · 6 comments
Open

smarter stop method 'constant' #121

arnobl opened this issue Mar 2, 2020 · 6 comments

Comments

@arnobl
Copy link
Contributor

arnobl commented Mar 2, 2020

Characteristics

  • Issue Type: [feature]
  • Reproducibility: [always]
  • Severity: [feature]
  • Tool/Service/Component: [descartes/constant, 1.2.7-SNAP]
  • Execution Environment: [j11, linux]

Description

The stop method 'constant' sometimes creates a mutant that returns the exact same value of the returned constant. I face this limitation in abstract classes that have some methods with default behavior (eg https://github.com/interacto/interacto-java-api/blob/master/src/main/java/io/github/interacto/binding/WidgetBindingImpl.java#L243). The method returns false and Descartes creates a mutant that returns true while it should just create a mutant that returns false.

Do you think that is possible to improve that?

Steps to reproduce

Create a method that returns true.
Enable except[constant]

@oscarlvp
Copy link
Member

oscarlvp commented Mar 3, 2020

Actually, no mutant should be created for this method. so this is indeed a bug.

@arnobl
Copy link
Contributor Author

arnobl commented Mar 3, 2020

Really? (I activated the 'constant' mutation)
I guess one mutant should be created: return true; when the method returns the constant false (and vise versa). No?

@oscarlvp
Copy link
Member

oscarlvp commented Mar 3, 2020

With except you actually disable the constant stop method.
So that's why these mutants are created.
I understand now what you mean.
With constant we disable all methods returning a constant value no matter the type or the value.
But yes, maybe a smarter feature could be implemented.

@arnobl
Copy link
Contributor Author

arnobl commented Mar 3, 2020

well this is what I though when I read to documentation but this actually activate the mutants:
https://github.com/STAMP-project/pitest-descartes/blob/master/README.md#configuring-stop-methods

The doc says:

<features>
  <feature>
  <!-- This will allow descartes to mutate deprecated methods -->
    +STOP_METHODS(except[deprecated])
  </feature>
</features>

and indeed I activated several mutation operators this way.

@oscarlvp
Copy link
Member

oscarlvp commented Mar 3, 2020

Yes, sure, you activate the mutants by disabling the stop methods. Sorry I might not have been clear enough.
So having constant activated, which is the default configuration, you avoid these mutants. except[constant] allows the creation. so you are right.

@arnobl
Copy link
Contributor Author

arnobl commented Mar 3, 2020

Yes, sure, you activate the mutants by disabling the stop methods.

ok! I think you can add this sentence in the readme file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants