Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Durieux Pol committed Nov 21, 2023
1 parent a9d3d95 commit a9d4a9e
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 205 deletions.
97 changes: 0 additions & 97 deletions src/MuTalk-Tests/FixedRandomOperatorMutantSelectionTest.class.st

This file was deleted.

108 changes: 0 additions & 108 deletions src/MuTalk-Tests/PercentRandomOperatorMutantSelectionTest.class.st

This file was deleted.

151 changes: 151 additions & 0 deletions src/MuTalk-Tests/RandomOperatorMutantSelectionTest.class.st
Original file line number Diff line number Diff line change
@@ -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
]

0 comments on commit a9d4a9e

Please sign in to comment.