-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Durieux Pol
committed
Nov 21, 2023
1 parent
a9d3d95
commit a9d4a9e
Showing
3 changed files
with
151 additions
and
205 deletions.
There are no files selected for viewing
97 changes: 0 additions & 97 deletions
97
src/MuTalk-Tests/FixedRandomOperatorMutantSelectionTest.class.st
This file was deleted.
Oops, something went wrong.
108 changes: 0 additions & 108 deletions
108
src/MuTalk-Tests/PercentRandomOperatorMutantSelectionTest.class.st
This file was deleted.
Oops, something went wrong.
151 changes: 151 additions & 0 deletions
151
src/MuTalk-Tests/RandomOperatorMutantSelectionTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
Class { | ||
#name : #RandomOperatorMutantSelectionTest, | ||
#superclass : #TestCase, | ||
#instVars : [ | ||
'coll' | ||
], | ||
#category : #'MuTalk-Tests' | ||
} | ||
|
||
{ #category : #running } | ||
RandomOperatorMutantSelectionTest >> setUp [ | ||
|
||
| mutants | | ||
super setUp. | ||
|
||
coll := OrderedCollection new. | ||
mutants := OrderedCollection new. | ||
mutants addAll: { | ||
(MethodMutation | ||
for: AuxiliarClassForTestingStrategies >> #method1 | ||
using: 'Operator1' | ||
nodeNumber: 1 | ||
ofClass: AuxiliarClassForTestingStrategies). | ||
(MethodMutation | ||
for: AuxiliarClassForTestingStrategies >> #method1 | ||
using: 'Operator2' | ||
nodeNumber: 1 | ||
ofClass: AuxiliarClassForTestingStrategies). | ||
(MethodMutation | ||
for: AuxiliarClassForTestingStrategies >> #method1 | ||
using: 'Operator3' | ||
nodeNumber: 1 | ||
ofClass: AuxiliarClassForTestingStrategies). | ||
(MethodMutation | ||
for: AuxiliarClassForTestingStrategies >> #method2 | ||
using: 'Operator1' | ||
nodeNumber: 1 | ||
ofClass: AuxiliarClassForTestingStrategies). | ||
(MethodMutation | ||
for: AuxiliarClassForTestingStrategies >> #method2 | ||
using: 'Operator2' | ||
nodeNumber: 1 | ||
ofClass: AuxiliarClassForTestingStrategies). | ||
(MethodMutation | ||
for: AuxiliarClassForTestingStrategies >> #method2 | ||
using: 'Operator3' | ||
nodeNumber: 1 | ||
ofClass: AuxiliarClassForTestingStrategies) }. | ||
coll addAll: mutants | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testFixedSelectMutantsFrom [ | ||
|
||
| select newColl | | ||
select := RandomOperatorMutantSelection fixed: 3. | ||
newColl := select selectMutantsFrom: coll. | ||
self assert: newColl size equals: 3 | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testFixedSelectMutantsFrom2 [ | ||
|
||
| select newColl | | ||
select := RandomOperatorMutantSelection fixed: 0. | ||
newColl := select selectMutantsFrom: coll. | ||
self assert: newColl equals: { } asOrderedCollection | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testFixedSelectMutantsFrom3 [ | ||
|
||
| select newColl | | ||
select := RandomOperatorMutantSelection fixed: 6. | ||
newColl := select selectMutantsFrom: coll. | ||
self assert: newColl equals: coll | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testFixedSelectMutantsFrom4 [ | ||
|
||
| select newColl | | ||
select := RandomOperatorMutantSelection fixed: 10. | ||
newColl := select selectMutantsFrom: coll. | ||
self assert: newColl equals: coll | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testFixedSelectMutantsFromDistinctElements [ | ||
|
||
| select newColl | | ||
select := RandomOperatorMutantSelection fixed: 5. | ||
newColl := select selectMutantsFrom: coll. | ||
self | ||
assert: newColl copyWithoutDuplicates asBag | ||
equals: newColl asBag | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testPercentSelectMutantsFrom [ | ||
|
||
| select newColl | | ||
select := RandomOperatorMutantSelection percent: 50. | ||
newColl := select selectMutantsFrom: coll. | ||
self assert: newColl size equals: 3 | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testPercentSelectMutantsFrom2 [ | ||
|
||
| select newColl | | ||
select := RandomOperatorMutantSelection percent: 0. | ||
newColl := select selectMutantsFrom: coll. | ||
self assert: newColl equals: { } asOrderedCollection | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testPercentSelectMutantsFrom3 [ | ||
|
||
| select newColl | | ||
select := RandomOperatorMutantSelection percent: 100. | ||
newColl := select selectMutantsFrom: coll. | ||
self assert: newColl equals: coll | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testPercentSelectMutantsFrom4 [ | ||
|
||
self | ||
should: [ RandomOperatorMutantSelection percent: -50 ] | ||
raise: Error | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testPercentSelectMutantsFrom5 [ | ||
|
||
self | ||
should: [ RandomOperatorMutantSelection percent: 150 ] | ||
raise: Error | ||
] | ||
|
||
{ #category : #tests } | ||
RandomOperatorMutantSelectionTest >> testPercentSelectMutantsFromDistinctElements [ | ||
|
||
| select newColl | | ||
select := RandomOperatorMutantSelection percent: 90. | ||
newColl := select selectMutantsFrom: coll. | ||
self | ||
assert: newColl copyWithoutDuplicates asBag | ||
equals: newColl asBag | ||
] |