From 00a42d203122d44f6e91cc93b19daff8dbd9d8fc Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Wed, 13 Dec 2023 12:05:45 +0100 Subject: [PATCH 1/9] Added = method for method mutations, and used it in compareMutationsOf:and: --- src/MuTalk-Model/MethodMutation.class.st | 10 ++++++++++ src/MuTalk-Tests/RandomMutantSelectionTest.class.st | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index c1e2aafe..2b8a9d60 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -23,6 +23,16 @@ MethodMutation class >> for: aMethod using: anOperatorApplied nodeNumber: aNodeN yourself ] +{ #category : 'comparing' } +MethodMutation >> = anObject [ +"Two method mutations are equals if they have the same operator, and if they mutate the same method from the same class" + + anObject species = self class ifFalse: [ ^ false ]. + ^ self operator species = anObject operator species and: [ + self originalMethod = anObject originalMethod and: [ + self originalClass = anObject originalClass ] ] +] + { #category : 'initialize-release' } MethodMutation >> initializeFor: aMethod using: anOperatorApplied nodeNumber: aNodeNumber ofClass: aClass [ originalMethod := aMethod. diff --git a/src/MuTalk-Tests/RandomMutantSelectionTest.class.st b/src/MuTalk-Tests/RandomMutantSelectionTest.class.st index 59b068e2..afd5b0d8 100644 --- a/src/MuTalk-Tests/RandomMutantSelectionTest.class.st +++ b/src/MuTalk-Tests/RandomMutantSelectionTest.class.st @@ -13,9 +13,7 @@ RandomMutantSelectionTest >> compareMutationsOf: mutations1 and: mutations2 [ 1 to: mutations1 size do: [ :i | mutant1 := mutations1 at: i. mutant2 := mutations2 at: i. - (mutant1 operator species = mutant2 operator species and: [ - ( mutant1 originalMethod = mutant2 originalMethod ) and: [ - mutant1 originalClass = mutant2 originalClass ] ]) ifFalse: [ + mutant1 = mutant2 ifFalse: [ ^ false ] ]. ^ true ] From f56478f8624a743faf4150979d27fe761e98e0c6 Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Wed, 13 Dec 2023 16:19:35 +0100 Subject: [PATCH 2/9] changed tests --- src/MuTalk-Model/MethodMutation.class.st | 18 ++++++-- .../RandomMutantSelectionTest.class.st | 46 ++++++++++++------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index 2b8a9d60..2451efed 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -25,12 +25,14 @@ MethodMutation class >> for: aMethod using: anOperatorApplied nodeNumber: aNodeN { #category : 'comparing' } MethodMutation >> = anObject [ -"Two method mutations are equals if they have the same operator, and if they mutate the same method from the same class" - + "Two method mutations are equals if they have the same operator, and if they mutate the same method from the same class" + anObject species = self class ifFalse: [ ^ false ]. - ^ self operator species = anObject operator species and: [ - self originalMethod = anObject originalMethod and: [ - self originalClass = anObject originalClass ] ] + self operator species = anObject operator species ifFalse: [ ^ false ]. + self originalMethod = anObject originalMethod ifFalse: [ ^ false ]. + self originalClass = anObject originalClass ifFalse: [ ^ false ]. + self nodeNumber = anObject nodeNumber ifFalse: [ ^ false ]. + ^ true ] { #category : 'initialize-release' } @@ -63,6 +65,12 @@ MethodMutation >> mutatedNode [ ^ operator applyTo: self nodeToMutate ] +{ #category : 'accessing' } +MethodMutation >> nodeNumber [ + + ^ nodeNumber +] + { #category : 'accessing' } MethodMutation >> nodeNumber: anInteger [ nodeNumber := anInteger diff --git a/src/MuTalk-Tests/RandomMutantSelectionTest.class.st b/src/MuTalk-Tests/RandomMutantSelectionTest.class.st index afd5b0d8..ecd81300 100644 --- a/src/MuTalk-Tests/RandomMutantSelectionTest.class.st +++ b/src/MuTalk-Tests/RandomMutantSelectionTest.class.st @@ -5,8 +5,21 @@ Class { #package : 'MuTalk-Tests' } +{ #category : 'accessing' } +RandomMutantSelectionTest >> atLeastTwoDifferentMutantCollectionsIn: aCollection [ + + | res | + 1 to: aCollection size - 1 do: [ :i | + i + 1 to: aCollection size do: [ :j | + (self sameMutationsIn: (aCollection at: i) and: (aCollection at: j)) + ifFalse: [ res := false ] ] ]. + res ifNil: [ res := true ]. + 1halt. + ^ res +] + { #category : 'comparing' } -RandomMutantSelectionTest >> compareMutationsOf: mutations1 and: mutations2 [ +RandomMutantSelectionTest >> sameMutationsIn: mutations1 and: mutations2 [ | mutant1 mutant2 | mutations1 size = mutations2 size ifFalse: [ ^ false ]. @@ -29,20 +42,19 @@ RandomMutantSelectionTest >> testDefaultMutationsGenerationStrategyIsAllMutantSe { #category : 'tests' } RandomMutantSelectionTest >> testExecutingGenerateMutationsTwoTimesGivesTwoDifferentSetsOfMutations [ - | analysis mutations1 mutations2 | - analysis := MutationTestingAnalysis - testCasesFrom: - { AuxiliarClassForMutationTestingAnalysisTest } - mutating: { AuxiliarClassForMutationTestingAnalysis } - using: MutantOperator contents - with: AllTestsMethodsRunningTestSelectionStrategy new - with: RandomMutantSelectionStrategy new. - - - mutations1 := analysis generateMutations. - "If there are already mutations for the analysis, it doesn't re-generate mutations, so we need to reset them" - analysis mutations: nil. - mutations2 := analysis generateMutations. - - self deny: (self compareMutationsOf: mutations1 and: mutations2) + | analysis mutationSet | + "mutationSet is a set of collections of mutants" + mutationSet := Set new. + 1 to: 5 do: [ :i | 1 halt. + analysis := MutationTestingAnalysis + testCasesFrom: + { AuxiliarClassForMutationTestingAnalysisTest } + mutating: { AuxiliarClassForMutationTestingAnalysis } + using: MutantOperator contents + with: AllTestsMethodsRunningTestSelectionStrategy new + with: AllMutantSelectionStrategy new. + + mutationSet add: (analysis generateMutations at: 1) ]. + + self assert: mutationSet size equals: 25 ] From 3d12b5592ed80835f1bf9f4fc7ab6433e3cbc424 Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Thu, 14 Dec 2023 11:44:04 +0100 Subject: [PATCH 3/9] add hash method and update comments --- src/MuTalk-Model/MethodMutation.class.st | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index 2451efed..f81f0d1e 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -25,7 +25,7 @@ MethodMutation class >> for: aMethod using: anOperatorApplied nodeNumber: aNodeN { #category : 'comparing' } MethodMutation >> = anObject [ - "Two method mutations are equals if they have the same operator, and if they mutate the same method from the same class" + "Two method mutations are equals if they have the same operator,if they mutate the same method from the same class, and if they have the same node number" anObject species = self class ifFalse: [ ^ false ]. self operator species = anObject operator species ifFalse: [ ^ false ]. @@ -35,6 +35,13 @@ MethodMutation >> = anObject [ ^ true ] +{ #category : 'comparing' } +MethodMutation >> hash [ + + ^ self operator species hash + self originalMethod hash + + self originalClass hash + self nodeNumber hash +] + { #category : 'initialize-release' } MethodMutation >> initializeFor: aMethod using: anOperatorApplied nodeNumber: aNodeNumber ofClass: aClass [ originalMethod := aMethod. From 3039baaa35c311faf418da04470bd2c889b0f4c4 Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Thu, 14 Dec 2023 11:49:45 +0100 Subject: [PATCH 4/9] update methods, add comments, rename classes --- ...RandomMutantSelectionStrategyTest.class.st | 63 +++++++++++++++++++ .../RandomMutantSelectionTest.class.st | 60 ------------------ ...eratorMutantSelectionStrategyTest.class.st | 6 ++ ...RandomOperatorMutantSelectionTest.class.st | 6 -- 4 files changed, 69 insertions(+), 66 deletions(-) create mode 100644 src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st delete mode 100644 src/MuTalk-Tests/RandomMutantSelectionTest.class.st create mode 100644 src/MuTalk-Tests/RandomOperatorMutantSelectionStrategyTest.class.st delete mode 100644 src/MuTalk-Tests/RandomOperatorMutantSelectionTest.class.st diff --git a/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st b/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st new file mode 100644 index 00000000..3e67f452 --- /dev/null +++ b/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st @@ -0,0 +1,63 @@ +Class { + #name : 'RandomMutantSelectionStrategyTest', + #superclass : 'TestCase', + #category : 'MuTalk-Tests', + #package : 'MuTalk-Tests' +} + +{ #category : 'accessing' } +RandomMutantSelectionStrategyTest >> atLeastTwoDifferentMutantCollectionsIn: aCollection [ + "aCollection is a collection of mutant collections. This method returns true if among these mutant collections, at least 2 are differents." + + 1 to: aCollection size - 1 do: [ :i | + i + 1 to: aCollection size do: [ :j | + "By iterating like this, we ensure to compare each mutant collection with every other collections + For example, when i = 1, 2 <= j <= 5, when i = 2, 3 <= j <= 5 (collection 2 and collection 1 have already been compared previously), etc" + (self + sameMutationOrderIn: (aCollection at: i) + and: (aCollection at: j)) ifFalse: [ ^ true ] ] ]. + ^ false +] + +{ #category : 'comparing' } +RandomMutantSelectionStrategyTest >> sameMutationOrderIn: mutantCollection1 and: mutantCollection2 [ + "Compares the order of the mutants in 2 mutant collections. The mutants may be the same in both collections, but we check if they are in the same order + Returns true if they are in the same order, else false" + + | mutant1 mutant2 | + mutantCollection1 size = mutantCollection2 size ifFalse: [ ^ false ]. + 1 to: mutantCollection1 size do: [ :i | + mutant1 := mutantCollection1 at: i. + mutant2 := mutantCollection2 at: i. + mutant1 = mutant2 ifFalse: [ ^ false ] ]. + ^ true +] + +{ #category : 'tests' } +RandomMutantSelectionStrategyTest >> testAtLeastTwoDifferentMutantCollectionsAmongFive [ + "Here, two mutant collections are differents when their mutants are not in the same order" + + | analysis mutationsCollection | + "mutationsCollection is a collection of mutant collections" + mutationsCollection := OrderedCollection new. + 1 to: 5 do: [ :i | + analysis := MutationTestingAnalysis + testCasesFrom: + { AuxiliarClassForMutationTestingAnalysisTest } + mutating: { AuxiliarClassForMutationTestingAnalysis } + using: MutantOperator contents + with: AllTestsMethodsRunningTestSelectionStrategy new + with: RandomMutantSelectionStrategy new. + mutationsCollection add: analysis generateMutations ]. + + self assert: + (self atLeastTwoDifferentMutantCollectionsIn: mutationsCollection) +] + +{ #category : 'tests' } +RandomMutantSelectionStrategyTest >> testDefaultMutationsGenerationStrategyIsAllMutantSelectionStrategy [ + + self + assert: RandomMutantSelectionStrategy new mutationsGenerationStrategy species + equals: AllMutantSelectionStrategy new species +] diff --git a/src/MuTalk-Tests/RandomMutantSelectionTest.class.st b/src/MuTalk-Tests/RandomMutantSelectionTest.class.st deleted file mode 100644 index ecd81300..00000000 --- a/src/MuTalk-Tests/RandomMutantSelectionTest.class.st +++ /dev/null @@ -1,60 +0,0 @@ -Class { - #name : 'RandomMutantSelectionTest', - #superclass : 'TestCase', - #category : 'MuTalk-Tests', - #package : 'MuTalk-Tests' -} - -{ #category : 'accessing' } -RandomMutantSelectionTest >> atLeastTwoDifferentMutantCollectionsIn: aCollection [ - - | res | - 1 to: aCollection size - 1 do: [ :i | - i + 1 to: aCollection size do: [ :j | - (self sameMutationsIn: (aCollection at: i) and: (aCollection at: j)) - ifFalse: [ res := false ] ] ]. - res ifNil: [ res := true ]. - 1halt. - ^ res -] - -{ #category : 'comparing' } -RandomMutantSelectionTest >> sameMutationsIn: mutations1 and: mutations2 [ - - | mutant1 mutant2 | - mutations1 size = mutations2 size ifFalse: [ ^ false ]. - 1 to: mutations1 size do: [ :i | - mutant1 := mutations1 at: i. - mutant2 := mutations2 at: i. - mutant1 = mutant2 ifFalse: [ - ^ false ] ]. - ^ true -] - -{ #category : 'tests' } -RandomMutantSelectionTest >> testDefaultMutationsGenerationStrategyIsAllMutantSelectionStrategy [ - - self - assert: RandomMutantSelectionStrategy new mutationsGenerationStrategy species - equals: AllMutantSelectionStrategy new species -] - -{ #category : 'tests' } -RandomMutantSelectionTest >> testExecutingGenerateMutationsTwoTimesGivesTwoDifferentSetsOfMutations [ - - | analysis mutationSet | - "mutationSet is a set of collections of mutants" - mutationSet := Set new. - 1 to: 5 do: [ :i | 1 halt. - analysis := MutationTestingAnalysis - testCasesFrom: - { AuxiliarClassForMutationTestingAnalysisTest } - mutating: { AuxiliarClassForMutationTestingAnalysis } - using: MutantOperator contents - with: AllTestsMethodsRunningTestSelectionStrategy new - with: AllMutantSelectionStrategy new. - - mutationSet add: (analysis generateMutations at: 1) ]. - - self assert: mutationSet size equals: 25 -] diff --git a/src/MuTalk-Tests/RandomOperatorMutantSelectionStrategyTest.class.st b/src/MuTalk-Tests/RandomOperatorMutantSelectionStrategyTest.class.st new file mode 100644 index 00000000..2d47ae6b --- /dev/null +++ b/src/MuTalk-Tests/RandomOperatorMutantSelectionStrategyTest.class.st @@ -0,0 +1,6 @@ +Class { + #name : 'RandomOperatorMutantSelectionStrategyTest', + #superclass : 'RandomMutantSelectionStrategyTest', + #category : 'MuTalk-Tests', + #package : 'MuTalk-Tests' +} diff --git a/src/MuTalk-Tests/RandomOperatorMutantSelectionTest.class.st b/src/MuTalk-Tests/RandomOperatorMutantSelectionTest.class.st deleted file mode 100644 index d1dce6be..00000000 --- a/src/MuTalk-Tests/RandomOperatorMutantSelectionTest.class.st +++ /dev/null @@ -1,6 +0,0 @@ -Class { - #name : 'RandomOperatorMutantSelectionTest', - #superclass : 'RandomMutantSelectionTest', - #category : 'MuTalk-Tests', - #package : 'MuTalk-Tests' -} From 67178126f70023cbef1491fa51c66580d2ce42f3 Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Thu, 14 Dec 2023 14:23:41 +0100 Subject: [PATCH 5/9] protocol fix --- src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st b/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st index 3e67f452..afee4ede 100644 --- a/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st +++ b/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st @@ -5,7 +5,7 @@ Class { #package : 'MuTalk-Tests' } -{ #category : 'accessing' } +{ #category : 'comparing' } RandomMutantSelectionStrategyTest >> atLeastTwoDifferentMutantCollectionsIn: aCollection [ "aCollection is a collection of mutant collections. This method returns true if among these mutant collections, at least 2 are differents." From 9f63a6c852449c90720b45d7a488235ba9b6e6fa Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Thu, 14 Dec 2023 14:34:52 +0100 Subject: [PATCH 6/9] add comments --- src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st b/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st index afee4ede..1a51c9a3 100644 --- a/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st +++ b/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st @@ -35,7 +35,9 @@ RandomMutantSelectionStrategyTest >> sameMutationOrderIn: mutantCollection1 and: { #category : 'tests' } RandomMutantSelectionStrategyTest >> testAtLeastTwoDifferentMutantCollectionsAmongFive [ - "Here, two mutant collections are differents when their mutants are not in the same order" + "This test is to ensure that RandomMutantSelectionStrategy doesn't always produce the same mutant collections. + If it can produce at least two different collections, we assume it correctly randomize the inital mutant collection. + Here, two mutant collections are differents when their mutants are not in the same order." | analysis mutationsCollection | "mutationsCollection is a collection of mutant collections" From 80fee12d3c9e182cc9716c36af072279094376f7 Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Thu, 14 Dec 2023 14:45:09 +0100 Subject: [PATCH 7/9] add condition in = --- src/MuTalk-Model/MethodMutation.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index f81f0d1e..a3f8d462 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -27,6 +27,7 @@ MethodMutation class >> for: aMethod using: anOperatorApplied nodeNumber: aNodeN MethodMutation >> = anObject [ "Two method mutations are equals if they have the same operator,if they mutate the same method from the same class, and if they have the same node number" + self == anObject ifTrue: [ ^ true ]. anObject species = self class ifFalse: [ ^ false ]. self operator species = anObject operator species ifFalse: [ ^ false ]. self originalMethod = anObject originalMethod ifFalse: [ ^ false ]. From 1a7eae5856ca999e998b4be66345e455e2c7abe1 Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Fri, 15 Dec 2023 12:16:01 +0100 Subject: [PATCH 8/9] using a set of mutant collections --- ...RandomMutantSelectionStrategyTest.class.st | 40 +++---------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st b/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st index 1a51c9a3..02333e97 100644 --- a/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st +++ b/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st @@ -5,43 +5,15 @@ Class { #package : 'MuTalk-Tests' } -{ #category : 'comparing' } -RandomMutantSelectionStrategyTest >> atLeastTwoDifferentMutantCollectionsIn: aCollection [ - "aCollection is a collection of mutant collections. This method returns true if among these mutant collections, at least 2 are differents." - - 1 to: aCollection size - 1 do: [ :i | - i + 1 to: aCollection size do: [ :j | - "By iterating like this, we ensure to compare each mutant collection with every other collections - For example, when i = 1, 2 <= j <= 5, when i = 2, 3 <= j <= 5 (collection 2 and collection 1 have already been compared previously), etc" - (self - sameMutationOrderIn: (aCollection at: i) - and: (aCollection at: j)) ifFalse: [ ^ true ] ] ]. - ^ false -] - -{ #category : 'comparing' } -RandomMutantSelectionStrategyTest >> sameMutationOrderIn: mutantCollection1 and: mutantCollection2 [ - "Compares the order of the mutants in 2 mutant collections. The mutants may be the same in both collections, but we check if they are in the same order - Returns true if they are in the same order, else false" - - | mutant1 mutant2 | - mutantCollection1 size = mutantCollection2 size ifFalse: [ ^ false ]. - 1 to: mutantCollection1 size do: [ :i | - mutant1 := mutantCollection1 at: i. - mutant2 := mutantCollection2 at: i. - mutant1 = mutant2 ifFalse: [ ^ false ] ]. - ^ true -] - { #category : 'tests' } RandomMutantSelectionStrategyTest >> testAtLeastTwoDifferentMutantCollectionsAmongFive [ "This test is to ensure that RandomMutantSelectionStrategy doesn't always produce the same mutant collections. If it can produce at least two different collections, we assume it correctly randomize the inital mutant collection. Here, two mutant collections are differents when their mutants are not in the same order." - | analysis mutationsCollection | - "mutationsCollection is a collection of mutant collections" - mutationsCollection := OrderedCollection new. + | analysis mutationsSet | + "mutationsSet is a set of mutant collections" + mutationsSet := Set new. 1 to: 5 do: [ :i | analysis := MutationTestingAnalysis testCasesFrom: @@ -50,10 +22,10 @@ RandomMutantSelectionStrategyTest >> testAtLeastTwoDifferentMutantCollectionsAmo using: MutantOperator contents with: AllTestsMethodsRunningTestSelectionStrategy new with: RandomMutantSelectionStrategy new. - mutationsCollection add: analysis generateMutations ]. + mutationsSet add: analysis generateMutations ]. - self assert: - (self atLeastTwoDifferentMutantCollectionsIn: mutationsCollection) + "If the size of the set is at least 2, there is at least 2 different mutant collections, so at least 2 different orders of mutants." + self assert: mutationsSet size >= 2 ] { #category : 'tests' } From ccc79a72ee3b438b5141fb8f7659486798ab14d7 Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Fri, 15 Dec 2023 15:05:08 +0100 Subject: [PATCH 9/9] add template method --- .../RandomMutantSelectionStrategyTest.class.st | 10 ++++++++-- .../RandomOperatorMutantSelectionStrategyTest.class.st | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st b/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st index 02333e97..9287d72d 100644 --- a/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st +++ b/src/MuTalk-Tests/RandomMutantSelectionStrategyTest.class.st @@ -5,6 +5,12 @@ Class { #package : 'MuTalk-Tests' } +{ #category : 'accessing' } +RandomMutantSelectionStrategyTest >> classToTest [ + + ^ RandomMutantSelectionStrategy +] + { #category : 'tests' } RandomMutantSelectionStrategyTest >> testAtLeastTwoDifferentMutantCollectionsAmongFive [ "This test is to ensure that RandomMutantSelectionStrategy doesn't always produce the same mutant collections. @@ -21,7 +27,7 @@ RandomMutantSelectionStrategyTest >> testAtLeastTwoDifferentMutantCollectionsAmo mutating: { AuxiliarClassForMutationTestingAnalysis } using: MutantOperator contents with: AllTestsMethodsRunningTestSelectionStrategy new - with: RandomMutantSelectionStrategy new. + with: self classToTest new. mutationsSet add: analysis generateMutations ]. "If the size of the set is at least 2, there is at least 2 different mutant collections, so at least 2 different orders of mutants." @@ -32,6 +38,6 @@ RandomMutantSelectionStrategyTest >> testAtLeastTwoDifferentMutantCollectionsAmo RandomMutantSelectionStrategyTest >> testDefaultMutationsGenerationStrategyIsAllMutantSelectionStrategy [ self - assert: RandomMutantSelectionStrategy new mutationsGenerationStrategy species + assert: self classToTest new mutationsGenerationStrategy species equals: AllMutantSelectionStrategy new species ] diff --git a/src/MuTalk-Tests/RandomOperatorMutantSelectionStrategyTest.class.st b/src/MuTalk-Tests/RandomOperatorMutantSelectionStrategyTest.class.st index 2d47ae6b..cf072f6c 100644 --- a/src/MuTalk-Tests/RandomOperatorMutantSelectionStrategyTest.class.st +++ b/src/MuTalk-Tests/RandomOperatorMutantSelectionStrategyTest.class.st @@ -4,3 +4,9 @@ Class { #category : 'MuTalk-Tests', #package : 'MuTalk-Tests' } + +{ #category : 'accessing' } +RandomOperatorMutantSelectionStrategyTest >> classToTest [ + + ^ RandomOperatorMutantSelectionStrategy +]