Skip to content

Commit 70148a1

Browse files
authored
Merge pull request #70 from DurieuxPol/feat/utilities
Imported MuTalk-Utilities
2 parents 60f05cc + 1c9bab3 commit 70148a1

11 files changed

+577
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
Class {
2-
#name : #BaselineOfMuTalk,
3-
#superclass : #BaselineOf,
4-
#category : #BaselineOfMuTalk
2+
#name : 'BaselineOfMuTalk',
3+
#superclass : 'BaselineOf',
4+
#category : 'BaselineOfMuTalk',
5+
#package : 'BaselineOfMuTalk'
56
}
67

7-
{ #category : #baselines }
8+
{ #category : 'baselines' }
89
BaselineOfMuTalk >> baseline: spec [
910
<baseline>
1011

@@ -16,11 +17,13 @@ BaselineOfMuTalk >> baseline: spec [
1617
package: 'MuTalk-CI' with: [ spec requires: #( 'MuTalk-Model' ) ];
1718
package: 'MuTalk-CI-Tests' with: [ spec requires: #( 'MuTalk-Model' 'MuTalk-CI' ) ];
1819
package: 'MuTalk-Tests' with: [ spec requires: #( 'MuTalk-Model' 'MuTalk-TestResources' ) ];
19-
package: 'MuTalk-SpecUI' with: [ spec requires: #('MuTalk-Model') ].
20+
package: 'MuTalk-SpecUI' with: [ spec requires: #('MuTalk-Model') ];
21+
package: 'MuTalk-Utilities' with: [ spec requires: #( 'MuTalk-Model' ) ];
22+
package: 'MuTalk-Utilities-Tests' with: [ spec requires: #( 'MuTalk-Model' 'MuTalk-Utilities' ) ].
2023

2124
spec
2225
group: 'default'
2326
with:
2427
#( 'TestCoverage' 'MuTalk-Model' 'MuTalk-TestResources' 'MuTalk-Tests'
25-
'MuTalk-CI' 'MuTalk-CI-Tests' 'MuTalk-SpecUI' ) ]
28+
'MuTalk-CI' 'MuTalk-CI-Tests' 'MuTalk-SpecUI' 'MuTalk-Utilities' 'MuTalk-Utilities-Tests' ) ]
2629
]

src/BaselineOfMuTalk/package.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Package { #name : #BaselineOfMuTalk }
1+
Package { #name : 'BaselineOfMuTalk' }

src/MuTalk-Model/MTTestCaseReference.class.st

+27
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ MTTestCaseReference class >> forTestCase: aTestCase [
2020
^self for: aTestCase selector in: aTestCase class
2121
]
2222

23+
{ #category : 'comparing' }
24+
MTTestCaseReference >> = anObject [
25+
26+
self == anObject ifTrue: [ ^ true ].
27+
anObject species = self class ifFalse: [ ^ false ].
28+
self testCaseClass = anObject testCaseClass ifFalse: [ ^ false ].
29+
^ self selector = anObject selector
30+
]
31+
32+
{ #category : 'comparing' }
33+
MTTestCaseReference >> hash [
34+
35+
^ selector hash + class hash
36+
]
37+
2338
{ #category : 'initialize' }
2439
MTTestCaseReference >> initializeFor: aSelector in: aClass [
2540
class := aClass.
@@ -72,7 +87,19 @@ MTTestCaseReference >> runUnchecked [
7287
^ result
7388
]
7489

90+
{ #category : 'accessing' }
91+
MTTestCaseReference >> selector [
92+
93+
^ selector
94+
]
95+
7596
{ #category : 'evaluating' }
7697
MTTestCaseReference >> testCase [
7798
^class selector: selector.
7899
]
100+
101+
{ #category : 'accessing' }
102+
MTTestCaseReference >> testCaseClass [
103+
104+
^ class
105+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Class {
2+
#name : 'MTAuxiliarClassForMatrix',
3+
#superclass : 'Object',
4+
#instVars : [
5+
'counter'
6+
],
7+
#category : 'MuTalk-Utilities-Tests',
8+
#package : 'MuTalk-Utilities-Tests'
9+
}
10+
11+
{ #category : 'initialization' }
12+
MTAuxiliarClassForMatrix >> initialize [
13+
14+
super initialize.
15+
counter := 0
16+
]
17+
18+
{ #category : 'accessing' }
19+
MTAuxiliarClassForMatrix >> minus: aNumber [
20+
21+
counter := counter - aNumber.
22+
^ self reset
23+
]
24+
25+
{ #category : 'accessing' }
26+
MTAuxiliarClassForMatrix >> plus: aNumber [
27+
28+
counter := counter + aNumber.
29+
^ self reset
30+
]
31+
32+
{ #category : 'resetting' }
33+
MTAuxiliarClassForMatrix >> reset [
34+
35+
| count |
36+
count := counter.
37+
counter := 0.
38+
^ count
39+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Class {
2+
#name : 'MTAuxiliarClassForMatrixTest',
3+
#superclass : 'TestCase',
4+
#instVars : [
5+
'obj'
6+
],
7+
#category : 'MuTalk-Utilities-Tests',
8+
#package : 'MuTalk-Utilities-Tests'
9+
}
10+
11+
{ #category : 'running' }
12+
MTAuxiliarClassForMatrixTest >> setUp [
13+
14+
super setUp.
15+
obj := MTAuxiliarClassForMatrix new
16+
]
17+
18+
{ #category : 'running' }
19+
MTAuxiliarClassForMatrixTest >> testMinus [
20+
21+
self assert: (obj minus: 10) equals: -10
22+
]
23+
24+
{ #category : 'running' }
25+
MTAuxiliarClassForMatrixTest >> testPlus [
26+
27+
self assert: (obj plus: 10) equals: 10
28+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
Class {
2+
#name : 'MTMatrixTest',
3+
#superclass : 'TestCase',
4+
#instVars : [
5+
'matrix',
6+
'trivialMutant',
7+
'equivalentMutants',
8+
'includedMutants'
9+
],
10+
#category : 'MuTalk-Utilities-Tests',
11+
#package : 'MuTalk-Utilities-Tests'
12+
}
13+
14+
{ #category : 'running' }
15+
MTMatrixTest >> setUp [
16+
17+
super setUp.
18+
matrix := MTMatrix forAClass: MTAuxiliarClassForMatrix.
19+
matrix build.
20+
self setUpVariablesForTest
21+
]
22+
23+
{ #category : 'initialization' }
24+
MTMatrixTest >> setUpVariablesForTest [
25+
26+
| mutations minusMutants plusMutants |
27+
mutations := matrix analysis mutations.
28+
minusMutants := Set withAll: (mutations select: [ :mut |
29+
mut originalMethod
30+
= (MTAuxiliarClassForMatrix >> #minus:) ]).
31+
plusMutants := Set withAll: (mutations select: [ :mut |
32+
mut originalMethod
33+
= (MTAuxiliarClassForMatrix >> #plus:) ]).
34+
trivialMutant := Array with:
35+
(matrix analysis mutations detect: [ :mut |
36+
mut originalMethod
37+
= (MTAuxiliarClassForMatrix >> #reset) ]).
38+
equivalentMutants := Set with: minusMutants with: plusMutants.
39+
includedMutants := Dictionary new.
40+
mutations do: [ :mutant |
41+
mutant originalMethod = (MTAuxiliarClassForMatrix >> #minus:)
42+
ifTrue: [ includedMutants at: mutant put: minusMutants ].
43+
mutant originalMethod = (MTAuxiliarClassForMatrix >> #plus:)
44+
ifTrue: [ includedMutants at: mutant put: plusMutants ].
45+
mutant originalMethod = (MTAuxiliarClassForMatrix >> #reset)
46+
ifTrue: [ includedMutants at: mutant put: mutations asSet ] ]
47+
]
48+
49+
{ #category : 'tests' }
50+
MTMatrixTest >> testEqualBooleanCollections [
51+
52+
| a1 a2 a3 a4 |
53+
a1 := #( false false true true true false ).
54+
a2 := #( false false true true true false ).
55+
a3 := #( false false true true false false ).
56+
a4 := #( false true true false ).
57+
58+
self assert:
59+
(matrix booleanCollection1: a1 equalsBooleanCollection2: a2).
60+
self deny:
61+
(matrix booleanCollection1: a1 equalsBooleanCollection2: a3).
62+
self deny:
63+
(matrix booleanCollection1: a1 equalsBooleanCollection2: a4)
64+
]
65+
66+
{ #category : 'tests' }
67+
MTMatrixTest >> testEquivalentMutants [
68+
69+
self assert: matrix equivalentMutants equals: equivalentMutants
70+
]
71+
72+
{ #category : 'tests' }
73+
MTMatrixTest >> testIncludeBooleanCollections [
74+
75+
| a1 a2 a3 a4 a5 |
76+
a1 := #( false false true true true false ).
77+
a2 := #( false false true true true false ).
78+
a3 := #( false false true false false false ).
79+
a4 := #( true false true true false false ).
80+
a5 := #( false true true false ).
81+
82+
self assert:
83+
(matrix booleanCollection1: a1 includesBooleanCollection2: a2).
84+
self assert:
85+
(matrix booleanCollection1: a1 includesBooleanCollection2: a3).
86+
self deny:
87+
(matrix booleanCollection1: a1 includesBooleanCollection2: a4).
88+
self deny:
89+
(matrix booleanCollection1: a1 includesBooleanCollection2: a5).
90+
self deny:
91+
(matrix booleanCollection1: a3 includesBooleanCollection2: a1)
92+
]
93+
94+
{ #category : 'tests' }
95+
MTMatrixTest >> testIncludedMutants [
96+
97+
self assert: matrix includedMutants equals: includedMutants
98+
]
99+
100+
{ #category : 'tests' }
101+
MTMatrixTest >> testTrivialMutants [
102+
103+
self assert: matrix trivialMutants equals: trivialMutant
104+
]

src/MuTalk-Utilities-Tests/package.st

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Package { #name : 'MuTalk-Utilities-Tests' }

0 commit comments

Comments
 (0)