diff --git a/src/MuTalk-Tests/FixedRandomOperatorMutantSelectionTest.class.st b/src/MuTalk-Tests/FixedRandomOperatorMutantSelectionTest.class.st deleted file mode 100644 index 2c3ee1a8..00000000 --- a/src/MuTalk-Tests/FixedRandomOperatorMutantSelectionTest.class.st +++ /dev/null @@ -1,97 +0,0 @@ -Class { - #name : #FixedRandomOperatorMutantSelectionTest, - #superclass : #RandomMutantSelectionTest, - #instVars : [ - 'coll' - ], - #category : #'MuTalk-Tests' -} - -{ #category : #running } -FixedRandomOperatorMutantSelectionTest >> 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 } -FixedRandomOperatorMutantSelectionTest >> testSelectMutantsFrom [ - - | select newColl | - select := FixedRandomOperatorMutantSelection new numberOfMutants: 3. - newColl := select selectMutantsFrom: coll. - self assert: newColl size equals: 3 -] - -{ #category : #tests } -FixedRandomOperatorMutantSelectionTest >> testSelectMutantsFrom2 [ - - | select newColl | - select := FixedRandomOperatorMutantSelection new numberOfMutants: 0. - newColl := select selectMutantsFrom: coll. - self assert: newColl equals: { } asOrderedCollection -] - -{ #category : #tests } -FixedRandomOperatorMutantSelectionTest >> testSelectMutantsFrom3 [ - - | select newColl | - select := FixedRandomOperatorMutantSelection new numberOfMutants: 6. - newColl := select selectMutantsFrom: coll. - self assert: newColl equals: coll -] - -{ #category : #tests } -FixedRandomOperatorMutantSelectionTest >> testSelectMutantsFrom4 [ - - | select newColl | - select := FixedRandomOperatorMutantSelection new numberOfMutants: 10. - newColl := select selectMutantsFrom: coll. - self assert: newColl equals: coll -] - -{ #category : #tests } -FixedRandomOperatorMutantSelectionTest >> testSelectMutantsFromDistinctElements [ - - | select newColl | - select := FixedRandomOperatorMutantSelection new numberOfMutants: 5. - newColl := select selectMutantsFrom: coll. - self - assert: newColl copyWithoutDuplicates asBag - equals: newColl asBag -] diff --git a/src/MuTalk-Tests/PercentRandomOperatorMutantSelectionTest.class.st b/src/MuTalk-Tests/PercentRandomOperatorMutantSelectionTest.class.st deleted file mode 100644 index 389deb4a..00000000 --- a/src/MuTalk-Tests/PercentRandomOperatorMutantSelectionTest.class.st +++ /dev/null @@ -1,108 +0,0 @@ -Class { - #name : #PercentRandomOperatorMutantSelectionTest, - #superclass : #RandomMutantSelectionTest, - #instVars : [ - 'coll' - ], - #category : #'MuTalk-Tests' -} - -{ #category : #running } -PercentRandomOperatorMutantSelectionTest >> 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 } -PercentRandomOperatorMutantSelectionTest >> testSelectMutantsFrom [ - - | select newColl | - select := PercentRandomOperatorMutantSelection new - percentageOfMutants: 50. - newColl := select selectMutantsFrom: coll. - self assert: newColl size equals: 3 -] - -{ #category : #tests } -PercentRandomOperatorMutantSelectionTest >> testSelectMutantsFrom2 [ - - | select newColl | - select := PercentRandomOperatorMutantSelection new - percentageOfMutants: 0. - newColl := select selectMutantsFrom: coll. - self assert: newColl equals: { } asOrderedCollection -] - -{ #category : #tests } -PercentRandomOperatorMutantSelectionTest >> testSelectMutantsFrom3 [ - - | select newColl | - select := PercentRandomOperatorMutantSelection new - percentageOfMutants: 100. - newColl := select selectMutantsFrom: coll. - self assert: newColl equals: coll -] - -{ #category : #tests } -PercentRandomOperatorMutantSelectionTest >> testSelectMutantsFrom4 [ - - | select | - select := PercentRandomOperatorMutantSelection new. - self should: [ select percentageOfMutants: -50 ] raise: Error -] - -{ #category : #tests } -PercentRandomOperatorMutantSelectionTest >> testSelectMutantsFrom5 [ - - | select | - select := PercentRandomOperatorMutantSelection new. - self should: [ select percentageOfMutants: 150 ] raise: Error -] - -{ #category : #tests } -PercentRandomOperatorMutantSelectionTest >> testSelectMutantsFromDistinctElements [ - - | select newColl | - select := PercentRandomOperatorMutantSelection new - percentageOfMutants: 90. - newColl := select selectMutantsFrom: coll. - self - assert: newColl copyWithoutDuplicates asBag - equals: newColl asBag -] diff --git a/src/MuTalk-Tests/RandomOperatorMutantSelectionTest.class.st b/src/MuTalk-Tests/RandomOperatorMutantSelectionTest.class.st new file mode 100644 index 00000000..bb76d729 --- /dev/null +++ b/src/MuTalk-Tests/RandomOperatorMutantSelectionTest.class.st @@ -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 +]