Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Durieux Pol committed Jan 26, 2024
1 parent 940ad87 commit d969f87
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Class {
#name : 'MTAuxiliarClassForMutantOperatorAnalysis',
#superclass : 'Object',
#category : 'MuTalk-Utilities-Tests',
#package : 'MuTalk-Utilities-Tests'
}

{ #category : 'as yet unclassified' }
MTAuxiliarClassForMutantOperatorAnalysis >> methodA [

| result |
result := 1 + 1.
^ result
]

{ #category : 'as yet unclassified' }
MTAuxiliarClassForMutantOperatorAnalysis >> methodB [

false ifFalse: [ ^ 1 ]
]
38 changes: 24 additions & 14 deletions src/MuTalk-Utilities-Tests/MTMutantOperatorAnalysisTest.class.st
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
Class {
#name : 'MTMutantOperatorAnalysisTest',
#superclass : 'TestCase',
#instVars : [
'operatorAnalysis'
],
#category : 'MuTalk-Utilities-Tests',
#package : 'MuTalk-Utilities-Tests'
}

{ #category : 'running' }
MTMutantOperatorAnalysisTest >> setUp [

super setUp.

operatorAnalysis := MTMutantOperatorAnalysis forClasses:
{ MTAuxiliarClassForMutantOperatorAnalysis }
]

{ #category : 'tests' }
MTMutantOperatorAnalysisTest >> testGetAllOperators [

| actual expected |
actual := (MTMutantOperatorAnalysis new
operatorsProducingOver: 0
mutantsFor: { 'MuTalk-Utilities-Tests' }) keys asSet.
actual := (operatorAnalysis operatorsProducingOverXMutants: 0) keys
asSet.
expected := (MTMutantOperator contentsAll collect: #species) asSet.

self assert: actual equals: expected
Expand All @@ -21,13 +32,12 @@ MTMutantOperatorAnalysisTest >> testGetAllOperators [
MTMutantOperatorAnalysisTest >> testOperatorsProducingOver [

| actual expected |
actual := (MTMutantOperatorAnalysis new
operatorsProducingOver: 3
mutantsFor: { 'MuTalk-Utilities-Tests' }) keys asSet.
actual := (operatorAnalysis operatorsProducingOverXMutants: 3) keys
asSet.
expected := Set
with: MTEmptyMethodOperator
with: MTRemoveCaretOperator
with: MTMessageSendToYourselfOperator.
with: MTLiteralIntegersIncreaseOperator
with: MTLiteralIntegersToZeroOperator
with: MTLiteralIntegersDecreaseOperator.

self assert: actual equals: expected
]
Expand All @@ -36,14 +46,14 @@ MTMutantOperatorAnalysisTest >> testOperatorsProducingOver [
MTMutantOperatorAnalysisTest >> testOperatorsProducingUnder [

| actual expected |
actual := (MTMutantOperatorAnalysis new
operatorsProducingUnder: 3
mutantsFor: { 'MuTalk-Utilities-Tests' }) keys asSet.
actual := (operatorAnalysis operatorsProducingUnderXMutants: 2) keys
asSet.
expected := (MTMutantOperator contentsAll collect: #species) asSet
reject: [ :operator |
{
MTEmptyMethodOperator.
MTMessageSendToYourselfOperator } includes: operator ].
MTLiteralIntegersIncreaseOperator.
MTLiteralIntegersToZeroOperator.
MTLiteralIntegersDecreaseOperator } includes: operator ].

self assert: actual equals: expected
]

0 comments on commit d969f87

Please sign in to comment.