Skip to content

Commit

Permalink
Merge pull request #74 from DurieuxPol/feat/newOps
Browse files Browse the repository at this point in the history
New mutant operators
  • Loading branch information
guillep authored Feb 1, 2024
2 parents 4787a5b + 3c301c5 commit 34007fe
Show file tree
Hide file tree
Showing 58 changed files with 521 additions and 212 deletions.
29 changes: 29 additions & 0 deletions src/MuTalk-Model/MTAssignmentNullifierOperator.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Class {
#name : 'MTAssignmentNullifierOperator',
#superclass : 'MTBlockBasedMutantOperator',
#category : 'MuTalk-Model-Operators',
#package : 'MuTalk-Model',
#tag : 'Operators'
}

{ #category : 'printing' }
MTAssignmentNullifierOperator >> description [

^ 'Nullify the value assigned'
]

{ #category : 'applying' }
MTAssignmentNullifierOperator >> expressionToReplace [

^ [ :aNode | aNode isAssignment & aNode value isNotNil ]
]

{ #category : 'applying' }
MTAssignmentNullifierOperator >> newExpression [

^ [ :anOldNode |
| nodeCopy |
nodeCopy := anOldNode copy.
nodeCopy value: (RBLiteralValueNode value: nil).
nodeCopy ]
]
19 changes: 19 additions & 0 deletions src/MuTalk-Model/MTReplaceWhileFalseReceiverOperator.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Class {
#name : 'MTReplaceWhileFalseReceiverOperator',
#superclass : 'MTReplaceReceiverOperator',
#category : 'MuTalk-Model-Operators',
#package : 'MuTalk-Model',
#tag : 'Operators'
}

{ #category : 'testing' }
MTReplaceWhileFalseReceiverOperator class >> isAbstract [

^ self == MTReplaceWhileFalseReceiverOperator
]

{ #category : 'applying' }
MTReplaceWhileFalseReceiverOperator >> selector [

^ #whileFalse:
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Class {
#name : 'MTReplaceWhileFalseReceiverWithFalseOperator',
#superclass : 'MTReplaceWhileFalseReceiverOperator',
#category : 'MuTalk-Model-Operators',
#package : 'MuTalk-Model',
#tag : 'Operators'
}

{ #category : 'applying' }
MTReplaceWhileFalseReceiverWithFalseOperator >> newReceiverExpression [

^ 'false'
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Class {
#name : 'MTReplaceWhileFalseReceiverWithTrueOperator',
#superclass : 'MTReplaceWhileFalseReceiverOperator',
#category : 'MuTalk-Model-Operators',
#package : 'MuTalk-Model',
#tag : 'Operators'
}

{ #category : 'applying' }
MTReplaceWhileFalseReceiverWithTrueOperator >> newReceiverExpression [

^ 'true'
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Class {
#name : 'MTReplaceWhileFalseWithWhileTrueMutantOperator',
#superclass : 'MTSelectorReplacementMutantOperator',
#category : 'MuTalk-Model-Operators',
#package : 'MuTalk-Model',
#tag : 'Operators'
}

{ #category : 'accessing' }
MTReplaceWhileFalseWithWhileTrueMutantOperator >> newSelector [

^ #whileTrue:
]

{ #category : 'accessing' }
MTReplaceWhileFalseWithWhileTrueMutantOperator >> oldSelector [

^ #whileFalse:
]
19 changes: 19 additions & 0 deletions src/MuTalk-Model/MTReplaceWhileTrueReceiverOperator.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Class {
#name : 'MTReplaceWhileTrueReceiverOperator',
#superclass : 'MTReplaceReceiverOperator',
#category : 'MuTalk-Model-Operators',
#package : 'MuTalk-Model',
#tag : 'Operators'
}

{ #category : 'testing' }
MTReplaceWhileTrueReceiverOperator class >> isAbstract [

^ self == MTReplaceWhileTrueReceiverOperator
]

{ #category : 'applying' }
MTReplaceWhileTrueReceiverOperator >> selector [

^ #whileTrue:
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Class {
#name : 'MTReplaceWhileTrueReceiverWithFalseOperator',
#superclass : 'MTReplaceWhileTrueReceiverOperator',
#category : 'MuTalk-Model-Operators',
#package : 'MuTalk-Model',
#tag : 'Operators'
}

{ #category : 'applying' }
MTReplaceWhileTrueReceiverWithFalseOperator >> newReceiverExpression [

^ 'false'
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Class {
#name : 'MTReplaceWhileTrueReceiverWithTrueOperator',
#superclass : 'MTReplaceWhileTrueReceiverOperator',
#category : 'MuTalk-Model-Operators',
#package : 'MuTalk-Model',
#tag : 'Operators'
}

{ #category : 'applying' }
MTReplaceWhileTrueReceiverWithTrueOperator >> newReceiverExpression [

^ 'true'
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Class {
#name : 'MTReplaceWhileTrueWithWhileFalseMutantOperator',
#superclass : 'MTSelectorReplacementMutantOperator',
#category : 'MuTalk-Model-Operators',
#package : 'MuTalk-Model',
#tag : 'Operators'
}

{ #category : 'accessing' }
MTReplaceWhileTrueWithWhileFalseMutantOperator >> newSelector [

^ #whileFalse:
]

{ #category : 'accessing' }
MTReplaceWhileTrueWithWhileFalseMutantOperator >> oldSelector [

^ #whileTrue:
]
56 changes: 56 additions & 0 deletions src/MuTalk-Tests/MTAssignmentNullifierOperatorTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Class {
#name : 'MTAssignmentNullifierOperatorTest',
#superclass : 'MTMutantOperatorTest',
#category : 'MuTalk-Tests',
#package : 'MuTalk-Tests'
}

{ #category : 'accessing' }
MTAssignmentNullifierOperatorTest >> methodWithNoSenders [

^ 1 + 2
]

{ #category : 'accessing' }
MTAssignmentNullifierOperatorTest >> methodWithOneSender [

| i |
i := 1
]

{ #category : 'accessing' }
MTAssignmentNullifierOperatorTest >> methodWithOneSenderModified [

| i |
i := nil
]

{ #category : 'accessing' }
MTAssignmentNullifierOperatorTest >> methodWithTwoSenders [

| i j |
i := 1.
j := 2
]

{ #category : 'accessing' }
MTAssignmentNullifierOperatorTest >> methodWithTwoSendersModifiedFirst [

| i j |
i := nil.
j := 2
]

{ #category : 'accessing' }
MTAssignmentNullifierOperatorTest >> methodWithTwoSendersModifiedSecond [

| i j |
i := 1.
j := nil
]

{ #category : 'accessing' }
MTAssignmentNullifierOperatorTest >> operator [

^ MTAssignmentNullifierOperator new
]
6 changes: 0 additions & 6 deletions src/MuTalk-Tests/MTEmptyMethodOperatorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ MTEmptyMethodOperatorTest >> operator [
^ MTEmptyMethodOperator new
]

{ #category : 'accessing' }
MTEmptyMethodOperatorTest >> operatorDescription [

^ self operator description
]

{ #category : 'tests' }
MTEmptyMethodOperatorTest >> testApplyMutantToMethod [

Expand Down
6 changes: 0 additions & 6 deletions src/MuTalk-Tests/MTLiteralBooleanNegateOperatorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,3 @@ MTLiteralBooleanNegateOperatorTest >> operator [

^ MTLiteralBooleanNegateOperator new
]

{ #category : 'accessing' }
MTLiteralBooleanNegateOperatorTest >> operatorDescription [

^ self operator description
]
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,3 @@ MTLiteralIntegersIncreaseOperatorTest >> operator [

^ MTLiteralIntegersIncreaseOperator new
]

{ #category : 'accessing' }
MTLiteralIntegersIncreaseOperatorTest >> operatorDescription [

^ 'Increase a literal integer'
]
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,3 @@ MTMessageSendArguments1stNullifierOperatorTest >> operator [

^ MTMessageSendArguments1stNullifierOperator new
]

{ #category : 'accessing' }
MTMessageSendArguments1stNullifierOperatorTest >> operatorDescription [

^ self operator description
]
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,3 @@ MTMessageSendArguments3rdNullifierOperatorTest >> operator [

^ MTMessageSendArguments3rdNullifierOperator new
]

{ #category : 'accessing' }
MTMessageSendArguments3rdNullifierOperatorTest >> operatorDescription [

^ self operator description
]
6 changes: 0 additions & 6 deletions src/MuTalk-Tests/MTMessageSendToYourselfOperatorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,3 @@ MTMessageSendToYourselfOperatorTest >> operator [

^ MTMessageSendToYourselfOperator new
]

{ #category : 'accessing' }
MTMessageSendToYourselfOperatorTest >> operatorDescription [

^ self operator description
]
3 changes: 2 additions & 1 deletion src/MuTalk-Tests/MTMutantOperatorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ MTMutantOperatorTest >> operator [

{ #category : 'accessing' }
MTMutantOperatorTest >> operatorDescription [
self subclassResponsibility

^ self operator description
]

{ #category : 'tests' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,3 @@ MTRemoveAtIfAbsentMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
MTRemoveAtIfAbsentMutantOperatorTest >> operator [
^ MTRemoveAtIfAbsentOperator new
]

{ #category : 'accessing' }
MTRemoveAtIfAbsentMutantOperatorTest >> operatorDescription [
^ 'Remove at:ifAbsent:'
]
5 changes: 0 additions & 5 deletions src/MuTalk-Tests/MTRemoveCaretMutantOperatorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,3 @@ MTRemoveCaretMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
MTRemoveCaretMutantOperatorTest >> operator [
^ MTRemoveCaretOperator new
]

{ #category : 'accessing' }
MTRemoveCaretMutantOperatorTest >> operatorDescription [
^ 'Remove ^'
]
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,3 @@ MTRemoveExceptionHandlerOperatorTest >> methodWithTwoSendersModifiedSecond [
MTRemoveExceptionHandlerOperatorTest >> operator [
^ MTRemoveExceptionHandlerOperator new
]

{ #category : 'accessing' }
MTRemoveExceptionHandlerOperatorTest >> operatorDescription [
^ 'Remove Exception Handler Operator'
]
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,3 @@ MTReplaceAndArgumentWithTrueOperatorTest >> methodWithTwoSendersModifiedSecond [
MTReplaceAndArgumentWithTrueOperatorTest >> operator [
^ MTReplaceAndArgumentWithTrueOperator new.
]

{ #category : 'accessing' }
MTReplaceAndArgumentWithTrueOperatorTest >> operatorDescription [
^'Replace #and: argument with [true]'
]
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,3 @@ MTReplaceAndReceiverWithTrueOperatorTest >> methodWithTwoSendersModifiedSecond [
MTReplaceAndReceiverWithTrueOperatorTest >> operator [
^ MTReplaceAndReceiverWithTrueOperator new
]

{ #category : 'accessing' }
MTReplaceAndReceiverWithTrueOperatorTest >> operatorDescription [
^'Replace #and: receiver with true'
]
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,3 @@ MTReplaceAndWithEqvMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
MTReplaceAndWithEqvMutantOperatorTest >> operator [
^ MTReplaceAndWithEqvMutantOperator new
]

{ #category : 'accessing' }
MTReplaceAndWithEqvMutantOperatorTest >> operatorDescription [
^'Replace #and: with #bEqv:'
]
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,3 @@ MTReplaceAndWithFalseMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
MTReplaceAndWithFalseMutantOperatorTest >> operator [
^ MTReplaceAndWithFalseOperator new
]

{ #category : 'accessing' }
MTReplaceAndWithFalseMutantOperatorTest >> operatorDescription [
^'Replace #and: with false'
]
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,3 @@ MTReplaceAndWithNandMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
MTReplaceAndWithNandMutantOperatorTest >> operator [
^ MTReplaceAndWithNandMutantOperator new
]

{ #category : 'accessing' }
MTReplaceAndWithNandMutantOperatorTest >> operatorDescription [
^'Replace #and: with #nand:'
]
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,3 @@ MTReplaceAndWithOrMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
MTReplaceAndWithOrMutantOperatorTest >> operator [
^ MTReplaceAndWithOrMutantOperator new
]

{ #category : 'accessing' }
MTReplaceAndWithOrMutantOperatorTest >> operatorDescription [
^'Replace #and: with #or:'
]
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,3 @@ MTReplaceDetectIfNoneFirstBlockWithAlwaysFalseBlockOperatorTest >> methodWithTwo
MTReplaceDetectIfNoneFirstBlockWithAlwaysFalseBlockOperatorTest >> operator [
^ MTReplaceDetectIfNoneFirstBlockWithAlwaysFalseBlockOperator new
]

{ #category : 'accessing' }
MTReplaceDetectIfNoneFirstBlockWithAlwaysFalseBlockOperatorTest >> operatorDescription [
^'Replace detect: block with [:each | false] when #detect:ifNone: '
]
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,3 @@ MTReplaceDetectIfNoneFirstBlockWithAlwaysTrueBlockOperatorTest >> methodWithTwoS
MTReplaceDetectIfNoneFirstBlockWithAlwaysTrueBlockOperatorTest >> operator [
^ MTReplaceDetectIfNoneFirstBlockWithAlwaysTrueBlockOperator new
]

{ #category : 'accessing' }
MTReplaceDetectIfNoneFirstBlockWithAlwaysTrueBlockOperatorTest >> operatorDescription [
^'Replace detect: block with [:each | true] when #detect:ifNone: '
]
Loading

0 comments on commit 34007fe

Please sign in to comment.