Skip to content

Commit 67a27e1

Browse files
Fix failing tests for Pharo 9
1 parent 0cf1de1 commit 67a27e1

File tree

6 files changed

+50
-38
lines changed

6 files changed

+50
-38
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,14 @@ self assert: (go bestValueHistory isEmpty ).
6262

6363
{ #category : #tests }
6464
PMAnotherGeneticOptimizerTest >> testPrint [
65-
|aStream s|
66-
aStream :=ReadWriteStream with:''.
67-
go printOn: aStream .
68-
s :=aStream contents .
69-
self assert: (s includesSubstring: 'v * v').
70-
self assert: (s includesSubstring: '50').
71-
self assert: (s includesSubstring: '20').
65+
66+
| aStream s |
67+
aStream := ReadWriteStream with: ''.
68+
go printOn: aStream.
69+
s := aStream contents.
70+
self assert: (s includesSubstring: 'v*v').
71+
self assert: (s includesSubstring: '50').
72+
self assert: (s includesSubstring: '20')
7273
]
7374

7475
{ #category : #tests }

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

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ Class {
88
}
99

1010
{ #category : #running }
11-
PMErrorAsParameterFunctionTest >> setUp [
12-
|col|
13-
f:=PMErrorOfParameterFunction new function: [:x :a :b|a*x / (b+x)].
14-
col:=(1 to: 3)collect: [:i|i@(f function cull: i cull: 1 cull: 1) ].
15-
f data: col.
16-
f :=PMErrorAsParameterFunction new function: f.
11+
PMErrorAsParameterFunctionTest >> setUp [
12+
13+
| col |
14+
f := PMErrorOfParameterFunction new function: [ :x :a :b |
15+
a * x / (b + x) ].
16+
col := (1 to: 3) collect: [ :i |
17+
i @ (f function cull: i cull: 1 cull: 1) ].
18+
f data: col.
19+
f := PMErrorAsParameterFunction new function: f
1720
]
1821

1922
{ #category : #tests }
@@ -24,15 +27,15 @@ self assert: (f parameters size < f maxFunction ).
2427

2528
{ #category : #tests }
2629
PMErrorAsParameterFunctionTest >> testPrint [
27-
|aStream s|
28-
aStream :=ReadWriteStream with:''.
29-
f printOn: aStream .
30-
s :=aStream contents .
31-
self assert: (s includesSubstring: 'a * x / (b + x)').
32-
self assert: (s includesSubstring: '#squared').
33-
self assert: (s includesSubstring: 'maxFunction: ', f maxFunction asString).
34-
3530

31+
| aStream s |
32+
aStream := ReadWriteStream with: ''.
33+
f printOn: aStream.
34+
s := aStream contents.
35+
self assert: (s includesSubstring: 'a * x / (b + x)').
36+
self assert: (s includesSubstring: '#squared').
37+
self assert:
38+
(s includesSubstring: 'maxFunction: ' , f maxFunction asString)
3639
]
3740

3841
{ #category : #tests }

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ Class {
1010

1111
{ #category : #running }
1212
PMErrorOfParameterFunctionTest >> setUp [
13-
f:=PMErrorOfParameterFunction new function: [:x :a :b|a*x / (b+x)].
14-
col:=(1 to: 3)collect: [:i|i@(f function cull: i cull: 1 cull: 1) ].
1513

14+
f := PMErrorOfParameterFunction new function: [ :x :a :b |
15+
a * x / (b + x) ].
16+
col := (1 to: 3) collect: [ :i |
17+
i @ (f function cull: i cull: 1 cull: 1) ]
1618
]
1719

1820
{ #category : #tests }

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ Class {
99
}
1010

1111
{ #category : #running }
12-
PMFunctionFitTest >> setUp [
13-
f:=[:x :a :b|a*x / (b+x)].
14-
d:=(1 to: 20)collect: [:i|i@(f cull: i cull: 2 cull: 0.4) ].
12+
PMFunctionFitTest >> setUp [
13+
14+
f := [ :x :a :b | a * x / (b + x) ].
15+
d := (1 to: 20) collect: [ :i | i @ (f cull: i cull: 2 cull: 0.4) ]
1516
]
1617

1718
{ #category : #tests }

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ PMKDTreeTest >> testIndexedKDTree1Dimension [
5252
aResult := stupid nnSearch: aVector i: 3. "3 nearest numbers to aVector "
5353
bResult := m atAll: ((tree nnSearch: aVector i: 3) collect: [:a | a first]).
5454
self equalityTest: aResult and: bResult].
55-
]
55+
]
5656

5757
{ #category : #tests }
5858
PMKDTreeTest >> testIndexedKDTree4Dimensions [
@@ -99,7 +99,7 @@ PMKDTreeTest >> testKDTree1Dimension [
9999
aResult := stupid nnSearch: aVector i: 3. "3 nearest numbers to aVector "
100100
bResult := tree nnSearch: aVector i: 3.
101101
self equalityTest: aResult and: bResult].
102-
]
102+
]
103103

104104
{ #category : #tests }
105105
PMKDTreeTest >> testKDTree1DimensionIntegers [
@@ -110,7 +110,7 @@ PMKDTreeTest >> testKDTree1DimensionIntegers [
110110
aResult :=(aVector first - (stupid nnSearch: aVector i: 3)) abs. "distances between 3 nearest numbers and aVector "
111111
bResult :=(aVector first - (tree nnSearch: aVector i: 3)) abs. "distances using KDTree"
112112
self equalityTest: aResult and: bResult ] .
113-
]
113+
]
114114

115115
{ #category : #tests }
116116
PMKDTreeTest >> testKDTree2Dimensions [

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,21 @@ PMNNStoreTest >> testNewFrom [
175175

176176
{ #category : #tests }
177177
PMNNStoreTest >> testWithAll [
178-
| n |
179-
n := PMNNStore withAll: #(2 5 4).
180-
self assert: n completeData equals: #(#(nil 2) #(nil 5) #(nil 4)).
181-
n sortFor: nil. "calling sortFor: is necessary with withAll:"
182-
self assert: n data equals: #(2 4 5).
178+
179+
| n array |
180+
n := PMNNStore withAll: #( 2 5 4 ).
181+
self
182+
assert: n completeData
183+
equals: #( #( nil 2 ) #( nil 5 ) #( nil 4 ) ).
184+
n sortFor: nil. "calling sortFor: is necessary with withAll:"
185+
self assert: n data equals: #( 2 4 5 ).
183186
self assert: n isFull.
184-
n add: #(3 6). "one has to be a bit carefull when one uses
185-
NNStore withAll:, as sortfor: changes this data.
187+
n add: #(3 6) copy.
188+
189+
"one has to be a bit carefull when one uses
190+
PMNNStore withAll:, as sortfor: changes this data.
186191
n add: #(3 6) is not possible here!"
187-
self assert: n data equals: #(2 6 4).
192+
self assert: n data equals: #( 2 6 4 ).
188193
n sortFor: nil.
189-
self assert: n data equals: #(2 4 6)
194+
self assert: n data equals: #( 2 4 6 )
190195
]

0 commit comments

Comments
 (0)