Skip to content

Commit 6cce7bb

Browse files
committed
Use #assertEmpty:
1 parent 40ff17f commit 6cce7bb

File tree

4 files changed

+59
-47
lines changed

4 files changed

+59
-47
lines changed

src/Math-Tests-FunctionFit/PMAnotherGeneticOptimizerTest.class.st

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@ PMAnotherGeneticOptimizerTest >> testEvaluate [
5353

5454
{ #category : #tests }
5555
PMAnotherGeneticOptimizerTest >> testInitializeIterations [
56-
self assert: (go bestPoints isEmpty ).
57-
go initializeIterations .
58-
self deny: (go bestPoints isEmpty ).
59-
go calcStatistics: true.
60-
go evaluate .
61-
self deny: (go bestValueHistory isEmpty ).
62-
go initializeIterations .
63-
self assert: (go bestValueHistory isEmpty )
56+
57+
self assertEmpty: go bestPoints.
58+
go initializeIterations.
59+
self denyEmpty: go bestPoints.
60+
go calcStatistics: true.
61+
go evaluate.
62+
self denyEmpty: go bestValueHistory.
63+
go initializeIterations.
64+
self assertEmpty: go bestValueHistory
6465
]
6566

6667
{ #category : #tests }
@@ -169,11 +170,12 @@ PMAnotherGeneticOptimizerTest >> testaddPointAt [
169170

170171
{ #category : #tests }
171172
PMAnotherGeneticOptimizerTest >> testcalcStatistics [
173+
172174
| s |
173175
go evaluate.
174-
self assert: go bestValueHistory isEmpty.
175-
self assert: go worstValueHistory isEmpty.
176-
self assert: go whateverHistory isEmpty.
176+
self assertEmpty: go bestValueHistory.
177+
self assertEmpty: go worstValueHistory.
178+
self assertEmpty: go whateverHistory.
177179
go calcStatistics: true.
178180
go evaluate.
179181
s := go iterations.
@@ -184,7 +186,8 @@ PMAnotherGeneticOptimizerTest >> testcalcStatistics [
184186

185187
{ #category : #tests }
186188
PMAnotherGeneticOptimizerTest >> testresetBestPoints [
187-
go evaluate .
188-
go resetBestPoints .
189-
self assert: (go bestPoints isEmpty )
189+
190+
go evaluate.
191+
go resetBestPoints.
192+
self assertEmpty: go bestPoints
190193
]

src/Math-Tests-FunctionFit/PMGeneralFunctionFitTest.class.st

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,15 @@ PMGeneralFunctionFitTest >> testRelativeError [
151151

152152
{ #category : #tests }
153153
PMGeneralFunctionFitTest >> testResetBestPoints [
154-
fit:=PMGeneralFunctionFit function: f data: col minimumValues: 0 maximumValues: 5 .
155-
fit evaluate .
156-
fit resetBestPoints.
157-
self assert: (fit optimizer bestPoints isEmpty )
154+
155+
fit := PMGeneralFunctionFit
156+
function: f
157+
data: col
158+
minimumValues: 0
159+
maximumValues: 5.
160+
fit evaluate.
161+
fit resetBestPoints.
162+
self assertEmpty: fit optimizer bestPoints
158163
]
159164

160165
{ #category : #tests }

src/Math-Tests-KDTree/PMNNStoreTest.class.st

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ PMNNStoreTest >> testCopyEmpty [
2828
| n m |
2929
n := PMNNStore newFrom: #( #( 1 $a ) #( 3 1.0 ) #( 0 '2' ) ).
3030
n := n copyEmpty.
31-
self assert: n isEmpty.
31+
self assertEmpty: n.
3232
n
3333
add: #( 2 10 );
3434
add: #( 1 100 ).
35-
self deny: n isEmpty.
35+
self denyEmpty: n.
3636
self assert: n maxDistance equals: Float infinity. "because it is not yet full"
3737
self assert: n data equals: #( 100 10 ).
3838
m := n copyEmpty.
@@ -77,7 +77,7 @@ PMNNStoreTest >> testExtremeCase [
7777
n add: #( 1 1 ). "adding should also always be possible, although it will not be added in this case"
7878
self deny: n maxDistance equals: 1.
7979
n add: (Array with: 0 - Float infinity with: 1). "and this extreme case too."
80-
self assert: n isEmpty.
80+
self assertEmpty: n.
8181
self assert: n data equals: #( ).
8282
self should: [ n add: (Array with: nil with: 1) ] raise: Error "but this should always raise an error (not only in NNStores with size 0), also in subclasses, otherwise one can have strange bugs"
8383
]
@@ -131,14 +131,15 @@ PMNNStoreTest >> testInitialize3 [
131131

132132
{ #category : #tests }
133133
PMNNStoreTest >> testNew [
134+
134135
| n |
135136
n := PMNNStore new: 1.
136-
self assert: n isEmpty.
137-
self assert: n data equals: #().
138-
self assert: n completeData equals: #().
139-
n add: #(1 2).
140-
n add: #(3 1). "will not be added"
141-
self assert: n data equals: #(2)
137+
self assertEmpty: n.
138+
self assert: n data equals: #( ).
139+
self assert: n completeData equals: #( ).
140+
n add: #( 1 2 ).
141+
n add: #( 3 1 ). "will not be added"
142+
self assert: n data equals: #( 2 )
142143
]
143144

144145
{ #category : #tests }
@@ -153,13 +154,14 @@ PMNNStoreTest >> testNew2 [
153154

154155
{ #category : #tests }
155156
PMNNStoreTest >> testNew3 [
157+
156158
| n |
157159
n := PMNNStore new: 0.
158-
self assert: n isEmpty.
160+
self assertEmpty: n.
159161
self assert: n isFull.
160162
self assert: n equals: n copyEmpty.
161-
self assert: n data equals: #().
162-
self assert: n completeData equals: #()
163+
self assert: n data equals: #( ).
164+
self assert: n completeData equals: #( )
163165
]
164166

165167
{ #category : #tests }

src/Math-Tests-Permutation/PMPermutationTest.class.st

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ self assert: i < p."
4040

4141
{ #category : #tests }
4242
PMPermutationTest >> testAsCycles [
43-
self assert: PMPermutation new asCycles isEmpty.
44-
self assert: (PMPermutation identity: 1) asCycles equals: #((1)).
45-
self assert: (PMPermutation identity: 3) asCycles equals: #((1)(2)(3)).
46-
self assert: (PMPermutation ordering: #(3 1 4 2)) asCycles equals: #((1 3 4 2)).
47-
self assert: (PMPermutation ordering: #(2 4 3 6 7 8 5 1)) asCycles equals: #((1 2 4 6 8)(3)(5 7)).
48-
self assert: (PMPermutation ordering: #(5 4 2 3 1)) asCycles equals: #((1 5)(2 4 3)).
49-
self assert: (PMPermutation ordering: #(1 2 5 3 4 6)) asCycles equals: #((1)(2)(3 5 4)(6))
43+
44+
self assertEmpty: PMPermutation new asCycles.
45+
self assert: (PMPermutation identity: 1) asCycles equals: #( #( 1 ) ).
46+
self assert: (PMPermutation identity: 3) asCycles equals: #( #( 1 ) #( 2 ) #( 3 ) ).
47+
self assert: (PMPermutation ordering: #( 3 1 4 2 )) asCycles equals: #( #( 1 3 4 2 ) ).
48+
self assert: (PMPermutation ordering: #( 2 4 3 6 7 8 5 1 )) asCycles equals: #( #( 1 2 4 6 8 ) #( 3 ) #( 5 7 ) ).
49+
self assert: (PMPermutation ordering: #( 5 4 2 3 1 )) asCycles equals: #( #( 1 5 ) #( 2 4 3 ) ).
50+
self assert: (PMPermutation ordering: #( 1 2 5 3 4 6 )) asCycles equals: #( #( 1 ) #( 2 ) #( 3 5 4 ) #( 6 ) )
5051
]
5152

5253
{ #category : #tests }
@@ -99,16 +100,17 @@ PMPermutationTest >> testExtendTo [
99100

100101
{ #category : #'class tests' }
101102
PMPermutationTest >> testFromCycles [
102-
self assert: (PMPermutation fromCycles: #()) isEmpty.
103-
self assert: (PMPermutation fromCycles: #(#())) isEmpty.
104-
self assert: (PMPermutation fromCycles: #(#(1))) equals: #(1).
105-
self assert: (PMPermutation size: 3 fromCycles: #()) equals: #(1 2 3).
106-
self assert: (PMPermutation size: 3 fromCycles: #(#())) equals: #(1 2 3).
107-
self assert: (PMPermutation fromCycles: #(#(1 3 4 2))) equals: #(3 1 4 2).
108-
self assert: (PMPermutation fromCycles: #(#(1 2 4 6 8) #(5 7))) equals: #(2 4 3 6 7 8 5 1).
109-
self assert: (PMPermutation fromCycles: #(#(1 5) #(2 4 3))) equals: #(5 4 2 3 1).
110-
self assert: (PMPermutation fromCycles: #(#(1) #(3 5 4) #(6) #(2))) equals: #(1 2 5 3 4 6).
111-
self assert: (PMPermutation size: 6 fromCycles: #(#(3 5 4))) equals: #(1 2 5 3 4 6)
103+
104+
self assertEmpty: (PMPermutation fromCycles: #( )).
105+
self assertEmpty: (PMPermutation fromCycles: #( #( ) )).
106+
self assert: (PMPermutation fromCycles: #( #( 1 ) )) equals: #( 1 ).
107+
self assert: (PMPermutation size: 3 fromCycles: #( )) equals: #( 1 2 3 ).
108+
self assert: (PMPermutation size: 3 fromCycles: #( #( ) )) equals: #( 1 2 3 ).
109+
self assert: (PMPermutation fromCycles: #( #( 1 3 4 2 ) )) equals: #( 3 1 4 2 ).
110+
self assert: (PMPermutation fromCycles: #( #( 1 2 4 6 8 ) #( 5 7 ) )) equals: #( 2 4 3 6 7 8 5 1 ).
111+
self assert: (PMPermutation fromCycles: #( #( 1 5 ) #( 2 4 3 ) )) equals: #( 5 4 2 3 1 ).
112+
self assert: (PMPermutation fromCycles: #( #( 1 ) #( 3 5 4 ) #( 6 ) #( 2 ) )) equals: #( 1 2 5 3 4 6 ).
113+
self assert: (PMPermutation size: 6 fromCycles: #( #( 3 5 4 ) )) equals: #( 1 2 5 3 4 6 )
112114
]
113115

114116
{ #category : #'class tests' }

0 commit comments

Comments
 (0)