Skip to content

Commit

Permalink
Merge pull request #49 from DurieuxPol/fix/3940
Browse files Browse the repository at this point in the history
Refactorings
  • Loading branch information
guillep authored Dec 15, 2023
2 parents 2772c26 + 025c068 commit 469f498
Show file tree
Hide file tree
Showing 24 changed files with 196 additions and 233 deletions.
13 changes: 7 additions & 6 deletions src/MuTalk-CI/AbstractCoverageInfoPreparation.class.st
Original file line number Diff line number Diff line change
@@ -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
]
13 changes: 7 additions & 6 deletions src/MuTalk-CI/AbstractMutationTestingJsonExporter.class.st
Original file line number Diff line number Diff line change
@@ -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
Expand Down
45 changes: 23 additions & 22 deletions src/MuTalk-CI/CoveragePropagationPreparation.class.st
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
Class {
#name : #CoveragePropagationPreparation,
#superclass : #AbstractCoverageInfoPreparation,
#name : 'CoveragePropagationPreparation',
#superclass : 'AbstractCoverageInfoPreparation',
#instVars : [
'flakyDetection',
'link',
'counter',
'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 |
Expand All @@ -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 |
Expand All @@ -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 |
Expand All @@ -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 ].
Expand All @@ -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 |
Expand All @@ -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 |
Expand All @@ -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: [
Expand All @@ -114,7 +115,7 @@ CoveragePropagationPreparation >> installMetalinkToNode: statement [
statement link: link
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
CoveragePropagationPreparation >> installMetalinks: covered [

| testCase |
Expand All @@ -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.
Expand All @@ -148,7 +149,7 @@ CoveragePropagationPreparation >> isChangesPropagatedTo: covered for: aMutationE
^ propagationDetected
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
CoveragePropagationPreparation >> methodCoveredByFor: aMutationEvaluation [

^ aMutationEvaluation mutantEvaluation coverageAnalysisResult
Expand All @@ -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 |
Expand All @@ -178,7 +179,7 @@ CoveragePropagationPreparation >> runTestCase: testCaseReference [
^ results
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
CoveragePropagationPreparation >> serializeObject: anObject level: aLevel [

| ins |
Expand All @@ -190,7 +191,7 @@ CoveragePropagationPreparation >> serializeObject: anObject level: aLevel [
insName -> ins ]) asDictionary
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
CoveragePropagationPreparation >> testsWithSuccessfulPropagationFor: aMutationEvaluation [

| allCovered |
Expand All @@ -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
Expand Down
37 changes: 19 additions & 18 deletions src/MuTalk-CI/MutalkCI.class.st
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -30,7 +31,7 @@ MutalkCI >> allChangesForRepo [
^ targets
]

{ #category : #private }
{ #category : 'private' }
MutalkCI >> allClassesForRepo [

| repo |
Expand All @@ -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 |
Expand All @@ -79,7 +80,7 @@ MutalkCI >> exportResultJson: analysis [
close
]

{ #category : #private }
{ #category : 'private' }
MutalkCI >> exportResultJson: analysis coverageInfo: coverageInfo [

| json file repo commitFrom commitTo timestamp |
Expand All @@ -102,7 +103,7 @@ MutalkCI >> exportResultJson: analysis coverageInfo: coverageInfo [
close
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
MutalkCI >> getRepo [

IceRepository registry
Expand Down Expand Up @@ -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 |
Expand All @@ -147,7 +148,7 @@ MutalkCI >> mutateAll [
SelectingFromCoverageMutantSelectionStrategy new
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
MutalkCI >> mutateDiff [

| targets targetMethods tests classes |
Expand All @@ -165,35 +166,35 @@ MutalkCI >> mutateDiff [
SelectingFromAlivesMutationsGenerationStrategy new
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
MutalkCI >> prepareCoverageInfo: anAnalyse [

^ CoveragePropagationPreparation new
mtResult: 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
ifNotEmpty: #first
ifEmpty: [ IceNoCommit new ]
]

{ #category : #private }
{ #category : 'private' }
MutalkCI >> runMutalkTargets: targets tests: tests generationStrategy: generationStrategy [

| analysis coverageInfo |
Expand Down
Loading

0 comments on commit 469f498

Please sign in to comment.