2
2
AccuracyTest uses AccuracyTestExample
3
3
"
4
4
Class {
5
- #name : # PMAccuracyTest ,
6
- #superclass : # TestCase ,
5
+ #name : ' PMAccuracyTest' ,
6
+ #superclass : ' TestCase' ,
7
7
#instVars : [
8
8
' a' ,
9
9
' dp'
10
10
],
11
- #category : #' Math-Tests-Accuracy'
11
+ #category : ' Math-Tests-Accuracy' ,
12
+ #package : ' Math-Tests-Accuracy'
12
13
}
13
14
14
- { #category : # initialization }
15
+ { #category : ' initialization' }
15
16
PMAccuracyTest >> initialize [
16
17
super initialize.
17
18
dp := PMAccuracyTestExample decimalPlaces
18
19
]
19
20
20
- { #category : # running }
21
+ { #category : ' running' }
21
22
PMAccuracyTest >> setUp [
22
23
super setUp.
23
24
a := PMAccuracyTestExample new .
24
25
PMAccuracyTestExample decimalPlaces: 3
25
26
]
26
27
27
- { #category : # running }
28
+ { #category : ' running' }
28
29
PMAccuracyTest >> tearDown [
29
30
PMAccuracyTestExample decimalPlaces: dp.
30
31
super tearDown
31
32
]
32
33
33
- { #category : # tests }
34
+ { #category : ' tests' }
34
35
PMAccuracyTest >> testArgumentAt [
35
36
self assert: (a argumentAt: ' Aaa' ) equals: #(#(false) #(true) ).
36
37
self assert: (a argumentAt: ' Bbb' ) equals: #(#('a') #('AG') ).
37
38
self assert: (a argumentAt: ' Ddd' ) isNil.
38
39
self assert: (a argumentAt: ' Ccc' ) equals: #(#(1) #(1.1) #(0.9) )
39
40
]
40
41
41
- { #category : # tests }
42
+ { #category : ' tests' }
42
43
PMAccuracyTest >> testAsArray [
43
44
self assert: (a asArray: ' bla' ) equals: #('bla') .
44
45
self assert: (a asArray: #('bla') ) equals: #('bla') .
@@ -47,7 +48,7 @@ PMAccuracyTest >> testAsArray [
47
48
equals: #('bla')
48
49
]
49
50
50
- { #category : # tests }
51
+ { #category : ' tests' }
51
52
PMAccuracyTest >> testCalcDeviationsInMax [
52
53
| r c |
53
54
c := #(#(1 2 3) #(2 3 6) ).
@@ -60,7 +61,7 @@ PMAccuracyTest >> testCalcDeviationsInMax [
60
61
equals: (Array with: (100 / 3 ) asFloat with: (100 / 3 ) asFloat with: 50 )
61
62
]
62
63
63
- { #category : # tests }
64
+ { #category : ' tests' }
64
65
PMAccuracyTest >> testCalcErrorOfRealResult [
65
66
self assert: (a calcErrorOf: 0.7 realResult: 0.7 ) equals: 0 .
66
67
self assert: (a calcErrorOf: 0.7 realResult: 0.0 ) equals: - 100 .
@@ -74,14 +75,14 @@ PMAccuracyTest >> testCalcErrorOfRealResult [
74
75
equals: Float infinity negated
75
76
]
76
77
77
- { #category : # tests }
78
+ { #category : ' tests' }
78
79
PMAccuracyTest >> testDecimalPlaces [
79
80
self assert: a class decimalPlaces equals: 3 .
80
81
a class decimalPlaces: 2 .
81
82
self assert: a class decimalPlaces equals: 2
82
83
]
83
84
84
- { #category : # tests }
85
+ { #category : ' tests' }
85
86
PMAccuracyTest >> testExtractFromResultsReturnsAllElementsWhenOnlyOneIsTrue [
86
87
| argument results |
87
88
results := a
@@ -94,7 +95,7 @@ PMAccuracyTest >> testExtractFromResultsReturnsAllElementsWhenOnlyOneIsTrue [
94
95
self assert: argument equals: #(#(false) #(true) )
95
96
]
96
97
97
- { #category : # tests }
98
+ { #category : ' tests' }
98
99
PMAccuracyTest >> testExtractFromResultsReturnsTheCorrectIndexedElementWhenOnlyOneIsFalse [
99
100
| argument results |
100
101
results := a
@@ -107,7 +108,7 @@ PMAccuracyTest >> testExtractFromResultsReturnsTheCorrectIndexedElementWhenOnlyO
107
108
self assert: argument equals: #(true)
108
109
]
109
110
110
- { #category : # tests }
111
+ { #category : ' tests' }
111
112
PMAccuracyTest >> testExtremeCollectionmax [
112
113
| c |
113
114
c := #(4 4 2) .
@@ -122,7 +123,7 @@ PMAccuracyTest >> testExtremeCollectionmax [
122
123
equals: (Array with: Float infinity with: Float infinity with: Float infinity)
123
124
]
124
125
125
- { #category : # tests }
126
+ { #category : ' tests' }
126
127
PMAccuracyTest >> testFormat [
127
128
self
128
129
assert: (a format: #(1 'rez' 1.8899) )
@@ -134,7 +135,7 @@ PMAccuracyTest >> testFormat [
134
135
self assert: (a format: 0 - Float infinity) equals: #('-Infinity')
135
136
]
136
137
137
- { #category : # tests }
138
+ { #category : ' tests' }
138
139
PMAccuracyTest >> testFormatTypePostfix [
139
140
| r |
140
141
r := a format: #(1 'rez' 1.8899) type: ' x' postfix: ' %%' .
@@ -145,7 +146,7 @@ PMAccuracyTest >> testFormatTypePostfix [
145
146
equals: ' x: 1.0%% , rez%% , 1.89%% : 1.89 , true '
146
147
]
147
148
148
- { #category : # tests }
149
+ { #category : ' tests' }
149
150
PMAccuracyTest >> testFormatTypePostfixTree [
150
151
| t |
151
152
t := KeyedTree new .
@@ -165,7 +166,7 @@ PMAccuracyTest >> testFormatTypePostfixTree [
165
166
yourself )
166
167
]
167
168
168
- { #category : # tests }
169
+ { #category : ' tests' }
169
170
PMAccuracyTest >> testGetters [
170
171
171
172
| r |
@@ -175,15 +176,15 @@ PMAccuracyTest >> testGetters [
175
176
self assert: r equals: #( #( #( 1 ) #( 3 ) ) #( #( 'a' ) #( 'AG' ) ) #( #( 2 ) #( 3 ) ) 2 2 )
176
177
]
177
178
178
- { #category : # tests }
179
+ { #category : ' tests' }
179
180
PMAccuracyTest >> testIfSeveralterations [
180
181
a iterations: 2 .
181
182
self assert: (a ifSeveralterations: [ 1 ]) equals: 1 .
182
183
a iterations: 1 .
183
184
self assert: (a ifSeveralterations: [ 1 ]) equals: a
184
185
]
185
186
186
- { #category : # tests }
187
+ { #category : ' tests' }
187
188
PMAccuracyTest >> testIterations [
188
189
189
190
| s d |
@@ -199,18 +200,18 @@ PMAccuracyTest >> testIterations [
199
200
self assert: (d atPath: #( 'Ddd' 'data' ) ) equals: #( #( 2 3 ) #( 2 3 ) ).
200
201
s := d atPath: #( 'Ddd' 'error' ) .
201
202
self assert: s first closeTo: - 45 .
202
- self assert: s second closeTo: - 26.6666667
203
+ self assert: s second closeTo: - 26.6666667 precision: 0.00001
203
204
]
204
205
205
- { #category : # tests }
206
+ { #category : ' tests' }
206
207
PMAccuracyTest >> testNumberOfDifferentParametersAt [
207
208
self assert: (a numberOfDifferentParametersAt: ' Aaa' ) equals: 2 .
208
209
self assert: (a numberOfDifferentParametersAt: ' Ccc' ) equals: 2 .
209
210
self assert: (a numberOfDifferentParametersAt: ' Ddd' ) equals: 1 .
210
211
self assert: (a numberOfDifferentParametersAt: ' Fff' ) equals: 1
211
212
]
212
213
213
- { #category : # tests }
214
+ { #category : ' tests' }
214
215
PMAccuracyTest >> testNumberOfDifferentResultsAt [
215
216
self assert: (a numberOfDifferentResultsAt: ' Aaa' ) equals: 2 .
216
217
self assert: (a numberOfDifferentResultsAt: ' Bbb' ) equals: 2 .
@@ -219,15 +220,15 @@ PMAccuracyTest >> testNumberOfDifferentResultsAt [
219
220
self assert: (a numberOfDifferentResultsAt: ' Eee' ) equals: 2
220
221
]
221
222
222
- { #category : # tests }
223
+ { #category : ' tests' }
223
224
PMAccuracyTest >> testParameterAt [
224
225
self assert: (a parameterAt: ' Aaa' ) equals: #(#(1 2) #(3 2.8888) ).
225
226
self assert: (a parameterAt: ' Bbb' ) equals: #(#(1) #(3) ).
226
227
self assert: (a parameterAt: ' Ddd' ) isNil.
227
228
self assert: (a parameterAt: ' Fff' ) isNil
228
229
]
229
230
230
- { #category : # tests }
231
+ { #category : ' tests' }
231
232
PMAccuracyTest >> testPrintOn [
232
233
| s |
233
234
s := WriteStream on: String new .
@@ -244,14 +245,14 @@ PMAccuracyTest >> testPrintOn [
244
245
Report for: PMAccuracyTestExample' )
245
246
]
246
247
247
- { #category : # tests }
248
+ { #category : ' tests' }
248
249
PMAccuracyTest >> testReport [
249
250
self assert: a report equals: ' ' .
250
251
a run.
251
252
self assert: (a report beginsWith: ' Report for: PMAccuracyTestExample' )
252
253
]
253
254
254
- { #category : # tests }
255
+ { #category : ' tests' }
255
256
PMAccuracyTest >> testResultsKeyForAtPosition [
256
257
self assert: (a resultsKeyFor: ' Aaa' AtPosition: 2 ) equals: #(4 4) .
257
258
self assert: (a resultsKeyFor: ' Bbb' AtPosition: 1 ) equals: #(2) .
@@ -284,7 +285,7 @@ PMAccuracyTest >> testResultsKeyForAtPosition [
284
285
equals: #(0 1 0 -2 3)
285
286
]
286
287
287
- { #category : # tests }
288
+ { #category : ' tests' }
288
289
PMAccuracyTest >> testRun [
289
290
a run.
290
291
a run: ' Bbb' .
@@ -301,7 +302,7 @@ test Bbb').
301
302
equals: #('Ccc' 'Eee')
302
303
]
303
304
304
- { #category : # tests }
305
+ { #category : ' tests' }
305
306
PMAccuracyTest >> testSetUp [
306
307
self assert: a count equals: 0 .
307
308
a performCheck: ' Fff' .
@@ -311,7 +312,7 @@ PMAccuracyTest >> testSetUp [
311
312
self assert: a count equals: 16 / 5
312
313
]
313
314
314
- { #category : # tests }
315
+ { #category : ' tests' }
315
316
PMAccuracyTest >> testTreeTypeData [
316
317
| aTree |
317
318
aTree := KeyedTree new .
@@ -325,7 +326,7 @@ PMAccuracyTest >> testTreeTypeData [
325
326
yourself )
326
327
]
327
328
328
- { #category : # tests }
329
+ { #category : ' tests' }
329
330
PMAccuracyTest >> testperformCheck [
330
331
| b |
331
332
a extractFromResults: ' bla' which: 2 onlyOne: false . " for setting numberOfResults"
0 commit comments