From ac763454217cd9c03efee7d5b49a60a6fcb43775 Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Fri, 15 Dec 2023 15:40:31 +0100 Subject: [PATCH 1/3] renames --- .../AbstractCoverageInfoPreparation.class.st | 13 ++-- ...stractMutationTestingJsonExporter.class.st | 13 ++-- .../CoveragePropagationPreparation.class.st | 45 +++++++------- src/MuTalk-CI/MutalkCI.class.st | 37 ++++++------ .../MutalkCITonelJsonExporter.class.st | 59 ++++++++++--------- .../MutalkCommandLineHandler.class.st | 21 +++---- ...AlivesMutationsGenerationStrategy.class.st | 11 ++-- src/MuTalk-CI/package.st | 2 +- src/MuTalk-Model/MTBudget.class.st | 2 +- .../MTFixedNumberOfMutantsBudget.class.st | 4 +- src/MuTalk-Model/MTFreeBudget.class.st | 2 +- .../MTPercentageOfMutantsBudget.class.st | 6 +- src/MuTalk-Model/MTTimeBudget.class.st | 2 +- .../MutantEvaluationResult.class.st | 2 +- .../MutantEvaluationResultKilled.class.st | 2 +- .../MutantEvaluationResultSurvived.class.st | 2 +- .../MutantEvaluationResultTerminated.class.st | 2 +- .../MutationTestingAnalysis.class.st | 28 ++++----- .../MutationTestingAnalysisTest.class.st | 16 ++--- 19 files changed, 138 insertions(+), 131 deletions(-) diff --git a/src/MuTalk-CI/AbstractCoverageInfoPreparation.class.st b/src/MuTalk-CI/AbstractCoverageInfoPreparation.class.st index c70703b0..376c9093 100644 --- a/src/MuTalk-CI/AbstractCoverageInfoPreparation.class.st +++ b/src/MuTalk-CI/AbstractCoverageInfoPreparation.class.st @@ -1,25 +1,26 @@ Class { - #name : #AbstractCoverageInfoPreparation, - #superclass : #Object, + #name : 'AbstractCoverageInfoPreparation', + #superclass : 'Object', #instVars : [ 'mtResult' ], - #category : #'MuTalk-CI' + #category : 'MuTalk-CI', + #package : 'MuTalk-CI' } -{ #category : #accessing } +{ #category : 'accessing' } AbstractCoverageInfoPreparation >> mtResult [ ^ mtResult ] -{ #category : #accessing } +{ #category : 'accessing' } AbstractCoverageInfoPreparation >> mtResult: anObject [ mtResult := anObject ] -{ #category : #decoration } +{ #category : 'decoration' } AbstractCoverageInfoPreparation >> prepare [ self subclassResponsibility ] diff --git a/src/MuTalk-CI/AbstractMutationTestingJsonExporter.class.st b/src/MuTalk-CI/AbstractMutationTestingJsonExporter.class.st index cf0f478b..1671bd99 100644 --- a/src/MuTalk-CI/AbstractMutationTestingJsonExporter.class.st +++ b/src/MuTalk-CI/AbstractMutationTestingJsonExporter.class.st @@ -1,25 +1,26 @@ Class { - #name : #AbstractMutationTestingJsonExporter, - #superclass : #Object, + #name : 'AbstractMutationTestingJsonExporter', + #superclass : 'Object', #instVars : [ 'mtResult' ], - #category : #'MuTalk-CI' + #category : 'MuTalk-CI', + #package : 'MuTalk-CI' } -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } AbstractMutationTestingJsonExporter >> export [ self subclassResponsibility ] -{ #category : #accessing } +{ #category : 'accessing' } AbstractMutationTestingJsonExporter >> mtResult [ ^ mtResult ] -{ #category : #accessing } +{ #category : 'accessing' } AbstractMutationTestingJsonExporter >> mtResult: anObject [ mtResult := anObject diff --git a/src/MuTalk-CI/CoveragePropagationPreparation.class.st b/src/MuTalk-CI/CoveragePropagationPreparation.class.st index 83536b9b..7020b044 100644 --- a/src/MuTalk-CI/CoveragePropagationPreparation.class.st +++ b/src/MuTalk-CI/CoveragePropagationPreparation.class.st @@ -1,6 +1,6 @@ Class { - #name : #CoveragePropagationPreparation, - #superclass : #AbstractCoverageInfoPreparation, + #name : 'CoveragePropagationPreparation', + #superclass : 'AbstractCoverageInfoPreparation', #instVars : [ 'flakyDetection', 'link', @@ -8,10 +8,11 @@ Class { 'observations', 'propagationDetected' ], - #category : #'MuTalk-CI' + #category : 'MuTalk-CI', + #package : 'MuTalk-CI' } -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> captureStateNode: aNode context: aContext object: anObject [ | temps selfobject | @@ -28,7 +29,7 @@ CoveragePropagationPreparation >> captureStateNode: aNode context: aContext obje (#object -> selfobject) } asDictionary ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> checkFlakyState: state [ | oldState | @@ -37,7 +38,7 @@ CoveragePropagationPreparation >> checkFlakyState: state [ self detectAllStateChangesState1: oldState State2: state andDo: [ :state1 :state2 :key | state1 removeKey: key ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> checkPropagationInState: state [ | oldState | @@ -49,7 +50,7 @@ CoveragePropagationPreparation >> checkPropagationInState: state [ andDo: [ :state1 :state2 :key | propagationDetected := true ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> detectAllStateChangesState1: state1 State2: state2 andDo: aBlock [ state1 isDictionary ifFalse: [ ^ state1 = state2 ]. @@ -61,7 +62,7 @@ CoveragePropagationPreparation >> detectAllStateChangesState1: state1 State2: st ^ true ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> executeAfterNode: aNode context: aContext object: anObject [ | newItem state | @@ -79,7 +80,7 @@ CoveragePropagationPreparation >> executeAfterNode: aNode context: aContext obje ifFalse: [ self checkPropagationInState: state ] ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> generateItemFor: aMutationEvaluation [ | item | @@ -94,14 +95,14 @@ CoveragePropagationPreparation >> generateItemFor: aMutationEvaluation [ ^ item ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> insertState: state [ observations add: state. counter := counter + 1 ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> installMetalinkToNode: statement [ link ifNil: [ @@ -114,7 +115,7 @@ CoveragePropagationPreparation >> installMetalinkToNode: statement [ statement link: link ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> installMetalinks: covered [ | testCase | @@ -123,13 +124,13 @@ CoveragePropagationPreparation >> installMetalinks: covered [ :statement | self installMetalinkToNode: statement ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> installMutant: aMutationEvaluation [ aMutationEvaluation mutant install. ] -{ #category : #testing } +{ #category : 'testing' } CoveragePropagationPreparation >> isChangesPropagatedTo: covered for: aMutationEvaluation [ observations := OrderedCollection new. @@ -148,7 +149,7 @@ CoveragePropagationPreparation >> isChangesPropagatedTo: covered for: aMutationE ^ propagationDetected ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> methodCoveredByFor: aMutationEvaluation [ ^ aMutationEvaluation mutantEvaluation coverageAnalysisResult @@ -157,18 +158,18 @@ CoveragePropagationPreparation >> methodCoveredByFor: aMutationEvaluation [ ] -{ #category : #decoration } +{ #category : 'decoration' } CoveragePropagationPreparation >> prepare [ | allSurvived result | result := OrderedCollection new. - allSurvived := mtResult particularResults select: #survived. + allSurvived := mtResult mutantResults select: #survived. result addAll: (allSurvived collect: [ :survived | self generateItemFor: survived ]). ^ result ] -{ #category : #controlling } +{ #category : 'controlling' } CoveragePropagationPreparation >> runTestCase: testCaseReference [ | results | @@ -178,7 +179,7 @@ CoveragePropagationPreparation >> runTestCase: testCaseReference [ ^ results ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> serializeObject: anObject level: aLevel [ | ins | @@ -190,7 +191,7 @@ CoveragePropagationPreparation >> serializeObject: anObject level: aLevel [ insName -> ins ]) asDictionary ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> testsWithSuccessfulPropagationFor: aMutationEvaluation [ | allCovered | @@ -201,13 +202,13 @@ CoveragePropagationPreparation >> testsWithSuccessfulPropagationFor: aMutationEv self isChangesPropagatedTo: covered for: aMutationEvaluation ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> uninstallMetalinks [ link uninstall ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } CoveragePropagationPreparation >> uninstallMutant: aMutationEvaluation [ aMutationEvaluation mutant uninstall diff --git a/src/MuTalk-CI/MutalkCI.class.st b/src/MuTalk-CI/MutalkCI.class.st index 09d04b42..97ea277f 100644 --- a/src/MuTalk-CI/MutalkCI.class.st +++ b/src/MuTalk-CI/MutalkCI.class.st @@ -1,14 +1,15 @@ Class { - #name : #MutalkCI, - #superclass : #Object, + #name : 'MutalkCI', + #superclass : 'Object', #instVars : [ 'project', 'commit' ], - #category : #'MuTalk-CI' + #category : 'MuTalk-CI', + #package : 'MuTalk-CI' } -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCI >> allChangesForRepo [ | repo cmt diff leafs targets | repo := self getRepo. @@ -30,7 +31,7 @@ MutalkCI >> allChangesForRepo [ ^ targets ] -{ #category : #private } +{ #category : 'private' } MutalkCI >> allClassesForRepo [ | repo | @@ -40,24 +41,24 @@ MutalkCI >> allClassesForRepo [ p package asPackage definedClasses asOrderedCollection ] ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCI >> commit [ ^ commit ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCI >> commit: anObject [ commit := anObject ] -{ #category : #private } +{ #category : 'private' } MutalkCI >> exportFileName [ ^ '__mutalk_export.json' ] -{ #category : #private } +{ #category : 'private' } MutalkCI >> exportResultJson: analysis [ | json file repo commitFrom commitTo timestamp | @@ -79,7 +80,7 @@ MutalkCI >> exportResultJson: analysis [ close ] -{ #category : #private } +{ #category : 'private' } MutalkCI >> exportResultJson: analysis coverageInfo: coverageInfo [ | json file repo commitFrom commitTo timestamp | @@ -102,7 +103,7 @@ MutalkCI >> exportResultJson: analysis coverageInfo: coverageInfo [ close ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCI >> getRepo [ IceRepository registry @@ -131,7 +132,7 @@ MutalkCI >> getRepo [ self error: 'repo not installed. ' , project ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCI >> mutateAll [ | classes tests targets | @@ -147,7 +148,7 @@ MutalkCI >> mutateAll [ SelectingFromCoverageMutantSelectionStrategy new ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCI >> mutateDiff [ | targets targetMethods tests classes | @@ -165,7 +166,7 @@ MutalkCI >> mutateDiff [ SelectingFromAlivesMutationsGenerationStrategy new ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCI >> prepareCoverageInfo: anAnalyse [ ^ CoveragePropagationPreparation new @@ -173,19 +174,19 @@ MutalkCI >> prepareCoverageInfo: anAnalyse [ prepare ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCI >> project [ ^ project ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCI >> project: anObject [ project := anObject ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCI >> recentCommit [ commit := self getRepo head commit ancestors @@ -193,7 +194,7 @@ MutalkCI >> recentCommit [ ifEmpty: [ IceNoCommit new ] ] -{ #category : #private } +{ #category : 'private' } MutalkCI >> runMutalkTargets: targets tests: tests generationStrategy: generationStrategy [ | analysis coverageInfo | diff --git a/src/MuTalk-CI/MutalkCITonelJsonExporter.class.st b/src/MuTalk-CI/MutalkCITonelJsonExporter.class.st index 9eb884f3..9d957bb5 100644 --- a/src/MuTalk-CI/MutalkCITonelJsonExporter.class.st +++ b/src/MuTalk-CI/MutalkCITonelJsonExporter.class.st @@ -1,6 +1,6 @@ Class { - #name : #MutalkCITonelJsonExporter, - #superclass : #AbstractMutationTestingJsonExporter, + #name : 'MutalkCITonelJsonExporter', + #superclass : 'AbstractMutationTestingJsonExporter', #instVars : [ 'seqNum', 'pull_request_id', @@ -9,10 +9,11 @@ Class { 'root', 'coverageInfo' ], - #category : #'MuTalk-CI' + #category : 'MuTalk-CI', + #package : 'MuTalk-CI' } -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter class >> isInTonelFormatCodeLocatedAt: aDirectoryName [ "The whole file format decision can be better resolver if delegated to the loadSpec, but this is a class method without access to it." @@ -27,50 +28,50 @@ MutalkCITonelJsonExporter class >> isInTonelFormatCodeLocatedAt: aDirectoryName ^ false ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCITonelJsonExporter >> classMutations: class [ | mutations | - mutations:= mtResult particularResults select: [ :mutationEval | + mutations:= mtResult mutantResults select: [ :mutationEval | mutationEval mutant originalClass = class ] ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> cloneLocation [ ^ cloneLocation ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> cloneLocation: anObject [ cloneLocation := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> commit [ ^ commit ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> commit: anObject [ commit := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> coverageInfo [ ^ coverageInfo ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> coverageInfo: anObject [ coverageInfo := anObject ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCITonelJsonExporter >> export [ | source_files test_cases json obj | @@ -87,7 +88,7 @@ MutalkCITonelJsonExporter >> export [ ^ json ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCITonelJsonExporter >> exportClassMutations: class [ | mutations path hash file | @@ -95,7 +96,7 @@ MutalkCITonelJsonExporter >> exportClassMutations: class [ file := self getFileOfClass: class. hash := self getHashOfFile: class. seqNum := 0. - mutations := mtResult particularResults select: [ :mutationEval | + mutations := mtResult mutantResults select: [ :mutationEval | mutationEval mutant originalClass = class ]. mutations := mutations collect: [ :mutationEval | self @@ -108,7 +109,7 @@ MutalkCITonelJsonExporter >> exportClassMutations: class [ (#mutations -> mutations asArray) } asDictionary ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCITonelJsonExporter >> exportMutationEvaluation: mutationEvaluation filePath: filePath [ | sequence_number descrption start_line end_line mutated_source result modifiedSource originalSource mutatedNode nodeToMutate offset classToCover selector mutated_lines coveredBy dictionary mutationCoverage | @@ -161,7 +162,7 @@ MutalkCITonelJsonExporter >> exportMutationEvaluation: mutationEvaluation filePa ^ dictionary ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCITonelJsonExporter >> exportTestCases [ ^ mtResult testCases collect: [ :tcase | @@ -170,7 +171,7 @@ MutalkCITonelJsonExporter >> exportTestCases [ fileName , ':' , tcase testCase selector ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCITonelJsonExporter >> extractMutatedLine: mutatedNode nodeToMutate: nodeToMutate originalSource: originalSource modifiedSource: modifiedSource [ | mSource_1 mSource_2 mSource_3 mSource ending changedLines mSource_1_break start_of_changes | @@ -201,7 +202,7 @@ MutalkCITonelJsonExporter >> extractMutatedLine: mutatedNode nodeToMutate: nodeT ^ changedLines ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCITonelJsonExporter >> generateCoveredByFor: coverageInfoItem mutationCoverage: mutationCoverage [ | class file result level testMethodName line path | @@ -223,20 +224,20 @@ MutalkCITonelJsonExporter >> generateCoveredByFor: coverageInfoItem mutationCove ^ result ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCITonelJsonExporter >> getFileOfClass: class [ ^ (cloneLocation , '/' , (self getPathOfClass: class)) asFileReference ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCITonelJsonExporter >> getHashOfFile: class [ ^ (self getFileOfClass: class) readStreamDo: [ :stream | (MD5 hashMessage: stream contents) hex ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MutalkCITonelJsonExporter >> getPathOfClass: class [ "Based on code in SmalltalkCI project" @@ -250,7 +251,7 @@ MutalkCITonelJsonExporter >> getPathOfClass: class [ ^ fileName ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> lineNumberOffsetClass: classToCover method: method in: filePath [ " From smalltalkCI " @@ -271,37 +272,37 @@ MutalkCITonelJsonExporter >> lineNumberOffsetClass: classToCover method: method ^ 0 ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> pull_request_id [ ^ pull_request_id ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> pull_request_id: anObject [ pull_request_id := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> root [ ^ root ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> root: anObject [ root := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> seqNum [ ^ seqNum ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCITonelJsonExporter >> seqNum: anObject [ seqNum := anObject diff --git a/src/MuTalk-CI/MutalkCommandLineHandler.class.st b/src/MuTalk-CI/MutalkCommandLineHandler.class.st index b990add9..8e3f3e5a 100644 --- a/src/MuTalk-CI/MutalkCommandLineHandler.class.st +++ b/src/MuTalk-CI/MutalkCommandLineHandler.class.st @@ -1,28 +1,29 @@ Class { - #name : #MutalkCommandLineHandler, - #superclass : #CommandLineHandler, + #name : 'MutalkCommandLineHandler', + #superclass : 'CommandLineHandler', #instVars : [ 'result', 'project', 'commit', 'diff' ], - #category : #'MuTalk-CI' + #category : 'MuTalk-CI', + #package : 'MuTalk-CI' } -{ #category : #accessing } +{ #category : 'accessing' } MutalkCommandLineHandler class >> commandName [ ^ 'mutalk' ] -{ #category : #accessing } +{ #category : 'accessing' } MutalkCommandLineHandler class >> description [ ^ 'Runs mutation testing' ] -{ #category : #activation } +{ #category : 'activation' } MutalkCommandLineHandler >> activate [ | noquit saveit | @@ -40,7 +41,7 @@ MutalkCommandLineHandler >> activate [ Smalltalk snapshot: saveit andQuit: noquit not ] -{ #category : #initialization } +{ #category : 'initialization' } MutalkCommandLineHandler >> hasArgument: command [ | cmd | @@ -51,14 +52,14 @@ MutalkCommandLineHandler >> hasArgument: command [ ifFound: [ :arg | ^ arg allButFirst: cmd size ] ] -{ #category : #private } +{ #category : 'private' } MutalkCommandLineHandler >> icebergProject [ MutalkCI new project: project; mutateAll ] -{ #category : #private } +{ #category : 'private' } MutalkCommandLineHandler >> icebergProjectCommit [ MutalkCI new @@ -67,7 +68,7 @@ MutalkCommandLineHandler >> icebergProjectCommit [ mutateDiff ] -{ #category : #private } +{ #category : 'private' } MutalkCommandLineHandler >> icebergProjectDiff [ MutalkCI new diff --git a/src/MuTalk-CI/SelectingFromAlivesMutationsGenerationStrategy.class.st b/src/MuTalk-CI/SelectingFromAlivesMutationsGenerationStrategy.class.st index 79764720..7c5f7b32 100644 --- a/src/MuTalk-CI/SelectingFromAlivesMutationsGenerationStrategy.class.st +++ b/src/MuTalk-CI/SelectingFromAlivesMutationsGenerationStrategy.class.st @@ -1,19 +1,20 @@ Class { - #name : #SelectingFromAlivesMutationsGenerationStrategy, - #superclass : #MutantSelectionStrategy, + #name : 'SelectingFromAlivesMutationsGenerationStrategy', + #superclass : 'MutantSelectionStrategy', #instVars : [ 'analysis' ], - #category : #'MuTalk-CI' + #category : 'MuTalk-CI', + #package : 'MuTalk-CI' } -{ #category : #accessing } +{ #category : 'accessing' } SelectingFromAlivesMutationsGenerationStrategy >> analysis: anObject [ analysis := anObject ] -{ #category : #generating } +{ #category : 'generating' } SelectingFromAlivesMutationsGenerationStrategy >> methodsToMutateFrom: aMutationTestingAnalysis [ ^ (analysis generalResult aliveMutants collect: [ :alive | diff --git a/src/MuTalk-CI/package.st b/src/MuTalk-CI/package.st index 7d48fd8d..537ec0cb 100644 --- a/src/MuTalk-CI/package.st +++ b/src/MuTalk-CI/package.st @@ -1 +1 @@ -Package { #name : #'MuTalk-CI' } +Package { #name : 'MuTalk-CI' } diff --git a/src/MuTalk-Model/MTBudget.class.st b/src/MuTalk-Model/MTBudget.class.st index 3b79322f..2125169d 100644 --- a/src/MuTalk-Model/MTBudget.class.st +++ b/src/MuTalk-Model/MTBudget.class.st @@ -29,7 +29,7 @@ MTBudget >> constraint: aConstraint [ ] { #category : 'validation' } -MTBudget >> exceedBudgetOn: partialCollection considering: initialCollection [ +MTBudget >> exceedsBudgetOn: partialCollection fromTotalMutations: initialCollection [ "Returns true if partialCollection exceed the budget (the time is over, there is enough mutants, etc). Some budgets need data on initialCollection (e.g. percentage budget needs the size)" ^ self subclassResponsibility diff --git a/src/MuTalk-Model/MTFixedNumberOfMutantsBudget.class.st b/src/MuTalk-Model/MTFixedNumberOfMutantsBudget.class.st index 0dabe799..67e2f12c 100644 --- a/src/MuTalk-Model/MTFixedNumberOfMutantsBudget.class.st +++ b/src/MuTalk-Model/MTFixedNumberOfMutantsBudget.class.st @@ -6,7 +6,7 @@ Class { } { #category : 'validation' } -MTFixedNumberOfMutantsBudget >> exceedBudgetOn: partialCollection considering: initialCollection [ +MTFixedNumberOfMutantsBudget >> exceedsBudgetOn: computedMutations fromTotalMutations: totalMutations [ - ^ partialCollection size >= constraint + ^ computedMutations size >= constraint ] diff --git a/src/MuTalk-Model/MTFreeBudget.class.st b/src/MuTalk-Model/MTFreeBudget.class.st index c66acf8d..7df9217c 100644 --- a/src/MuTalk-Model/MTFreeBudget.class.st +++ b/src/MuTalk-Model/MTFreeBudget.class.st @@ -6,7 +6,7 @@ Class { } { #category : 'validation' } -MTFreeBudget >> exceedBudgetOn: partialCollection considering: initialCollection [ +MTFreeBudget >> exceedsBudgetOn: computedMutations fromTotalMutations: totalMutations [ "Since this budget have no constraint, the budget is never exceeded" ^ false diff --git a/src/MuTalk-Model/MTPercentageOfMutantsBudget.class.st b/src/MuTalk-Model/MTPercentageOfMutantsBudget.class.st index 21f803b3..6abb08b9 100644 --- a/src/MuTalk-Model/MTPercentageOfMutantsBudget.class.st +++ b/src/MuTalk-Model/MTPercentageOfMutantsBudget.class.st @@ -6,8 +6,8 @@ Class { } { #category : 'validation' } -MTPercentageOfMutantsBudget >> exceedBudgetOn: partialCollection considering: initialCollection [ +MTPercentageOfMutantsBudget >> exceedsBudgetOn: computedMutations fromTotalMutations: totalMutations [ - ^ partialCollection size - >= (constraint / 100 * initialCollection size) + ^ computedMutations size + >= (constraint / 100 * totalMutations size) ] diff --git a/src/MuTalk-Model/MTTimeBudget.class.st b/src/MuTalk-Model/MTTimeBudget.class.st index a08b3eda..81a80501 100644 --- a/src/MuTalk-Model/MTTimeBudget.class.st +++ b/src/MuTalk-Model/MTTimeBudget.class.st @@ -9,7 +9,7 @@ Class { } { #category : 'validation' } -MTTimeBudget >> exceedBudgetOn: partialCollection considering: initialCollection [ +MTTimeBudget >> exceedsBudgetOn: computedMutations fromTotalMutations: totalMutations [ | currentTime | currentTime := Time current asMilliSeconds. diff --git a/src/MuTalk-Model/MutantEvaluationResult.class.st b/src/MuTalk-Model/MutantEvaluationResult.class.st index 92cc5465..2da345d3 100644 --- a/src/MuTalk-Model/MutantEvaluationResult.class.st +++ b/src/MuTalk-Model/MutantEvaluationResult.class.st @@ -68,7 +68,7 @@ MutantEvaluationResult >> mutantEvaluation [ ] { #category : 'accessing' } -MutantEvaluationResult >> particularResults [ +MutantEvaluationResult >> mutantResults [ self subclassResponsibility ] diff --git a/src/MuTalk-Model/MutantEvaluationResultKilled.class.st b/src/MuTalk-Model/MutantEvaluationResultKilled.class.st index 57714b2d..6df40c12 100644 --- a/src/MuTalk-Model/MutantEvaluationResultKilled.class.st +++ b/src/MuTalk-Model/MutantEvaluationResultKilled.class.st @@ -45,7 +45,7 @@ MutantEvaluationResultKilled >> killingSuggestions [ ] { #category : 'browsing' } -MutantEvaluationResultKilled >> particularResults [ +MutantEvaluationResultKilled >> mutantResults [ ^result tests ] diff --git a/src/MuTalk-Model/MutantEvaluationResultSurvived.class.st b/src/MuTalk-Model/MutantEvaluationResultSurvived.class.st index f8e5ddd4..f3c2c7d3 100644 --- a/src/MuTalk-Model/MutantEvaluationResultSurvived.class.st +++ b/src/MuTalk-Model/MutantEvaluationResultSurvived.class.st @@ -42,7 +42,7 @@ MutantEvaluationResultSurvived >> killingSuggestions [ ] { #category : 'testing' } -MutantEvaluationResultSurvived >> particularResults [ +MutantEvaluationResultSurvived >> mutantResults [ ^result tests ] diff --git a/src/MuTalk-Model/MutantEvaluationResultTerminated.class.st b/src/MuTalk-Model/MutantEvaluationResultTerminated.class.st index 583d1f2e..77b3ec3e 100644 --- a/src/MuTalk-Model/MutantEvaluationResultTerminated.class.st +++ b/src/MuTalk-Model/MutantEvaluationResultTerminated.class.st @@ -38,7 +38,7 @@ MutantEvaluationResultTerminated >> killingSuggestions [ ] { #category : 'testing' } -MutantEvaluationResultTerminated >> particularResults [ +MutantEvaluationResultTerminated >> mutantResults [ ^OrderedCollection new ] diff --git a/src/MuTalk-Model/MutationTestingAnalysis.class.st b/src/MuTalk-Model/MutationTestingAnalysis.class.st index f6070019..ae1dfb4c 100644 --- a/src/MuTalk-Model/MutationTestingAnalysis.class.st +++ b/src/MuTalk-Model/MutationTestingAnalysis.class.st @@ -4,7 +4,6 @@ Class { #instVars : [ 'modelClasses', 'operators', - 'particularResults', 'elapsedTime', 'mutantsEvaluationStrategy', 'mutations', @@ -12,7 +11,8 @@ Class { 'coverageAnalysisResult', 'logger', 'budget', - 'mutationsSelectionStrategy' + 'mutationsSelectionStrategy', + 'mutantResults' ], #category : 'MuTalk-Model', #package : 'MuTalk-Model' @@ -349,7 +349,7 @@ MutationTestingAnalysis >> coverageAnalysisResult: anObject [ { #category : 'results' } MutationTestingAnalysis >> generalResult [ ^ MutationTestingGeneralResult - for: particularResults + for: mutantResults timed: (Duration nanoSeconds: (Duration milliSeconds: elapsedTime) nanoSeconds) ] @@ -370,17 +370,17 @@ MutationTestingAnalysis >> generateMutations [ { #category : 'running' } MutationTestingAnalysis >> generateResults [ - particularResults := OrderedCollection new. + mutantResults := OrderedCollection new. mutations do: [ :aMutation | - (budget exceedBudgetOn: particularResults considering: mutations) ifTrue: [ - ^ particularResults ]. + (budget exceedsBudgetOn: mutantResults fromTotalMutations: mutations) ifTrue: [ + ^ mutantResults ]. logger logStartEvaluating: aMutation. - particularResults add: (MutantEvaluation + mutantResults add: (MutantEvaluation for: aMutation using: testCases following: mutantsEvaluationStrategy andConsidering: self coverageAnalysisResult) value ]. - ^ particularResults + ^ mutantResults ] { #category : 'running' } @@ -399,7 +399,7 @@ MutationTestingAnalysis >> initializeFor: someTestCasesReferences mutating: some operators := operatorCollection. mutationsSelectionStrategy := aMutationsGenerationStrategy. mutantsEvaluationStrategy := aMutantsEvaluationStrategy. - particularResults := OrderedCollection new. + mutantResults := OrderedCollection new. elapsedTime := 0. logger := aLogger. budget := aBudget @@ -413,6 +413,11 @@ MutationTestingAnalysis >> modelClasses [ anySatisfy: [:classToFilter | class includesBehavior: classToFilter]] ] +{ #category : 'results' } +MutationTestingAnalysis >> mutantResults [ + ^ mutantResults +] + { #category : 'accessing' } MutationTestingAnalysis >> mutantsEvaluationStrategy [ @@ -453,11 +458,6 @@ MutationTestingAnalysis >> operators [ ^operators ] -{ #category : 'results' } -MutationTestingAnalysis >> particularResults [ - ^ particularResults -] - { #category : 'running' } MutationTestingAnalysis >> run [ "Obtain mutants applying the operators in the classes (or diff --git a/src/MuTalk-Tests/MutationTestingAnalysisTest.class.st b/src/MuTalk-Tests/MutationTestingAnalysisTest.class.st index 8a6ada31..a96e562b 100644 --- a/src/MuTalk-Tests/MutationTestingAnalysisTest.class.st +++ b/src/MuTalk-Tests/MutationTestingAnalysisTest.class.st @@ -74,7 +74,7 @@ MutationTestingAnalysisTest >> testExecutingInfiniteLoopAnalysis [ analysis run. - results := analysis particularResults. + results := analysis mutantResults. self assert: results size equals: 1. mutationResult := results first. self assert: mutationResult killed @@ -95,7 +95,7 @@ MutationTestingAnalysisTest >> testExecutingInfiniteRecursionAnalysis [ analysis run. - results := analysis particularResults. + results := analysis mutantResults. self assert: results size equals: 1. mutationResult := results first. self assert: mutationResult killed @@ -110,7 +110,7 @@ MutationTestingAnalysisTest >> testExecutingSimpleMutation [ using: self plusForMinusReplacementMutation. analysis run. generalResult := analysis generalResult. - results := analysis particularResults. + results := analysis mutantResults. self assert: results size = 1. mutationResult := results first. self assert: mutationResult killed. @@ -126,7 +126,7 @@ MutationTestingAnalysisTest >> testExecutingSimpleMutationForClassMethods [ using: self selectForRejectReplacementMutation. analysis run. generalResult := analysis generalResult. - results := analysis particularResults. + results := analysis mutantResults. self assert: results size = 1. mutationResult := results first. self assert: mutationResult killed. @@ -142,7 +142,7 @@ MutationTestingAnalysisTest >> testExecutingSimpleMutationWhenNotRunnedAnalysis using: self plusForMinusReplacementMutation. "analysis run." generalResult := analysis generalResult. - results := analysis particularResults. + results := analysis mutantResults. self assert: results size = 0. self assert: generalResult numberOfEvaluatedMutants = 0 ] @@ -158,7 +158,7 @@ MutationTestingAnalysisTest >> testExecutingTwoMutantsFromDiferentMethods [ mutating: (Array with: AuxiliarClassForMutationTestingAnalysis) using: operatorSelection. analysis run. - results := analysis particularResults. + results := analysis mutantResults. self assert: results size = 2. results do: [ :mutationResult | self deny: mutationResult killed ] ] @@ -174,7 +174,7 @@ MutationTestingAnalysisTest >> testExecutingTwoMutantsFromSameMethod [ mutating: (Array with: AuxiliarClassForMutationTestingAnalysis) using: operatorSelection. analysis run. - results := analysis particularResults. + results := analysis mutantResults. self assert: results size = 2. results do: [ :mutationResult | self deny: mutationResult killed ] ] @@ -193,7 +193,7 @@ MutationTestingAnalysisTest >> testExecutingTwoMutations [ using: operatorSelection. analysis run. generalResult := analysis generalResult. - results := analysis particularResults. + results := analysis mutantResults. self assert: results size = 2. results do: [ :mutationResult | self assert: mutationResult killed ]. self assert: generalResult numberOfKilledMutants = 2 From def0e287a306a3a4550bc5ca494cd0d91ae43284 Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Fri, 15 Dec 2023 15:53:49 +0100 Subject: [PATCH 2/3] refactoring --- ...omOperatorMutantSelectionStrategy.class.st | 57 ++++--------------- 1 file changed, 11 insertions(+), 46 deletions(-) diff --git a/src/MuTalk-Model/RandomOperatorMutantSelectionStrategy.class.st b/src/MuTalk-Model/RandomOperatorMutantSelectionStrategy.class.st index 3202710e..795eb774 100644 --- a/src/MuTalk-Model/RandomOperatorMutantSelectionStrategy.class.st +++ b/src/MuTalk-Model/RandomOperatorMutantSelectionStrategy.class.st @@ -23,59 +23,24 @@ RandomOperatorMutantSelectionStrategy class >> percent: aPercentage [ { #category : 'generating' } RandomOperatorMutantSelectionStrategy >> mutationsFor: aMutationTestingAnalysis loggingIn: aLogger [ - | mutations shuffledMutations mutationDict operators operator random | + | mutations shuffledMutations mutationDict | mutations := mutationsGenerationStrategy mutationsFor: aMutationTestingAnalysis loggingIn: aLogger. + "Invariant: mutationsDict values are never empty. + If they were to be empty, we remove the entry from the dictionary." mutationDict := mutations groupedBy: [ :e | e operator ]. - operators := mutationDict keys. - shuffledMutations := OrderedCollection new. - random := Random new. + mutationDict := mutationDict collect: [ :mutationList | + mutationList shuffled readStream ]. + shuffledMutations := OrderedCollection new. 1 to: mutations size do: [ :i | - operator := self - selectOperatorFrom: operators - and: mutationDict - using: random - for: shuffledMutations. - - shuffledMutations add: (self - selectMutantFrom: mutationDict - with: operator - using: random - for: shuffledMutations) ]. + | operator operatorMutations | + operator := mutationDict keys atRandom. + operatorMutations := mutationDict at: operator. + shuffledMutations add: operatorMutations next. + operatorMutations atEnd ifTrue: [ mutationDict removeKey: operator ] ]. ^ shuffledMutations ] - -{ #category : 'selection' } -RandomOperatorMutantSelectionStrategy >> selectMutantFrom: mutationDictionnary with: anOperator using: aRandom for: newCollection [ - - | size index | - size := (mutationDictionnary at: anOperator) size. - index := aRandom nextIntegerBetween: 1 and: size. - - "If the selected mutant has already been added, another one is chosen" - [ newCollection includes: - ((mutationDictionnary at: anOperator) at: index) ] whileTrue: [ - index := aRandom nextIntegerBetween: 1 and: size ]. - - ^ (mutationDictionnary at: anOperator) at: index -] - -{ #category : 'selection' } -RandomOperatorMutantSelectionStrategy >> selectOperatorFrom: operators and: mutationDictionnary using: aRandom for: newCollection [ - - | size index | - size := operators size. - index := aRandom nextIntegerBetween: 1 and: size. - - "if all the mutants generated with a given operator have already been selected, another operator is chosen" - [ - (mutationDictionnary at: (operators at: index)) allSatisfy: [ :each | - newCollection includes: each ] ] whileTrue: [ - index := aRandom nextIntegerBetween: 1 and: size ]. - - ^ operators at: index -] From 025c06844f7a87edfa2eeb77c62c8337181d4aee Mon Sep 17 00:00:00 2001 From: Durieux Pol Date: Fri, 15 Dec 2023 16:16:30 +0100 Subject: [PATCH 3/3] rename runAnalysisFor: method --- src/MuTalk-Tests/MTBudgetTest.class.st | 13 ++++- .../MTFixedNumberOfMutantsBudgetTest.class.st | 17 +++--- .../MTPercentageOfMutantsBudgetTest.class.st | 53 +++++++------------ src/MuTalk-Tests/MTTimeBudgetTest.class.st | 20 ++++--- 4 files changed, 47 insertions(+), 56 deletions(-) diff --git a/src/MuTalk-Tests/MTBudgetTest.class.st b/src/MuTalk-Tests/MTBudgetTest.class.st index 1a6842d4..651bb02b 100644 --- a/src/MuTalk-Tests/MTBudgetTest.class.st +++ b/src/MuTalk-Tests/MTBudgetTest.class.st @@ -8,10 +8,19 @@ Class { #package : 'MuTalk-Tests' } +{ #category : 'testing' } +MTBudgetTest class >> isAbstract [ + + ^ self == MTBudgetTest +] + { #category : 'running' } -MTBudgetTest >> runAnalysisFor: aConstraint [ +MTBudgetTest >> runAnalysisFor: aBudget [ - ^ self subclassResponsibility + ^ self + runAnalysisWithBudget: aBudget + on: { AuxiliarClassForMutationTestingAnalysis } + withTests: { AuxiliarClassForMutationTestingAnalysisTest } ] { #category : 'running' } diff --git a/src/MuTalk-Tests/MTFixedNumberOfMutantsBudgetTest.class.st b/src/MuTalk-Tests/MTFixedNumberOfMutantsBudgetTest.class.st index 0bae3577..dd0d9ea4 100644 --- a/src/MuTalk-Tests/MTFixedNumberOfMutantsBudgetTest.class.st +++ b/src/MuTalk-Tests/MTFixedNumberOfMutantsBudgetTest.class.st @@ -5,19 +5,16 @@ Class { #package : 'MuTalk-Tests' } -{ #category : 'running' } -MTFixedNumberOfMutantsBudgetTest >> runAnalysisFor: aNumber [ +{ #category : 'tests' } +MTFixedNumberOfMutantsBudgetTest >> runAnalysisForFixedNumberOfMutants: aNumber [ - ^ self - runAnalysisWithBudget: (MTFixedNumberOfMutantsBudget for: aNumber) - on: { AuxiliarClassForMutationTestingAnalysis } - withTests: { AuxiliarClassForMutationTestingAnalysisTest } + self runAnalysisFor: (MTFixedNumberOfMutantsBudget for: aNumber) ] { #category : 'tests' } MTFixedNumberOfMutantsBudgetTest >> testEvaluateAllMutantsWithConstraintGreaterThanActualNumberOfMutations [ - self runAnalysisFor: 50. + self runAnalysisForFixedNumberOfMutants: 50. self assert: analysis generalResult numberOfEvaluatedMutants equals: 25 @@ -26,7 +23,7 @@ MTFixedNumberOfMutantsBudgetTest >> testEvaluateAllMutantsWithConstraintGreaterT { #category : 'tests' } MTFixedNumberOfMutantsBudgetTest >> testEvaluateTheCorrectNumberOfMutants [ - self runAnalysisFor: 10. + self runAnalysisForFixedNumberOfMutants: 10. self assert: analysis generalResult numberOfEvaluatedMutants equals: 10 @@ -35,7 +32,7 @@ MTFixedNumberOfMutantsBudgetTest >> testEvaluateTheCorrectNumberOfMutants [ { #category : 'tests' } MTFixedNumberOfMutantsBudgetTest >> testEvaluateZeroMutantsWithConstraintOfZero [ - self runAnalysisFor: 0. + self runAnalysisForFixedNumberOfMutants: 0. self assert: analysis generalResult numberOfEvaluatedMutants equals: 0 @@ -44,7 +41,7 @@ MTFixedNumberOfMutantsBudgetTest >> testEvaluateZeroMutantsWithConstraintOfZero { #category : 'tests' } MTFixedNumberOfMutantsBudgetTest >> testEvaluateZeroMutantsWithNegativeConstraint [ - self runAnalysisFor: -10. + self runAnalysisForFixedNumberOfMutants: -10. self assert: analysis generalResult numberOfEvaluatedMutants equals: 0 diff --git a/src/MuTalk-Tests/MTPercentageOfMutantsBudgetTest.class.st b/src/MuTalk-Tests/MTPercentageOfMutantsBudgetTest.class.st index a55ecfb7..77ea5f85 100644 --- a/src/MuTalk-Tests/MTPercentageOfMutantsBudgetTest.class.st +++ b/src/MuTalk-Tests/MTPercentageOfMutantsBudgetTest.class.st @@ -8,65 +8,52 @@ Class { #package : 'MuTalk-Tests' } -{ #category : 'running' } -MTPercentageOfMutantsBudgetTest >> runAnalysisFor: aPercentage [ +{ #category : 'tests' } +MTPercentageOfMutantsBudgetTest >> percentageOfEvaluatedMutants [ + + ^ analysis generalResult numberOfEvaluatedMutants + / analysis mutations size * 100 +] + +{ #category : 'tests' } +MTPercentageOfMutantsBudgetTest >> runAnalysisForPercentageOfMutants: aPercentage [ - | result | - result := self - runAnalysisWithBudget: - (MTPercentageOfMutantsBudget for: aPercentage) - on: { AuxiliarClassForMutationTestingAnalysis } - withTests: { AuxiliarClassForMutationTestingAnalysisTest }. - numberOfMutations := analysis mutations size. - ^ result + self runAnalysisFor: (MTPercentageOfMutantsBudget for: aPercentage) ] { #category : 'tests' } MTPercentageOfMutantsBudgetTest >> testEvaluateAllMutantsWithMoreThanOneHundredPercentConstraint [ - self runAnalysisFor: 120. - self - assert: - analysis generalResult numberOfEvaluatedMutants / numberOfMutations * 100 - equals: 100 + self runAnalysisForPercentageOfMutants: 120. + self assert: self percentageOfEvaluatedMutants equals: 100 ] { #category : 'tests' } MTPercentageOfMutantsBudgetTest >> testEvaluateZeroPercentOfMutantsWithNegativePercentConstraint [ - self runAnalysisFor: -10. - self - assert: - analysis generalResult numberOfEvaluatedMutants / numberOfMutations * 100 - equals: 0 + self runAnalysisForPercentageOfMutants: -10. + self assert: self percentageOfEvaluatedMutants equals: 0 ] { #category : 'tests' } MTPercentageOfMutantsBudgetTest >> testEvaluateZeroPercentOfMutantsWithZeroPercentConstraint [ - self runAnalysisFor: 0. - self - assert: - analysis generalResult numberOfEvaluatedMutants / numberOfMutations * 100 - equals: 0 + self runAnalysisForPercentageOfMutants: 0. + self assert: self percentageOfEvaluatedMutants equals: 0 ] { #category : 'tests' } MTPercentageOfMutantsBudgetTest >> testExactPercentageOfMutants [ - self runAnalysisFor: 20. - self - assert: - analysis generalResult numberOfEvaluatedMutants / numberOfMutations * 100 - equals: 20 + self runAnalysisForPercentageOfMutants: 20. + self assert: self percentageOfEvaluatedMutants equals: 20 ] { #category : 'tests' } MTPercentageOfMutantsBudgetTest >> testNonExactPercentageOfMutants [ - self runAnalysisFor: 21. - self assert: - analysis generalResult numberOfEvaluatedMutants / numberOfMutations * 100 >= 21. + self runAnalysisForPercentageOfMutants: 21. + self assert: self percentageOfEvaluatedMutants >= 21. self assert: analysis generalResult numberOfEvaluatedMutants equals: 6 diff --git a/src/MuTalk-Tests/MTTimeBudgetTest.class.st b/src/MuTalk-Tests/MTTimeBudgetTest.class.st index 52d4e2d7..f7dba289 100644 --- a/src/MuTalk-Tests/MTTimeBudgetTest.class.st +++ b/src/MuTalk-Tests/MTTimeBudgetTest.class.st @@ -8,16 +8,13 @@ Class { { #category : 'running' } MTTimeBudgetTest >> fixedAnalysisTime [ - ^ [ self runAnalysisFor: 0 seconds ] timeToRun + ^ [ self runAnalysisFor: (MTTimeBudget for: 0 seconds) ] timeToRun ] -{ #category : 'running' } -MTTimeBudgetTest >> runAnalysisFor: aDuration [ +{ #category : 'tests' } +MTTimeBudgetTest >> runAnalysisForDuration: aDuration [ - ^ self - runAnalysisWithBudget: (MTTimeBudget for: aDuration) - on: { AuxiliarClassForMTBudget } - withTests: { AuxiliarTestClassForMTBudget } + ^ self runAnalysisFor: (MTTimeBudget for: aDuration) ] { #category : 'running' } @@ -45,7 +42,7 @@ MTTimeBudgetTest >> testWithNoTimeForMutantsRespectsDeadline [ "Let's run the analysis for so much time that it will run the fixed cost (initial test run, coverage analysis) * N, making sure we will execute some mutants" fixedAnalysisTime := self fixedAnalysisTime. duration := fixedAnalysisTime / 4. - analysisTime := [ self runAnalysisFor: duration ] timeToRun. + analysisTime := [ self runAnalysisForDuration: duration ] timeToRun. "The analysis will always take at least the fixed time and not less" error := 0.2 seconds. @@ -58,7 +55,8 @@ MTTimeBudgetTest >> testWithNoTimeForMutantsRunsNoMutants [ | duration analysisTime result | "Divide duration by 4 to make sure we never have time for mutants" duration := self fixedAnalysisTime / 4. - analysisTime := [ result := self runAnalysisFor: duration ] timeToRun. + analysisTime := [ result := self runAnalysisForDuration: duration ] + timeToRun. "We never treat mutants because the budget was exceeded running the initial test run, coverage analysis, etc" self assert: result numberOfEvaluatedMutants equals: 0 @@ -70,7 +68,7 @@ MTTimeBudgetTest >> testWithTimeForMutantsRespectsDeadline [ | duration analysisTime error | "Let's run the analysis for so much time that it will run the fixed cost (initial test run, coverage analysis) * N, making sure we will execute some mutants" duration := self fixedAnalysisTime * 4. - analysisTime := [ self runAnalysisFor: duration ] timeToRun. + analysisTime := [ self runAnalysisForDuration: duration ] timeToRun. "Check if the analysis stopped after duration within the error" error := 0.2 seconds. @@ -83,7 +81,7 @@ MTTimeBudgetTest >> testWithTimeForMutantsRunsManyMutants [ | duration analysisTime result | "Let's run the analysis for so much time that it will run the fixed cost (initial test run, coverage analysis) * N, making sure we will execute some mutants" duration := self fixedAnalysisTime * 4. - analysisTime := [ result := self runAnalysisFor: duration ] timeToRun. + analysisTime := [ result := self runAnalysisForDuration: duration ] timeToRun. "We expect that in the time we gave for the analysis we should have done more than one mutant" self assert: result numberOfEvaluatedMutants > 1