Skip to content

Commit 34007fe

Browse files
authored
Merge pull request #74 from DurieuxPol/feat/newOps
New mutant operators
2 parents 4787a5b + 3c301c5 commit 34007fe

File tree

58 files changed

+521
-212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+521
-212
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Class {
2+
#name : 'MTAssignmentNullifierOperator',
3+
#superclass : 'MTBlockBasedMutantOperator',
4+
#category : 'MuTalk-Model-Operators',
5+
#package : 'MuTalk-Model',
6+
#tag : 'Operators'
7+
}
8+
9+
{ #category : 'printing' }
10+
MTAssignmentNullifierOperator >> description [
11+
12+
^ 'Nullify the value assigned'
13+
]
14+
15+
{ #category : 'applying' }
16+
MTAssignmentNullifierOperator >> expressionToReplace [
17+
18+
^ [ :aNode | aNode isAssignment & aNode value isNotNil ]
19+
]
20+
21+
{ #category : 'applying' }
22+
MTAssignmentNullifierOperator >> newExpression [
23+
24+
^ [ :anOldNode |
25+
| nodeCopy |
26+
nodeCopy := anOldNode copy.
27+
nodeCopy value: (RBLiteralValueNode value: nil).
28+
nodeCopy ]
29+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Class {
2+
#name : 'MTReplaceWhileFalseReceiverOperator',
3+
#superclass : 'MTReplaceReceiverOperator',
4+
#category : 'MuTalk-Model-Operators',
5+
#package : 'MuTalk-Model',
6+
#tag : 'Operators'
7+
}
8+
9+
{ #category : 'testing' }
10+
MTReplaceWhileFalseReceiverOperator class >> isAbstract [
11+
12+
^ self == MTReplaceWhileFalseReceiverOperator
13+
]
14+
15+
{ #category : 'applying' }
16+
MTReplaceWhileFalseReceiverOperator >> selector [
17+
18+
^ #whileFalse:
19+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Class {
2+
#name : 'MTReplaceWhileFalseReceiverWithFalseOperator',
3+
#superclass : 'MTReplaceWhileFalseReceiverOperator',
4+
#category : 'MuTalk-Model-Operators',
5+
#package : 'MuTalk-Model',
6+
#tag : 'Operators'
7+
}
8+
9+
{ #category : 'applying' }
10+
MTReplaceWhileFalseReceiverWithFalseOperator >> newReceiverExpression [
11+
12+
^ 'false'
13+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Class {
2+
#name : 'MTReplaceWhileFalseReceiverWithTrueOperator',
3+
#superclass : 'MTReplaceWhileFalseReceiverOperator',
4+
#category : 'MuTalk-Model-Operators',
5+
#package : 'MuTalk-Model',
6+
#tag : 'Operators'
7+
}
8+
9+
{ #category : 'applying' }
10+
MTReplaceWhileFalseReceiverWithTrueOperator >> newReceiverExpression [
11+
12+
^ 'true'
13+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Class {
2+
#name : 'MTReplaceWhileFalseWithWhileTrueMutantOperator',
3+
#superclass : 'MTSelectorReplacementMutantOperator',
4+
#category : 'MuTalk-Model-Operators',
5+
#package : 'MuTalk-Model',
6+
#tag : 'Operators'
7+
}
8+
9+
{ #category : 'accessing' }
10+
MTReplaceWhileFalseWithWhileTrueMutantOperator >> newSelector [
11+
12+
^ #whileTrue:
13+
]
14+
15+
{ #category : 'accessing' }
16+
MTReplaceWhileFalseWithWhileTrueMutantOperator >> oldSelector [
17+
18+
^ #whileFalse:
19+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Class {
2+
#name : 'MTReplaceWhileTrueReceiverOperator',
3+
#superclass : 'MTReplaceReceiverOperator',
4+
#category : 'MuTalk-Model-Operators',
5+
#package : 'MuTalk-Model',
6+
#tag : 'Operators'
7+
}
8+
9+
{ #category : 'testing' }
10+
MTReplaceWhileTrueReceiverOperator class >> isAbstract [
11+
12+
^ self == MTReplaceWhileTrueReceiverOperator
13+
]
14+
15+
{ #category : 'applying' }
16+
MTReplaceWhileTrueReceiverOperator >> selector [
17+
18+
^ #whileTrue:
19+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Class {
2+
#name : 'MTReplaceWhileTrueReceiverWithFalseOperator',
3+
#superclass : 'MTReplaceWhileTrueReceiverOperator',
4+
#category : 'MuTalk-Model-Operators',
5+
#package : 'MuTalk-Model',
6+
#tag : 'Operators'
7+
}
8+
9+
{ #category : 'applying' }
10+
MTReplaceWhileTrueReceiverWithFalseOperator >> newReceiverExpression [
11+
12+
^ 'false'
13+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Class {
2+
#name : 'MTReplaceWhileTrueReceiverWithTrueOperator',
3+
#superclass : 'MTReplaceWhileTrueReceiverOperator',
4+
#category : 'MuTalk-Model-Operators',
5+
#package : 'MuTalk-Model',
6+
#tag : 'Operators'
7+
}
8+
9+
{ #category : 'applying' }
10+
MTReplaceWhileTrueReceiverWithTrueOperator >> newReceiverExpression [
11+
12+
^ 'true'
13+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Class {
2+
#name : 'MTReplaceWhileTrueWithWhileFalseMutantOperator',
3+
#superclass : 'MTSelectorReplacementMutantOperator',
4+
#category : 'MuTalk-Model-Operators',
5+
#package : 'MuTalk-Model',
6+
#tag : 'Operators'
7+
}
8+
9+
{ #category : 'accessing' }
10+
MTReplaceWhileTrueWithWhileFalseMutantOperator >> newSelector [
11+
12+
^ #whileFalse:
13+
]
14+
15+
{ #category : 'accessing' }
16+
MTReplaceWhileTrueWithWhileFalseMutantOperator >> oldSelector [
17+
18+
^ #whileTrue:
19+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Class {
2+
#name : 'MTAssignmentNullifierOperatorTest',
3+
#superclass : 'MTMutantOperatorTest',
4+
#category : 'MuTalk-Tests',
5+
#package : 'MuTalk-Tests'
6+
}
7+
8+
{ #category : 'accessing' }
9+
MTAssignmentNullifierOperatorTest >> methodWithNoSenders [
10+
11+
^ 1 + 2
12+
]
13+
14+
{ #category : 'accessing' }
15+
MTAssignmentNullifierOperatorTest >> methodWithOneSender [
16+
17+
| i |
18+
i := 1
19+
]
20+
21+
{ #category : 'accessing' }
22+
MTAssignmentNullifierOperatorTest >> methodWithOneSenderModified [
23+
24+
| i |
25+
i := nil
26+
]
27+
28+
{ #category : 'accessing' }
29+
MTAssignmentNullifierOperatorTest >> methodWithTwoSenders [
30+
31+
| i j |
32+
i := 1.
33+
j := 2
34+
]
35+
36+
{ #category : 'accessing' }
37+
MTAssignmentNullifierOperatorTest >> methodWithTwoSendersModifiedFirst [
38+
39+
| i j |
40+
i := nil.
41+
j := 2
42+
]
43+
44+
{ #category : 'accessing' }
45+
MTAssignmentNullifierOperatorTest >> methodWithTwoSendersModifiedSecond [
46+
47+
| i j |
48+
i := 1.
49+
j := nil
50+
]
51+
52+
{ #category : 'accessing' }
53+
MTAssignmentNullifierOperatorTest >> operator [
54+
55+
^ MTAssignmentNullifierOperator new
56+
]

src/MuTalk-Tests/MTEmptyMethodOperatorTest.class.st

-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ MTEmptyMethodOperatorTest >> operator [
2424
^ MTEmptyMethodOperator new
2525
]
2626

27-
{ #category : 'accessing' }
28-
MTEmptyMethodOperatorTest >> operatorDescription [
29-
30-
^ self operator description
31-
]
32-
3327
{ #category : 'tests' }
3428
MTEmptyMethodOperatorTest >> testApplyMutantToMethod [
3529

src/MuTalk-Tests/MTLiteralBooleanNegateOperatorTest.class.st

-6
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,3 @@ MTLiteralBooleanNegateOperatorTest >> operator [
4646

4747
^ MTLiteralBooleanNegateOperator new
4848
]
49-
50-
{ #category : 'accessing' }
51-
MTLiteralBooleanNegateOperatorTest >> operatorDescription [
52-
53-
^ self operator description
54-
]

src/MuTalk-Tests/MTLiteralIntegersIncreaseOperatorTest.class.st

-6
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,3 @@ MTLiteralIntegersIncreaseOperatorTest >> operator [
4949

5050
^ MTLiteralIntegersIncreaseOperator new
5151
]
52-
53-
{ #category : 'accessing' }
54-
MTLiteralIntegersIncreaseOperatorTest >> operatorDescription [
55-
56-
^ 'Increase a literal integer'
57-
]

src/MuTalk-Tests/MTMessageSendArguments1stNullifierOperatorTest.class.st

-6
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,3 @@ MTMessageSendArguments1stNullifierOperatorTest >> operator [
6161

6262
^ MTMessageSendArguments1stNullifierOperator new
6363
]
64-
65-
{ #category : 'accessing' }
66-
MTMessageSendArguments1stNullifierOperatorTest >> operatorDescription [
67-
68-
^ self operator description
69-
]

src/MuTalk-Tests/MTMessageSendArguments3rdNullifierOperatorTest.class.st

-6
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,3 @@ MTMessageSendArguments3rdNullifierOperatorTest >> operator [
6969

7070
^ MTMessageSendArguments3rdNullifierOperator new
7171
]
72-
73-
{ #category : 'accessing' }
74-
MTMessageSendArguments3rdNullifierOperatorTest >> operatorDescription [
75-
76-
^ self operator description
77-
]

src/MuTalk-Tests/MTMessageSendToYourselfOperatorTest.class.st

-6
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,3 @@ MTMessageSendToYourselfOperatorTest >> operator [
5151

5252
^ MTMessageSendToYourselfOperator new
5353
]
54-
55-
{ #category : 'accessing' }
56-
MTMessageSendToYourselfOperatorTest >> operatorDescription [
57-
58-
^ self operator description
59-
]

src/MuTalk-Tests/MTMutantOperatorTest.class.st

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ MTMutantOperatorTest >> operator [
156156

157157
{ #category : 'accessing' }
158158
MTMutantOperatorTest >> operatorDescription [
159-
self subclassResponsibility
159+
160+
^ self operator description
160161
]
161162

162163
{ #category : 'tests' }

src/MuTalk-Tests/MTRemoveAtIfAbsentMutantOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,3 @@ MTRemoveAtIfAbsentMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
4949
MTRemoveAtIfAbsentMutantOperatorTest >> operator [
5050
^ MTRemoveAtIfAbsentOperator new
5151
]
52-
53-
{ #category : 'accessing' }
54-
MTRemoveAtIfAbsentMutantOperatorTest >> operatorDescription [
55-
^ 'Remove at:ifAbsent:'
56-
]

src/MuTalk-Tests/MTRemoveCaretMutantOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,3 @@ MTRemoveCaretMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
4646
MTRemoveCaretMutantOperatorTest >> operator [
4747
^ MTRemoveCaretOperator new
4848
]
49-
50-
{ #category : 'accessing' }
51-
MTRemoveCaretMutantOperatorTest >> operatorDescription [
52-
^ 'Remove ^'
53-
]

src/MuTalk-Tests/MTRemoveExceptionHandlerOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,3 @@ MTRemoveExceptionHandlerOperatorTest >> methodWithTwoSendersModifiedSecond [
4343
MTRemoveExceptionHandlerOperatorTest >> operator [
4444
^ MTRemoveExceptionHandlerOperator new
4545
]
46-
47-
{ #category : 'accessing' }
48-
MTRemoveExceptionHandlerOperatorTest >> operatorDescription [
49-
^ 'Remove Exception Handler Operator'
50-
]

src/MuTalk-Tests/MTReplaceAndArgumentWithTrueOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,3 @@ MTReplaceAndArgumentWithTrueOperatorTest >> methodWithTwoSendersModifiedSecond [
4646
MTReplaceAndArgumentWithTrueOperatorTest >> operator [
4747
^ MTReplaceAndArgumentWithTrueOperator new.
4848
]
49-
50-
{ #category : 'accessing' }
51-
MTReplaceAndArgumentWithTrueOperatorTest >> operatorDescription [
52-
^'Replace #and: argument with [true]'
53-
]

src/MuTalk-Tests/MTReplaceAndReceiverWithTrueOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,3 @@ MTReplaceAndReceiverWithTrueOperatorTest >> methodWithTwoSendersModifiedSecond [
4646
MTReplaceAndReceiverWithTrueOperatorTest >> operator [
4747
^ MTReplaceAndReceiverWithTrueOperator new
4848
]
49-
50-
{ #category : 'accessing' }
51-
MTReplaceAndReceiverWithTrueOperatorTest >> operatorDescription [
52-
^'Replace #and: receiver with true'
53-
]

src/MuTalk-Tests/MTReplaceAndWithEqvMutantOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,3 @@ MTReplaceAndWithEqvMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
3939
MTReplaceAndWithEqvMutantOperatorTest >> operator [
4040
^ MTReplaceAndWithEqvMutantOperator new
4141
]
42-
43-
{ #category : 'accessing' }
44-
MTReplaceAndWithEqvMutantOperatorTest >> operatorDescription [
45-
^'Replace #and: with #bEqv:'
46-
]

src/MuTalk-Tests/MTReplaceAndWithFalseMutantOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,3 @@ MTReplaceAndWithFalseMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
3939
MTReplaceAndWithFalseMutantOperatorTest >> operator [
4040
^ MTReplaceAndWithFalseOperator new
4141
]
42-
43-
{ #category : 'accessing' }
44-
MTReplaceAndWithFalseMutantOperatorTest >> operatorDescription [
45-
^'Replace #and: with false'
46-
]

src/MuTalk-Tests/MTReplaceAndWithNandMutantOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,3 @@ MTReplaceAndWithNandMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
3939
MTReplaceAndWithNandMutantOperatorTest >> operator [
4040
^ MTReplaceAndWithNandMutantOperator new
4141
]
42-
43-
{ #category : 'accessing' }
44-
MTReplaceAndWithNandMutantOperatorTest >> operatorDescription [
45-
^'Replace #and: with #nand:'
46-
]

src/MuTalk-Tests/MTReplaceAndWithOrMutantOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,3 @@ MTReplaceAndWithOrMutantOperatorTest >> methodWithTwoSendersModifiedSecond [
3939
MTReplaceAndWithOrMutantOperatorTest >> operator [
4040
^ MTReplaceAndWithOrMutantOperator new
4141
]
42-
43-
{ #category : 'accessing' }
44-
MTReplaceAndWithOrMutantOperatorTest >> operatorDescription [
45-
^'Replace #and: with #or:'
46-
]

src/MuTalk-Tests/MTReplaceDetectIfNoneFirstBlockWithAlwaysFalseBlockOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,3 @@ MTReplaceDetectIfNoneFirstBlockWithAlwaysFalseBlockOperatorTest >> methodWithTwo
6666
MTReplaceDetectIfNoneFirstBlockWithAlwaysFalseBlockOperatorTest >> operator [
6767
^ MTReplaceDetectIfNoneFirstBlockWithAlwaysFalseBlockOperator new
6868
]
69-
70-
{ #category : 'accessing' }
71-
MTReplaceDetectIfNoneFirstBlockWithAlwaysFalseBlockOperatorTest >> operatorDescription [
72-
^'Replace detect: block with [:each | false] when #detect:ifNone: '
73-
]

src/MuTalk-Tests/MTReplaceDetectIfNoneFirstBlockWithAlwaysTrueBlockOperatorTest.class.st

-5
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,3 @@ MTReplaceDetectIfNoneFirstBlockWithAlwaysTrueBlockOperatorTest >> methodWithTwoS
6666
MTReplaceDetectIfNoneFirstBlockWithAlwaysTrueBlockOperatorTest >> operator [
6767
^ MTReplaceDetectIfNoneFirstBlockWithAlwaysTrueBlockOperator new
6868
]
69-
70-
{ #category : 'accessing' }
71-
MTReplaceDetectIfNoneFirstBlockWithAlwaysTrueBlockOperatorTest >> operatorDescription [
72-
^'Replace detect: block with [:each | true] when #detect:ifNone: '
73-
]

0 commit comments

Comments
 (0)