2294
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
2286
|
3 |
"{ Package: 'stx:goodies/regression' }"
|
|
4 |
|
|
5 |
"{ NameSpace: RegressionTests }"
|
|
6 |
|
|
7 |
TestCase subclass:#MiscArithmeticTests
|
|
8 |
instanceVariableNames:''
|
|
9 |
classVariableNames:''
|
|
10 |
poolDictionaries:''
|
|
11 |
category:'tests-Regression-Numbers'
|
|
12 |
!
|
|
13 |
|
|
14 |
!MiscArithmeticTests class methodsFor:'documentation'!
|
|
15 |
|
|
16 |
documentation
|
|
17 |
"
|
|
18 |
documentation to be added.
|
|
19 |
|
|
20 |
class:
|
|
21 |
<a short class summary here, describing what instances represent>
|
|
22 |
|
|
23 |
responsibilities:
|
|
24 |
<describing what my main role is>
|
|
25 |
|
|
26 |
collaborators:
|
|
27 |
<describing with whom and how I talk to>
|
|
28 |
|
|
29 |
API:
|
|
30 |
<public api and main messages>
|
|
31 |
|
|
32 |
example:
|
|
33 |
<a one-line examples on how to use - can also be in a separate example method>
|
|
34 |
|
|
35 |
implementation:
|
|
36 |
<implementation points>
|
|
37 |
|
|
38 |
[author:]
|
|
39 |
Claus Gittinger
|
|
40 |
|
|
41 |
[instance variables:]
|
|
42 |
|
|
43 |
[class variables:]
|
|
44 |
|
|
45 |
[see also:]
|
|
46 |
|
|
47 |
"
|
|
48 |
! !
|
|
49 |
|
|
50 |
!MiscArithmeticTests methodsFor:'tests'!
|
|
51 |
|
|
52 |
test01_sum
|
2313
|
53 |
|
2286
|
54 |
|
|
55 |
"tests the accumlated error when summing up many floats"
|
|
56 |
|
|
57 |
|arr sum|
|
|
58 |
|
|
59 |
arr := #(1e100 1 -1e100 1) asDoubleArray.
|
|
60 |
sum := arr sum.
|
|
61 |
sum = 2 ifFalse:[
|
|
62 |
Transcript showCR:'ignored expected error in sum'.
|
|
63 |
].
|
|
64 |
sum := arr esum.
|
|
65 |
self assert:(sum = 2).
|
|
66 |
|
|
67 |
arr := #(1e38 1 -1e38 1) asFloatArray.
|
|
68 |
sum := arr sum.
|
|
69 |
sum = 2 ifFalse:[
|
|
70 |
Transcript showCR:'ignored expected error in sum'.
|
|
71 |
].
|
|
72 |
sum := arr esum.
|
|
73 |
self assert:(sum = 2).
|
|
74 |
|
|
75 |
"/ same using literals
|
|
76 |
arr := #f32(1e38 1 -1e38 1).
|
|
77 |
sum := arr esum.
|
|
78 |
self assert:(sum = 2).
|
|
79 |
|
|
80 |
arr := #f64(1e100 1 -1e100 1).
|
|
81 |
sum := arr esum.
|
|
82 |
self assert:(sum = 2).
|
|
83 |
|
|
84 |
"
|
|
85 |
self run:#test01_sum
|
|
86 |
self new test01_sum
|
|
87 |
"
|
|
88 |
|
|
89 |
"Created: / 09-06-2019 / 10:35:16 / Claus Gittinger"
|
|
90 |
"Modified: / 09-06-2019 / 14:20:16 / Claus Gittinger"
|
|
91 |
! !
|
|
92 |
|
|
93 |
!MiscArithmeticTests class methodsFor:'documentation'!
|
|
94 |
|
|
95 |
version_CVS
|
|
96 |
^ '$Header$'
|
|
97 |
! !
|
|
98 |
|