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

New mutant operators #74

Merged
merged 3 commits into from
Feb 1, 2024
Merged

Conversation

DurieuxPol
Copy link
Collaborator

@DurieuxPol DurieuxPol commented Jan 31, 2024

Added several mutant operators that were missing and could be interesting:

  • MTAssignmentNullifierOperator which transforms the value of an assignment to nil: variable := value -> variable := nil
  • MTReplaceWhileTrueWithWhileFalseMutantOperator and MTReplaceWhileFalseWithWhileTrueMutantOperator
  • MTReplaceWhileTrueReceiverWithTrueOperator and MTReplaceWhileTrueReceiverWithFalseOperator
  • MTReplaceWhileFalseReceiverWithTrueOperator and MTReplaceWhileFalseReceiverWithFalseOperator

I found the assignment operator while experimenting a bit. With the current operators, especially MTEmptyMethodOperator, there was never a method without mutation because this operator could always be applied.
So I tried to get methods without mutation without taking into account this operator, and I found several methods with only assignments, like the initialize methods.
As for the operators on whileTrue: and whileFalse:, I was just looking at the ones on ifTrue: and ifFalse: and noticed that there wasn't any operator for their while counterparts.

@coveralls
Copy link

coveralls commented Jan 31, 2024

Pull Request Test Coverage Report for Build 7728215628

  • 94 of 288 (32.64%) changed or added relevant lines in 17 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.8%) to 58.108%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/MuTalk-Tests/MTReplaceWhileFalseReceiverWithFalseOperatorTest.class.st 4 31 12.9%
src/MuTalk-Tests/MTReplaceWhileFalseReceiverWithTrueOperatorTest.class.st 4 31 12.9%
src/MuTalk-Tests/MTReplaceWhileFalseWithWhileTrueMutantOperatorTest.class.st 4 31 12.9%
src/MuTalk-Tests/MTReplaceWhileTrueReceiverWithFalseOperatorTest.class.st 4 31 12.9%
src/MuTalk-Tests/MTReplaceWhileTrueReceiverWithTrueOperatorTest.class.st 4 31 12.9%
src/MuTalk-Tests/MTReplaceWhileTrueWithWhileFalseMutantOperatorTest.class.st 4 31 12.9%
src/MuTalk-Tests/MTAssignmentNullifierOperatorTest.class.st 4 36 11.11%
Totals Coverage Status
Change from base Build 7653796460: -1.8%
Covered Lines: 4293
Relevant Lines: 7388

💛 - Coveralls

Copy link
Contributor

@guillep guillep left a comment

Choose a reason for hiding this comment

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

Thanks @DurieuxPol !

Could you write in the issue description how did you find these missing operators?

@@ -39,8 +39,3 @@ MTReplaceOrWithAndMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
MTReplaceOrWithAndMutantOperatorTest >> operator [
^ MTReplaceOrWithAndMutantOperator new
]

{ #category : 'accessing' }
MTReplaceOrWithAndMutantOperatorTest >> operatorDescription [
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch of dead code :)

@guillep guillep merged commit 34007fe into pharo-contributions:master Feb 1, 2024
4 checks passed
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