author | Claus Gittinger <cg@exept.de> |
Fri, 04 Jun 1999 19:55:05 +0200 | |
changeset 23 | 5db5444c09d5 |
parent 22 | 7f01716fbbe2 |
child 24 | 75a5c02e255d |
permissions | -rw-r--r-- |
2 | 1 |
Object subclass:#IntegerTest |
2 |
instanceVariableNames:'' |
|
3 |
classVariableNames:'' |
|
4 |
poolDictionaries:'' |
|
5 |
category:'Tests - Numbers' |
|
6 |
! |
|
7 |
||
8 |
||
4 | 9 |
!IntegerTest class methodsFor:'misc'! |
10 |
||
11 |
testPlus1_a:arg |
|
12 |
^ arg + 1 |
|
13 |
||
14 |
" |
|
15 |
(self testPlus1_a:SmallInteger maxVal) = 1073741824 |
|
16 |
" |
|
17 |
! |
|
18 |
||
19 |
testPlus1_b:arg |
|
20 |
^ arg perform:#+ with:1 |
|
21 |
||
22 |
" |
|
23 |
(self testPlus1_b:SmallInteger maxVal) == 1073741824 |
|
24 |
" |
|
25 |
! ! |
|
26 |
||
3 | 27 |
!IntegerTest class methodsFor:'private'! |
2 | 28 |
|
19 | 29 |
num_00000000000007FFF |
30 |
^ 16r00000000000007FFF |
|
31 |
||
32 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
33 |
"Created: / 4.6.1999 / 15:34:12 / cg" |
|
34 |
! |
|
35 |
||
36 |
num_00000000000008000 |
|
37 |
^ 16r00000000000008000 |
|
38 |
||
39 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
40 |
"Created: / 4.6.1999 / 15:39:32 / cg" |
|
41 |
! |
|
42 |
||
43 |
num_0000000000000FFFF |
|
44 |
^ 16r0000000000000FFFF |
|
45 |
||
46 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
47 |
"Created: / 4.6.1999 / 15:34:26 / cg" |
|
48 |
! |
|
49 |
||
50 |
num_00000000000010000 |
|
51 |
^ 16r00000000000010000 |
|
52 |
||
53 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
54 |
"Created: / 4.6.1999 / 15:34:31 / cg" |
|
55 |
! |
|
56 |
||
57 |
num_00000000000100000 |
|
58 |
^ 16r00000000000100000 |
|
59 |
||
60 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
61 |
"Created: / 4.6.1999 / 15:34:36 / cg" |
|
62 |
! |
|
63 |
||
64 |
num_000000000007FFFFF |
|
65 |
^ 16r000000000007FFFFF |
|
66 |
||
67 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
68 |
"Created: / 4.6.1999 / 15:37:48 / cg" |
|
69 |
! |
|
70 |
||
71 |
num_00000000000800000 |
|
72 |
^ 16r00000000000800000 |
|
73 |
||
74 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
75 |
"Created: / 4.6.1999 / 15:39:43 / cg" |
|
76 |
! |
|
77 |
||
78 |
num_00000000000FFFFFF |
|
79 |
^ 16r00000000000FFFFFF |
|
80 |
||
81 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
82 |
"Created: / 4.6.1999 / 15:37:52 / cg" |
|
83 |
! |
|
84 |
||
85 |
num_00000000001000000 |
|
86 |
^ 16r00000000001000000 |
|
87 |
||
88 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
89 |
"Created: / 4.6.1999 / 15:34:42 / cg" |
|
90 |
! |
|
91 |
||
22 | 92 |
num_0000000000FFF0000 |
93 |
^ 16r0000000000FFF0000 |
|
94 |
||
95 |
"self num_0000000000FFF0000 hexPrintString" |
|
96 |
||
97 |
"Created: / 4.6.1999 / 17:44:26 / cg" |
|
98 |
"Modified: / 4.6.1999 / 18:40:47 / cg" |
|
99 |
! |
|
100 |
||
19 | 101 |
num_00000000010000000 |
102 |
^ 16r00000000010000000 |
|
103 |
||
104 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
105 |
"Created: / 4.6.1999 / 15:34:46 / cg" |
|
106 |
! |
|
107 |
||
108 |
num_0000000007FFFFFFF |
|
109 |
^ 16r0000000007FFFFFFF |
|
110 |
||
111 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
112 |
"Created: / 4.6.1999 / 15:37:31 / cg" |
|
113 |
! |
|
114 |
||
115 |
num_00000000080000000 |
|
116 |
^ 16r00000000080000000 |
|
117 |
||
118 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
119 |
"Created: / 4.6.1999 / 15:39:56 / cg" |
|
120 |
! |
|
121 |
||
122 |
num_000000000FFFFFFFF |
|
123 |
^ 16r000000000FFFFFFFF |
|
124 |
||
125 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
126 |
"Created: / 4.6.1999 / 15:36:16 / cg" |
|
127 |
! |
|
128 |
||
129 |
num_00000000100000000 |
|
130 |
^ 16r00000000100000000 |
|
131 |
||
132 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
133 |
"Created: / 4.6.1999 / 15:34:51 / cg" |
|
134 |
! |
|
135 |
||
136 |
num_00000001000000000 |
|
137 |
^ 16r00000001000000000 |
|
138 |
||
139 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
140 |
"Created: / 4.6.1999 / 15:34:57 / cg" |
|
141 |
! |
|
142 |
||
21 | 143 |
num_0000000FFFFFFFFFF |
144 |
^ 16r0000000FFFFFFFFFF |
|
145 |
||
146 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
147 |
"Created: / 4.6.1999 / 17:41:08 / cg" |
|
148 |
! |
|
149 |
||
19 | 150 |
num_00000010000000000 |
151 |
^ 16r00000010000000000 |
|
152 |
||
153 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
154 |
"Created: / 4.6.1999 / 15:35:03 / cg" |
|
155 |
! |
|
156 |
||
157 |
num_00000100000000000 |
|
158 |
^ 16r00000100000000000 |
|
159 |
||
160 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
161 |
"Created: / 4.6.1999 / 15:35:07 / cg" |
|
162 |
! |
|
163 |
||
21 | 164 |
num_00000FFFFFFFFFF00 |
165 |
^ 16r00000FFFFFFFFFF00 |
|
166 |
||
167 |
"self num_00000FFFFFFFFFF00" |
|
168 |
||
169 |
"Created: / 4.6.1999 / 17:44:26 / cg" |
|
170 |
"Modified: / 4.6.1999 / 17:46:20 / cg" |
|
171 |
! |
|
172 |
||
173 |
num_00000FFFFFFFFFF80 |
|
174 |
^ 16r00000FFFFFFFFFF80 |
|
175 |
||
176 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
177 |
"Created: / 4.6.1999 / 17:44:23 / cg" |
|
178 |
! |
|
179 |
||
180 |
num_00000FFFFFFFFFFC0 |
|
181 |
^ 16r00000FFFFFFFFFFC0 |
|
182 |
||
183 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
184 |
"Created: / 4.6.1999 / 17:44:20 / cg" |
|
185 |
! |
|
186 |
||
187 |
num_00000FFFFFFFFFFE0 |
|
188 |
^ 16r00000FFFFFFFFFFE0 |
|
189 |
||
190 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
191 |
"Created: / 4.6.1999 / 17:44:16 / cg" |
|
192 |
! |
|
193 |
||
194 |
num_00000FFFFFFFFFFF0 |
|
195 |
^ 16r00000FFFFFFFFFFF0 |
|
196 |
||
197 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
198 |
"Created: / 4.6.1999 / 17:44:12 / cg" |
|
199 |
! |
|
200 |
||
201 |
num_00000FFFFFFFFFFF8 |
|
202 |
^ 16r00000FFFFFFFFFFF8 |
|
203 |
||
204 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
205 |
"Created: / 4.6.1999 / 17:44:09 / cg" |
|
206 |
! |
|
207 |
||
208 |
num_00000FFFFFFFFFFFC |
|
209 |
^ 16r00000FFFFFFFFFFFC |
|
210 |
||
211 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
212 |
"Created: / 4.6.1999 / 17:44:05 / cg" |
|
213 |
! |
|
214 |
||
215 |
num_00000FFFFFFFFFFFE |
|
216 |
^ 16r00000FFFFFFFFFFFE |
|
217 |
||
218 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
219 |
"Created: / 4.6.1999 / 17:45:12 / cg" |
|
220 |
! |
|
221 |
||
222 |
num_00000FFFFFFFFFFFF |
|
223 |
^ 16r00000FFFFFFFFFFFF |
|
224 |
||
225 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
226 |
"Created: / 4.6.1999 / 17:41:22 / cg" |
|
227 |
! |
|
228 |
||
19 | 229 |
num_00001000000000000 |
230 |
^ 16r00001000000000000 |
|
231 |
||
232 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
233 |
"Created: / 4.6.1999 / 15:35:13 / cg" |
|
234 |
! |
|
235 |
||
236 |
num_00010000000000000 |
|
237 |
^ 16r00010000000000000 |
|
238 |
||
239 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
240 |
"Created: / 4.6.1999 / 15:35:18 / cg" |
|
241 |
! |
|
242 |
||
21 | 243 |
num_000FFFFFFFFFFFFFF |
244 |
^ 16r000FFFFFFFFFFFFFF |
|
245 |
||
246 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
247 |
"Created: / 4.6.1999 / 17:41:26 / cg" |
|
248 |
! |
|
249 |
||
19 | 250 |
num_00100000000000000 |
251 |
^ 16r00100000000000000 |
|
252 |
||
253 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
254 |
"Created: / 4.6.1999 / 15:35:22 / cg" |
|
255 |
! |
|
256 |
||
257 |
num_01000000000000000 |
|
258 |
^ 16r01000000000000000 |
|
259 |
||
260 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
261 |
"Created: / 4.6.1999 / 15:35:27 / cg" |
|
262 |
! |
|
263 |
||
21 | 264 |
num_0FFFFFFFFFFFFFFFF |
265 |
^ 16r0FFFFFFFFFFFFFFFF |
|
266 |
||
267 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
268 |
"Created: / 4.6.1999 / 17:41:30 / cg" |
|
269 |
! |
|
270 |
||
19 | 271 |
num_10000000000000000 |
272 |
^ 16r10000000000000000 |
|
273 |
||
274 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
275 |
"Created: / 4.6.1999 / 15:35:32 / cg" |
|
276 |
! |
|
277 |
||
21 | 278 |
num_1FFFFFFFFFFFFFFFF |
279 |
^ 16r1FFFFFFFFFFFFFFFF |
|
280 |
||
281 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
282 |
"Created: / 4.6.1999 / 17:41:51 / cg" |
|
283 |
! |
|
284 |
||
285 |
num_20000000000000000 |
|
286 |
^ 16r20000000000000000 |
|
287 |
||
288 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
289 |
"Created: / 4.6.1999 / 17:40:26 / cg" |
|
290 |
! |
|
291 |
||
292 |
num_3FFFFFFFFFFFFFFFF |
|
293 |
^ 16r3FFFFFFFFFFFFFFFF |
|
294 |
||
295 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
296 |
"Created: / 4.6.1999 / 17:42:07 / cg" |
|
297 |
! |
|
298 |
||
299 |
num_40000000000000000 |
|
300 |
^ 16r40000000000000000 |
|
301 |
||
302 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
303 |
"Created: / 4.6.1999 / 17:40:29 / cg" |
|
304 |
! |
|
305 |
||
306 |
num_7FFFFFFFFFFFFFFFF |
|
307 |
^ 16r7FFFFFFFFFFFFFFFF |
|
308 |
||
309 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
310 |
"Created: / 4.6.1999 / 17:42:24 / cg" |
|
311 |
! |
|
312 |
||
313 |
num_80000000000000000 |
|
314 |
^ 16r80000000000000000 |
|
315 |
||
316 |
"Modified: / 4.6.1999 / 15:29:31 / cg" |
|
317 |
"Created: / 4.6.1999 / 17:40:33 / cg" |
|
318 |
! |
|
319 |
||
20 | 320 |
num_smallInt_maxVal |
321 |
^ SmallInteger maxVal |
|
322 |
||
21 | 323 |
"self num_smallInt_maxVal" |
324 |
||
325 |
"Modified: / 4.6.1999 / 17:33:22 / cg" |
|
20 | 326 |
! |
327 |
||
328 |
num_smallInt_minVal |
|
329 |
^ SmallInteger minVal |
|
330 |
||
21 | 331 |
"self num_smallInt_minVal" |
332 |
||
20 | 333 |
"Created: / 4.6.1999 / 16:26:05 / cg" |
21 | 334 |
"Modified: / 4.6.1999 / 17:34:31 / cg" |
20 | 335 |
! |
336 |
||
2 | 337 |
test:aBlock |
3 | 338 |
aBlock value == true ifFalse:[ |
2 | 339 |
self halt:'test failed' |
340 |
] |
|
341 |
! ! |
|
342 |
||
343 |
!IntegerTest class methodsFor:'tests'! |
|
344 |
||
345 |
test1 |
|
10 | 346 |
"general conversion & arithmetic tests. |
347 |
Notice, the arithmetic tests are both performed via regular sends |
|
348 |
and via constructed performs. The reason is to test both inlined |
|
349 |
JIT-compiler code AND the regular methods code." |
|
2 | 350 |
|
3 | 351 |
|minVal maxVal maxValPlus1 minValMinus1 halfMin halfMax t t1 t2| |
352 |
||
353 |
minVal := SmallInteger perform:('minVal' asSymbol). |
|
354 |
maxVal := SmallInteger perform:('maxVal' asSymbol). |
|
355 |
||
20 | 356 |
self test:[minVal == self num_smallInt_minVal]. |
357 |
self test:[maxVal == self num_smallInt_maxVal]. |
|
358 |
||
3 | 359 |
self test:[minVal == SmallInteger minVal]. |
360 |
self test:[maxVal == SmallInteger maxVal]. |
|
2 | 361 |
|
9 | 362 |
t := SmallInteger perform:('maxBytes' asSymbol). |
363 |
self test:[t == SmallInteger maxBytes]. |
|
364 |
t := SmallInteger perform:('maxBits' asSymbol). |
|
365 |
self test:[t == SmallInteger maxBits]. |
|
366 |
||
7 | 367 |
self testPrinting1. |
2 | 368 |
|
369 |
SmallInteger maxBytes == 4 ifTrue:[ |
|
3 | 370 |
self test:[minVal hexPrintString = '-40000000']. |
371 |
self test:[maxVal hexPrintString = '3FFFFFFF']. |
|
372 |
self test:[minVal == -1073741824]. |
|
373 |
self test:[maxVal == 1073741823]. |
|
2 | 374 |
maxValPlus1 := 1073741824. |
375 |
minValMinus1 := -1073741825. |
|
376 |
self test:[minValMinus1 hexPrintString = '-40000001']. |
|
377 |
self test:[maxValPlus1 hexPrintString = '40000000']. |
|
3 | 378 |
halfMin := -16r20000000. |
379 |
halfMax := 16r20000000. |
|
2 | 380 |
]. |
381 |
SmallInteger maxBytes == 8 ifTrue:[ |
|
3 | 382 |
self test:[minVal hexPrintString = '-4000000000000000']. |
383 |
self test:[maxVal hexPrintString = '3FFFFFFFFFFFFFFF']. |
|
384 |
self test:[minVal == -4611686018427387904]. |
|
385 |
self test:[maxVal == 4611686018427387903]. |
|
2 | 386 |
maxValPlus1 := 4611686018427387904. |
387 |
minValMinus1 := -4611686018427387905. |
|
388 |
self test:[minValMinus1 hexPrintString = '-4000000000000001']. |
|
389 |
self test:[maxValPlus1 hexPrintString = '4000000000000000']. |
|
3 | 390 |
halfMin := -16r2000000000000000. |
391 |
halfMax := 16r2000000000000000. |
|
2 | 392 |
]. |
393 |
||
394 |
"arithmetic overFlow checks" |
|
395 |
||
4 | 396 |
"/ self test:[(maxVal + 1) inspect.maxValPlus1 inspect. true]. |
6 | 397 |
self test:[(maxVal perform:'+' asSymbol with:1) = maxValPlus1]. |
398 |
self test:[(maxVal + 1) = maxValPlus1]. |
|
399 |
self test:[(minVal perform:'-' asSymbol with:1) = minValMinus1]. |
|
400 |
self test:[(minVal - 1) = minValMinus1]. |
|
3 | 401 |
|
6 | 402 |
self test:[(halfMax perform:'+' asSymbol with:halfMax) = maxValPlus1]. |
3 | 403 |
self test:[(halfMax + halfMax) = maxValPlus1]. |
6 | 404 |
self test:[(halfMin perform:'+' asSymbol with:halfMin) == minVal]. |
3 | 405 |
self test:[(halfMin + halfMin) == minVal]. |
6 | 406 |
self test:[(halfMax perform:'*' asSymbol with:2) = maxValPlus1]. |
3 | 407 |
self test:[(halfMax * 2) = maxValPlus1]. |
6 | 408 |
self test:[(halfMin perform:'*' asSymbol with:2) == minVal]. |
3 | 409 |
self test:[(halfMin * 2) == minVal]. |
6 | 410 |
self test:[(maxValPlus1 perform:'//' asSymbol with:2) == halfMax]. |
411 |
self test:[(maxValPlus1 // 2) == halfMax]. |
|
412 |
self test:[(halfMax perform:'bitShift:' asSymbol with:1) = maxValPlus1]. |
|
413 |
self test:[(halfMin perform:'bitShift:' asSymbol with:1) == minVal]. |
|
3 | 414 |
self test:[(halfMax bitShift:1) = maxValPlus1]. |
415 |
self test:[(halfMin bitShift:1) == minVal]. |
|
416 |
||
417 |
"LargeInt op -> SmallInt result" |
|
418 |
t := maxVal + 1. |
|
419 |
self test:[t - 1 == maxVal]. |
|
420 |
t := minVal - 1. |
|
421 |
self test:[t + 1 == minVal]. |
|
422 |
||
19 | 423 |
self testLiteralNumbers. |
15 | 424 |
self testLargeAddition. |
12
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
425 |
self testLargeMultiplication. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
426 |
self testLargeDivision. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
427 |
|
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
428 |
" |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
429 |
self test1 |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
430 |
" |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
431 |
|
20 | 432 |
"Modified: / 4.6.1999 / 16:26:33 / cg" |
12
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
433 |
! |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
434 |
|
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
435 |
testLargeAddition |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
436 |
"general conversion & arithmetic tests. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
437 |
Notice, the arithmetic tests are both performed via regular sends |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
438 |
and via constructed performs. The reason is to test both inlined |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
439 |
JIT-compiler code AND the regular methods code." |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
440 |
|
19 | 441 |
|s n1 n2 x| |
13 | 442 |
|
23 | 443 |
"Large + Large addition" |
444 |
self testReading1. |
|
445 |
||
446 |
self test:[(20 factorial + 20 factorial) printString = '4865804016353280000']. |
|
447 |
self test:[(20 factorial + 1) printString = '2432902008176640001']. |
|
448 |
self test:[(20 factorial + 1000) printString = '2432902008176641000']. |
|
449 |
||
450 |
"Large - Large addition" |
|
451 |
||
452 |
n1 := 16r100000000. n2 := 16r7FFFFFFF. |
|
453 |
self test:[(n1 - n2 ) hexPrintString = '80000001']. |
|
454 |
self test:[(16r100000000 - n2 ) hexPrintString = '80000001']. |
|
455 |
self test:[(n1 - 16r7FFFFFFF ) hexPrintString = '80000001']. |
|
456 |
self test:[(16r100000000 - 16r7FFFFFFF ) hexPrintString = '80000001']. |
|
457 |
self test:[(n1 perform:'-' asSymbol with:n2 ) hexPrintString = '80000001']. |
|
458 |
self test:[(16r100000000 perform:'-' asSymbol with:n2 ) hexPrintString = '80000001']. |
|
459 |
self test:[(n1 perform:'-' asSymbol with:16r7FFFFFFF ) hexPrintString = '80000001']. |
|
460 |
self test:[(16r100000000 perform:'-' asSymbol with:16r7FFFFFFF ) hexPrintString = '80000001']. |
|
461 |
||
462 |
n1 := 16r100000000. n2 := 16r80000000. |
|
463 |
self test:[(n1 - n2 ) hexPrintString = '80000000']. |
|
464 |
self test:[(16r100000000 - n2 ) hexPrintString = '80000000']. |
|
465 |
self test:[(n1 - 16r80000000 ) hexPrintString = '80000000']. |
|
466 |
self test:[(16r100000000 - 16r80000000 ) hexPrintString = '80000000']. |
|
467 |
self test:[(n1 perform:'-' asSymbol with:n2 ) hexPrintString = '80000000']. |
|
468 |
self test:[(16r100000000 perform:'-' asSymbol with:n2 ) hexPrintString = '80000000']. |
|
469 |
self test:[(n1 perform:'-' asSymbol with:16r80000000 ) hexPrintString = '80000000']. |
|
470 |
self test:[(16r100000000 perform:'-' asSymbol with:16r80000000 ) hexPrintString = '80000000']. |
|
17 | 471 |
|
472 |
n1 := 16r100000000. n2 := 16rFFFFFFFF. |
|
23 | 473 |
self test:[(n1 - n2 ) hexPrintString = '1']. |
474 |
self test:[(16r100000000 - n2 ) hexPrintString = '1']. |
|
19 | 475 |
self test:[(x := n1 - 16rFFFFFFFF) == 1]. |
17 | 476 |
|
23 | 477 |
self test:[(n1 - 16rFFFFFFFF ) hexPrintString = '1']. |
478 |
self test:[(16r100000000 - 16rFFFFFFFF ) hexPrintString = '1']. |
|
479 |
self test:[(n1 perform:'-' asSymbol with:n2 ) hexPrintString = '1']. |
|
480 |
self test:[(16r100000000 perform:'-' asSymbol with:n2 ) hexPrintString = '1']. |
|
481 |
self test:[(n1 perform:'-' asSymbol with:16rFFFFFFFF ) hexPrintString = '1']. |
|
482 |
self test:[(16r100000000 perform:'-' asSymbol with:16rFFFFFFFF ) hexPrintString = '1']. |
|
483 |
||
484 |
n1 := 16r100000000. n2 := 1. |
|
485 |
self test:[(n1 - n2) hexPrintString = 'FFFFFFFF']. |
|
486 |
self test:[(n1 - n2) hexPrintString = 'FFFFFFFF']. |
|
487 |
self test:[(16r100000000 - n2) hexPrintString = 'FFFFFFFF']. |
|
488 |
self test:[(n1 - 1) hexPrintString = 'FFFFFFFF']. |
|
489 |
self test:[(16r100000000 - 1) hexPrintString = 'FFFFFFFF']. |
|
490 |
self test:[(n1 perform:'-' asSymbol with:n2) hexPrintString = 'FFFFFFFF']. |
|
491 |
self test:[(16r100000000 perform:'-' asSymbol with:n2) hexPrintString = 'FFFFFFFF']. |
|
492 |
self test:[(n1 perform:'-' asSymbol with:1) hexPrintString = 'FFFFFFFF']. |
|
493 |
self test:[(16r100000000 perform:'-' asSymbol with:1) hexPrintString = 'FFFFFFFF']. |
|
494 |
||
495 |
n1 := 16r100000000. n2 := 16r10000000. |
|
496 |
self test:[(n1 - n2) hexPrintString = 'F0000000']. |
|
497 |
self test:[(16r100000000 - n2) hexPrintString = 'F0000000']. |
|
498 |
self test:[(n1 - 16r10000000) hexPrintString = 'F0000000']. |
|
499 |
self test:[(16r100000000 - 16r10000000) hexPrintString = 'F0000000']. |
|
500 |
self test:[(n1 perform:'-' asSymbol with:n2) hexPrintString = 'F0000000']. |
|
501 |
self test:[(16r100000000 perform:'-' asSymbol with:n2) hexPrintString = 'F0000000']. |
|
502 |
self test:[(n1 perform:'-' asSymbol with:16r10000000) hexPrintString = 'F0000000']. |
|
503 |
self test:[(16r100000000 perform:'-' asSymbol with:16r10000000) hexPrintString = 'F0000000']. |
|
504 |
||
505 |
"Large - small subtraction" |
|
506 |
self test:[(20 factorial + 20 factorial - 1) printString = '4865804016353279999']. |
|
507 |
self test:[(20 factorial - 10 factorial + 3628800) printString = '2432902008176640000']. |
|
508 |
self test:[(20 factorial - 11 factorial + 39916800) printString = '2432902008176640000']. |
|
509 |
self test:[(20 factorial - 12 factorial + 479001600) printString = '2432902008176640000']. |
|
510 |
self test:[(20 factorial - 13 factorial + 6227020800) printString = '2432902008176640000']. |
|
511 |
self test:[(20 factorial - 14 factorial + 87178291200) printString = '2432902008176640000']. |
|
512 |
self test:[(20 factorial - 15 factorial + 1307674368000) printString = '2432902008176640000']. |
|
513 |
self test:[(20 factorial - 16 factorial + 20922789888000) printString = '2432902008176640000']. |
|
514 |
self test:[(20 factorial + 10 factorial - 3628800) printString = '2432902008176640000']. |
|
12
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
515 |
|
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
516 |
" |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
517 |
self testLargeAddition |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
518 |
" |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
519 |
|
19 | 520 |
"Modified: / 4.6.1999 / 15:26:55 / cg" |
12
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
521 |
! |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
522 |
|
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
523 |
testLargeDivision |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
524 |
|t| |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
525 |
|
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
526 |
t := 20 factorial. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
527 |
|
16 | 528 |
self test:[t printString = '2432902008176640000']. |
529 |
self test:[t \\ 10 == 0]. |
|
530 |
t := t // 10. |
|
531 |
self test:[t printString = '243290200817664000']. |
|
532 |
self test:[t \\ 10 == 0]. |
|
533 |
t := t // 10. |
|
534 |
self test:[t printString = '24329020081766400']. |
|
535 |
self test:[t \\ 10 == 0]. |
|
536 |
t := t // 10. |
|
537 |
self test:[t printString = '2432902008176640']. |
|
538 |
self test:[t \\ 10 == 0]. |
|
539 |
t := t // 10. |
|
540 |
self test:[t printString = '243290200817664']. |
|
541 |
self test:[t \\ 10 == 4]. |
|
542 |
t := t // 10. |
|
543 |
self test:[t printString = '24329020081766']. |
|
544 |
self test:[t \\ 10 == 6]. |
|
545 |
t := t // 10. |
|
546 |
self test:[t printString = '2432902008176']. |
|
547 |
self test:[t \\ 10 == 6]. |
|
548 |
t := t // 10. |
|
549 |
self test:[t printString = '243290200817']. |
|
550 |
self test:[t \\ 10 == 7]. |
|
551 |
t := t // 10. |
|
552 |
self test:[t printString = '24329020081']. |
|
553 |
self test:[t \\ 10 == 1]. |
|
554 |
t := t // 10. |
|
555 |
self test:[t printString = '2432902008']. |
|
556 |
self test:[t \\ 10 == 8]. |
|
557 |
t := t // 10. |
|
558 |
self test:[t printString = '243290200']. |
|
559 |
self test:[t \\ 10 == 0]. |
|
560 |
||
561 |
||
562 |
t := 20 factorial. |
|
563 |
||
564 |
self test:[t printString = '2432902008176640000']. |
|
565 |
self test:[t \\ 1000 == 0]. |
|
566 |
t := t // 1000. |
|
567 |
self test:[t printString = '2432902008176640']. |
|
568 |
self test:[t \\ 1000 == 640]. |
|
569 |
t := t // 1000. |
|
570 |
self test:[t printString = '2432902008176']. |
|
571 |
self test:[t \\ 1000 == 176]. |
|
572 |
t := t // 1000. |
|
573 |
self test:[t printString = '2432902008']. |
|
574 |
self test:[t \\ 1000 == 8]. |
|
575 |
t := t // 1000. |
|
576 |
self test:[t printString = '2432902']. |
|
577 |
self test:[t \\ 1000 == 902]. |
|
578 |
t := t // 1000. |
|
579 |
self test:[t printString = '2432']. |
|
580 |
self test:[t \\ 1000 == 432]. |
|
581 |
t := t // 1000. |
|
582 |
self test:[t == 2]. |
|
583 |
self test:[t \\ 1000 == 2]. |
|
584 |
||
585 |
||
586 |
t := 20 factorial. |
|
587 |
||
12
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
588 |
"Large // SmallInt division" |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
589 |
t := t // 20. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
590 |
self test:[t printString = 19 factorial printString]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
591 |
t := t // 19. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
592 |
self test:[t printString = 18 factorial printString]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
593 |
t := t // 18. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
594 |
self test:[t printString = 17 factorial printString]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
595 |
t := t // 17. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
596 |
self test:[t printString = 16 factorial printString]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
597 |
t := t // 16. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
598 |
self test:[t printString = 15 factorial printString]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
599 |
t := t // 15. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
600 |
self test:[t printString = 14 factorial printString]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
601 |
t := t // 14. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
602 |
self test:[t printString = 13 factorial printString]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
603 |
t := t // 13. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
604 |
self test:[t printString = 12 factorial printString]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
605 |
t := t // 12. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
606 |
self test:[t printString = 11 factorial printString]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
607 |
t := t // 11. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
608 |
self test:[t printString = 10 factorial printString]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
609 |
self test:[t == 10 factorial]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
610 |
|
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
611 |
"Large // Large division" |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
612 |
self test:[(10000 factorial / 9999 factorial) == 10000]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
613 |
self test:[(20 factorial / 19 factorial) == 20]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
614 |
self test:[(20 factorial * 21 / 20 / 21) = (19 factorial)]. |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
615 |
|
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
616 |
" |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
617 |
self testLargeDivision |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
618 |
" |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
619 |
|
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
620 |
"Modified: / 20.5.1999 / 09:41:19 / cg" |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
621 |
! |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
622 |
|
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
623 |
testLargeMultiplication |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
624 |
|t1| |
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
625 |
|
3 | 626 |
"multiplication" |
627 |
t1 := 100. |
|
628 |
self test:[t1 * t1 == 10000]. |
|
10 | 629 |
self test:[(t1 perform:'*' asSymbol with:t1) == 10000]. |
11 | 630 |
self test:[(t1 * t1) printString = '10000']. |
631 |
self test:[(t1 perform:'*' asSymbol with:t1) printString = '10000']. |
|
632 |
||
3 | 633 |
t1 := 1000. |
634 |
self test:[t1 * t1 == 1000000]. |
|
10 | 635 |
self test:[(t1 perform:'*' asSymbol with:t1) == 1000000]. |
11 | 636 |
self test:[(t1 * t1) printString = '1000000']. |
637 |
self test:[(t1 perform:'*' asSymbol with:t1) printString = '1000000']. |
|
638 |
||
3 | 639 |
t1 := 10000. |
640 |
self test:[t1 * t1 == 100000000]. |
|
10 | 641 |
self test:[(t1 perform:'*' asSymbol with:t1) == 100000000]. |
11 | 642 |
self test:[(t1 * t1) printString = '100000000']. |
643 |
self test:[(t1 perform:'*' asSymbol with:t1) printString = '100000000']. |
|
644 |
||
3 | 645 |
t1 := 100000. |
646 |
SmallInteger maxBytes == 4 ifTrue:[ |
|
10 | 647 |
self test:[t1 * t1 = 10000000000]. |
648 |
self test:[(t1 perform:'*' asSymbol with:t1) = 10000000000]. |
|
3 | 649 |
]. |
650 |
SmallInteger maxBytes == 8 ifTrue:[ |
|
651 |
self test:[t1 * t1 == 10000000000]. |
|
10 | 652 |
self test:[(t1 perform:'*' asSymbol with:t1) == 10000000000]. |
3 | 653 |
]. |
4 | 654 |
|
11 | 655 |
self test:[(t1 * t1) printString = '10000000000']. |
4 | 656 |
self test:[(t1 perform:'*' asSymbol with:t1) printString = '10000000000']. |
11 | 657 |
|
3 | 658 |
t1 := 1000000. |
659 |
self test:[(t1 * t1) printString = '1000000000000']. |
|
11 | 660 |
self test:[(t1 perform:'*' asSymbol with:t1) printString = '1000000000000']. |
661 |
||
3 | 662 |
t1 := 10000000. |
663 |
self test:[(t1 * t1) printString = '100000000000000']. |
|
11 | 664 |
self test:[(t1 perform:'*' asSymbol with:t1) printString = '100000000000000']. |
665 |
||
3 | 666 |
t1 := 100000000. |
667 |
self test:[(t1 * t1) printString = '10000000000000000']. |
|
11 | 668 |
self test:[(t1 perform:'*' asSymbol with:t1) printString = '10000000000000000']. |
669 |
||
3 | 670 |
t1 := 1000000000. |
671 |
self test:[(t1 * t1) printString = '1000000000000000000']. |
|
11 | 672 |
self test:[(t1 perform:'*' asSymbol with:t1) printString = '1000000000000000000']. |
673 |
||
2 | 674 |
|
3 | 675 |
"Large * SmallInt multiplication" |
676 |
self test:[10 factorial printString = '3628800']. |
|
677 |
self test:[20 factorial printString = '2432902008176640000']. |
|
678 |
self test:[100 factorial printString = '93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000']. |
|
679 |
self test:[1000 factorial printString = '402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000']. |
|
2 | 680 |
|
3 | 681 |
"Large * Large multiplication" |
682 |
self test:[(20 factorial * 20 factorial) printString = '5919012181389927685417441689600000000']. |
|
7 | 683 |
|
684 |
" |
|
12
29d0f2e59dcb
splitted into smaller methods to avoid JIT-bail-out
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
685 |
self testLargeMultiplication |
7 | 686 |
" |
10 | 687 |
|
11 | 688 |
"Modified: / 20.5.1999 / 09:41:19 / cg" |
7 | 689 |
! |
690 |
||
19 | 691 |
testLiteralNumbers |
692 |
self test:[self num_00000000000010000 hexPrintString = '10000']. |
|
693 |
self test:[self num_00000000000100000 hexPrintString = '100000']. |
|
694 |
self test:[self num_00000000001000000 hexPrintString = '1000000']. |
|
695 |
self test:[self num_00000000010000000 hexPrintString = '10000000']. |
|
696 |
self test:[self num_00000000100000000 hexPrintString = '100000000']. |
|
697 |
self test:[self num_00000001000000000 hexPrintString = '1000000000']. |
|
698 |
self test:[self num_00000010000000000 hexPrintString = '10000000000']. |
|
699 |
self test:[self num_00000100000000000 hexPrintString = '100000000000']. |
|
700 |
self test:[self num_00001000000000000 hexPrintString = '1000000000000']. |
|
701 |
self test:[self num_00010000000000000 hexPrintString = '10000000000000']. |
|
702 |
self test:[self num_00100000000000000 hexPrintString = '100000000000000']. |
|
703 |
self test:[self num_01000000000000000 hexPrintString = '1000000000000000']. |
|
704 |
self test:[self num_10000000000000000 hexPrintString = '10000000000000000']. |
|
705 |
||
706 |
self test:[self num_00000000000007FFF hexPrintString = '7FFF']. |
|
707 |
self test:[self num_00000000000008000 hexPrintString = '8000']. |
|
708 |
self test:[self num_0000000000000FFFF hexPrintString = 'FFFF']. |
|
709 |
self test:[self num_000000000007FFFFF hexPrintString = '7FFFFF']. |
|
710 |
self test:[self num_00000000000800000 hexPrintString = '800000']. |
|
711 |
self test:[self num_00000000000FFFFFF hexPrintString = 'FFFFFF']. |
|
712 |
self test:[self num_0000000007FFFFFFF hexPrintString = '7FFFFFFF']. |
|
713 |
self test:[self num_00000000080000000 hexPrintString = '80000000']. |
|
714 |
self test:[self num_000000000FFFFFFFF hexPrintString = 'FFFFFFFF']. |
|
21 | 715 |
self test:[self num_0000000FFFFFFFFFF hexPrintString = 'FFFFFFFFFF']. |
716 |
self test:[self num_00000FFFFFFFFFFFF hexPrintString = 'FFFFFFFFFFFF']. |
|
717 |
self test:[self num_000FFFFFFFFFFFFFF hexPrintString = 'FFFFFFFFFFFFFF']. |
|
718 |
self test:[self num_0FFFFFFFFFFFFFFFF hexPrintString = 'FFFFFFFFFFFFFFFF']. |
|
719 |
self test:[self num_1FFFFFFFFFFFFFFFF hexPrintString = '1FFFFFFFFFFFFFFFF']. |
|
720 |
self test:[self num_20000000000000000 hexPrintString = '20000000000000000']. |
|
721 |
self test:[self num_3FFFFFFFFFFFFFFFF hexPrintString = '3FFFFFFFFFFFFFFFF']. |
|
722 |
self test:[self num_40000000000000000 hexPrintString = '40000000000000000']. |
|
723 |
self test:[self num_7FFFFFFFFFFFFFFFF hexPrintString = '7FFFFFFFFFFFFFFFF']. |
|
724 |
self test:[self num_80000000000000000 hexPrintString = '80000000000000000']. |
|
725 |
||
726 |
self test:[self num_00000FFFFFFFFFFFE hexPrintString = 'FFFFFFFFFFFE']. |
|
727 |
self test:[self num_00000FFFFFFFFFFFC hexPrintString = 'FFFFFFFFFFFC']. |
|
728 |
self test:[self num_00000FFFFFFFFFFF8 hexPrintString = 'FFFFFFFFFFF8']. |
|
729 |
self test:[self num_00000FFFFFFFFFFF0 hexPrintString = 'FFFFFFFFFFF0']. |
|
730 |
self test:[self num_00000FFFFFFFFFFE0 hexPrintString = 'FFFFFFFFFFE0']. |
|
731 |
self test:[self num_00000FFFFFFFFFFC0 hexPrintString = 'FFFFFFFFFFC0']. |
|
732 |
self test:[self num_00000FFFFFFFFFF80 hexPrintString = 'FFFFFFFFFF80']. |
|
733 |
self test:[self num_00000FFFFFFFFFF00 hexPrintString = 'FFFFFFFFFF00']. |
|
19 | 734 |
|
22 | 735 |
self test:[self num_0000000000FFF0000 hexPrintString = 'FFF0000']. |
736 |
||
19 | 737 |
" |
738 |
self testLiteralNumbers |
|
739 |
" |
|
740 |
||
22 | 741 |
"Modified: / 4.6.1999 / 18:41:09 / cg" |
19 | 742 |
! |
743 |
||
7 | 744 |
testPrinting1 |
745 |
self test:[10 printString = '10']. |
|
746 |
self test:[100 printString = '100']. |
|
747 |
self test:[1000 printString = '1000']. |
|
748 |
self test:[10000 printString = '10000']. |
|
749 |
self test:[100000 printString = '100000']. |
|
750 |
self test:[1000000 printString = '1000000']. |
|
751 |
self test:[10000000 printString = '10000000']. |
|
752 |
self test:[100000000 printString = '100000000']. |
|
753 |
self test:[1000000000 printString = '1000000000']. |
|
754 |
self test:[10000000000 printString = '10000000000']. |
|
755 |
self test:[100000000000 printString = '100000000000']. |
|
756 |
self test:[1000000000000 printString = '1000000000000']. |
|
757 |
self test:[10000000000000 printString = '10000000000000']. |
|
758 |
self test:[100000000000000 printString = '100000000000000']. |
|
759 |
self test:[1000000000000000 printString = '1000000000000000']. |
|
760 |
self test:[10000000000000000 printString = '10000000000000000']. |
|
761 |
self test:[100000000000000000 printString = '100000000000000000']. |
|
762 |
||
763 |
" |
|
764 |
self testPrinting1 |
|
765 |
" |
|
766 |
! |
|
767 |
||
768 |
testReading1 |
|
769 |
|t| |
|
770 |
||
5 | 771 |
self test:[(Integer readFrom:'4865804016353280000') printString = '4865804016353280000']. |
772 |
self test:[(Integer readFrom:'FFFFFFFF' radix:16) hexPrintString = 'FFFFFFFF']. |
|
773 |
self test:[(Integer readFrom:'FFFFFFFFF' radix:16) hexPrintString = 'FFFFFFFFF']. |
|
774 |
self test:[(Integer readFrom:'FFFFFFFFFF' radix:16) hexPrintString = 'FFFFFFFFFF']. |
|
775 |
self test:[(Integer readFrom:'FFFFFFFFFFF' radix:16) hexPrintString = 'FFFFFFFFFFF']. |
|
776 |
self test:[(Integer readFrom:'FFFFFFFFFFFF' radix:16) hexPrintString = 'FFFFFFFFFFFF']. |
|
15 | 777 |
self test:[(Integer readFrom:'FFFFFFFFFFFFF' radix:16) hexPrintString = 'FFFFFFFFFFFFF']. |
778 |
self test:[(Integer readFrom:'FFFFFFFFFFFFFF' radix:16) hexPrintString = 'FFFFFFFFFFFFFF']. |
|
5 | 779 |
|
780 |
self test:[(Integer readFrom:'10000000' radix:16) hexPrintString = '10000000']. |
|
781 |
self test:[(Integer readFrom:'100000000' radix:16) hexPrintString = '100000000']. |
|
782 |
self test:[(Integer readFrom:'1000000000' radix:16) hexPrintString = '1000000000']. |
|
783 |
self test:[(Integer readFrom:'10000000000' radix:16) hexPrintString = '10000000000']. |
|
784 |
self test:[(Integer readFrom:'100000000000' radix:16) hexPrintString = '100000000000']. |
|
15 | 785 |
self test:[(Integer readFrom:'1000000000000' radix:16) hexPrintString = '1000000000000']. |
786 |
self test:[(Integer readFrom:'10000000000000' radix:16) hexPrintString = '10000000000000']. |
|
5 | 787 |
|
788 |
t := Integer readFrom:'FFFFFFFF' radix:16. |
|
789 |
self test:[(t + 1) hexPrintString = '100000000']. |
|
790 |
t := Integer readFrom:'FFFFFFFFF' radix:16. |
|
791 |
self test:[(t + 1) hexPrintString = '1000000000']. |
|
792 |
t := Integer readFrom:'FFFFFFFFFF' radix:16. |
|
793 |
self test:[(t + 1) hexPrintString = '10000000000']. |
|
794 |
t := Integer readFrom:'FFFFFFFFFFF' radix:16. |
|
795 |
self test:[(t + 1) hexPrintString = '100000000000']. |
|
796 |
||
797 |
t := Integer readFrom:'10000000' radix:16. |
|
798 |
self test:[(t + 1) hexPrintString = '10000001']. |
|
799 |
t := Integer readFrom:'100000000' radix:16. |
|
800 |
self test:[(t + 1) hexPrintString = '100000001']. |
|
801 |
t := Integer readFrom:'1000000000' radix:16. |
|
802 |
self test:[(t + 1) hexPrintString = '1000000001']. |
|
803 |
t := Integer readFrom:'10000000000' radix:16. |
|
804 |
self test:[(t + 1) hexPrintString = '10000000001']. |
|
805 |
||
2 | 806 |
" |
7 | 807 |
self testReading1 |
2 | 808 |
" |
809 |
! ! |
|
810 |
||
811 |
!IntegerTest class methodsFor:'documentation'! |
|
812 |
||
813 |
version |
|
814 |
^ '$Header$' |
|
815 |
! ! |