1357
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
1447
|
3 |
"{ Package: 'stx:goodies/regression' }"
|
1113
|
4 |
|
|
5 |
"{ NameSpace: RegressionTests }"
|
|
6 |
|
|
7 |
TestCase subclass:#UninterpretedBytesTest
|
|
8 |
instanceVariableNames:''
|
|
9 |
classVariableNames:''
|
|
10 |
poolDictionaries:''
|
|
11 |
category:'tests-Regression-Collections'
|
|
12 |
!
|
|
13 |
|
|
14 |
|
1359
|
15 |
!UninterpretedBytesTest class methodsFor:'queries'!
|
|
16 |
|
|
17 |
coveredClassNames
|
|
18 |
^ #( UninterpretedBytes)
|
|
19 |
! !
|
|
20 |
|
1113
|
21 |
!UninterpretedBytesTest methodsFor:'tests'!
|
|
22 |
|
1357
|
23 |
test00_byteAccess
|
|
24 |
|bytes|
|
|
25 |
|
1574
|
26 |
bytes := #[ 16r10 16r20 16r30 16r40 ] copy.
|
1357
|
27 |
|
|
28 |
self assert:(bytes byteAt:1) == 16r10.
|
|
29 |
self assert:(bytes byteAt:2) == 16r20.
|
|
30 |
self assert:(bytes byteAt:3) == 16r30.
|
|
31 |
self assert:(bytes byteAt:4) == 16r40.
|
|
32 |
|
|
33 |
self assert:(bytes signedByteAt:1) == 16r10.
|
|
34 |
self assert:(bytes signedByteAt:2) == 16r20.
|
|
35 |
self assert:(bytes signedByteAt:3) == 16r30.
|
|
36 |
self assert:(bytes signedByteAt:4) == 16r40.
|
|
37 |
|
1574
|
38 |
bytes := #[ 16rFF 16r7F 16r80 16r81 ] copy.
|
1357
|
39 |
|
|
40 |
self assert:(bytes byteAt:1) == 16rFF.
|
|
41 |
self assert:(bytes byteAt:2) == 16r7F.
|
|
42 |
self assert:(bytes byteAt:3) == 16r80.
|
|
43 |
self assert:(bytes byteAt:4) == 16r81.
|
|
44 |
|
|
45 |
self assert:(bytes signedByteAt:1) == -1.
|
|
46 |
self assert:(bytes signedByteAt:2) == 127.
|
|
47 |
self assert:(bytes signedByteAt:3) == -128.
|
|
48 |
self assert:(bytes signedByteAt:4) == -127.
|
|
49 |
|
|
50 |
bytes := bytes copy.
|
|
51 |
|
|
52 |
bytes byteAt:1 put:16r10.
|
|
53 |
self assert:(bytes byteAt:1) == 16r10.
|
|
54 |
self assert:(bytes signedByteAt:1) == 16r10.
|
|
55 |
|
|
56 |
bytes byteAt:1 put:16r80.
|
|
57 |
self assert:(bytes byteAt:1) == 16r80.
|
|
58 |
self assert:(bytes signedByteAt:1) == -128.
|
|
59 |
|
|
60 |
bytes signedByteAt:1 put:16r10.
|
|
61 |
self assert:(bytes byteAt:1) == 16r10.
|
|
62 |
self assert:(bytes signedByteAt:1) == 16r10.
|
|
63 |
|
|
64 |
bytes signedByteAt:1 put:-1.
|
|
65 |
self assert:(bytes byteAt:1) == 16rFF.
|
|
66 |
self assert:(bytes signedByteAt:1) == -1.
|
|
67 |
|
1362
|
68 |
"/ check immutablility checks
|
|
69 |
bytes := #[ 16rFF 16r00 ] beImmutable.
|
1447
|
70 |
self
|
1574
|
71 |
should:[
|
|
72 |
bytes byteAt:1 put:0
|
|
73 |
]
|
|
74 |
raise:NoModificationError.
|
1362
|
75 |
self assert:(bytes at:1) == 16rFF.
|
|
76 |
|
|
77 |
"/ check bounds checks
|
|
78 |
#(3 0 -1 -2) do:[:badIndex |
|
1574
|
79 |
self
|
|
80 |
should:[
|
|
81 |
#[ 16rFF 16r00 ] byteAt:badIndex
|
|
82 |
]
|
|
83 |
raise:SubscriptOutOfBoundsError.
|
1362
|
84 |
|
1574
|
85 |
self
|
|
86 |
should:[
|
|
87 |
#[ 16rFF 16r00 ] signedByteAt:badIndex
|
|
88 |
]
|
|
89 |
raise:SubscriptOutOfBoundsError.
|
1362
|
90 |
|
1574
|
91 |
self
|
|
92 |
should:[
|
|
93 |
#[ 16rFF 16r00 ] copy byteAt:badIndex put:0
|
|
94 |
]
|
|
95 |
raise:SubscriptOutOfBoundsError.
|
1362
|
96 |
|
1574
|
97 |
self
|
|
98 |
should:[
|
|
99 |
#[ 16rFF 16r00 ] copy signedByteAt:badIndex put:0
|
|
100 |
]
|
|
101 |
raise:SubscriptOutOfBoundsError.
|
1362
|
102 |
]
|
|
103 |
|
1357
|
104 |
"
|
|
105 |
self run:#test00_byteAccess
|
|
106 |
"
|
1574
|
107 |
|
|
108 |
"Modified: / 16-02-2017 / 20:12:06 / stefan"
|
1357
|
109 |
!
|
|
110 |
|
|
111 |
test01_int16Access
|
1362
|
112 |
|check bytes|
|
1357
|
113 |
|
1447
|
114 |
check :=
|
|
115 |
[:bytes1 :bytes2 |
|
|
116 |
|wBytes|
|
1357
|
117 |
|
1447
|
118 |
"/ bytes1 := #[ 16r10 16r20 16r30 16r40 ].
|
|
119 |
self assert:(bytes1 unsignedInt16At:1 MSB:true) = 16r1020.
|
|
120 |
self assert:(bytes1 unsignedInt16At:1 MSB:false) = 16r2010.
|
|
121 |
self assert:(bytes1 unsignedInt16At:2 MSB:true) = 16r2030.
|
|
122 |
self assert:(bytes1 unsignedInt16At:2 MSB:false) = 16r3020.
|
|
123 |
self assert:(bytes1 unsignedInt16At:3 MSB:true) = 16r3040.
|
|
124 |
self assert:(bytes1 unsignedInt16At:3 MSB:false) = 16r4030.
|
1357
|
125 |
|
1447
|
126 |
self assert:(bytes1 signedInt16At:1 MSB:true) = 16r1020.
|
|
127 |
self assert:(bytes1 signedInt16At:1 MSB:false) = 16r2010.
|
|
128 |
self assert:(bytes1 signedInt16At:2 MSB:true) = 16r2030.
|
|
129 |
self assert:(bytes1 signedInt16At:2 MSB:false) = 16r3020.
|
|
130 |
self assert:(bytes1 signedInt16At:3 MSB:true) = 16r3040.
|
|
131 |
self assert:(bytes1 signedInt16At:3 MSB:false) = 16r4030.
|
1357
|
132 |
|
1447
|
133 |
"/ bytes2 := #[ 16rFF 16r7F 16r80 16r81 ].
|
|
134 |
self assert:(bytes2 unsignedInt16At:1 MSB:true) = 16rFF7F.
|
|
135 |
self assert:(bytes2 unsignedInt16At:1 MSB:false) = 16r7FFF.
|
|
136 |
self assert:(bytes2 unsignedInt16At:2 MSB:true) = 16r7F80.
|
|
137 |
self assert:(bytes2 unsignedInt16At:2 MSB:false) = 16r807F.
|
|
138 |
self assert:(bytes2 unsignedInt16At:3 MSB:true) = 16r8081.
|
|
139 |
self assert:(bytes2 unsignedInt16At:3 MSB:false) = 16r8180.
|
1357
|
140 |
|
1447
|
141 |
self assert:(bytes2 signedInt16At:1 MSB:true) = -129. "/ 16rFF7F signExtendedShortValue
|
|
142 |
self assert:(bytes2 signedInt16At:1 MSB:false) = 16r7FFF.
|
|
143 |
self assert:(bytes2 signedInt16At:2 MSB:true) = 16r7F80.
|
|
144 |
self assert:(bytes2 signedInt16At:2 MSB:false) = -32641. "/ 16r807F signExtendedShortValue.
|
|
145 |
self assert:(bytes2 signedInt16At:3 MSB:true) = -32639. "/ 16r8081 signExtendedShortValue.
|
|
146 |
self assert:(bytes2 signedInt16At:3 MSB:false) = -32384. "/ 16r8180 signExtendedShortValue.
|
1361
|
147 |
|
1447
|
148 |
wBytes := bytes2 copy.
|
1357
|
149 |
|
1447
|
150 |
wBytes unsignedInt16At:1 put:16r1020 MSB:false.
|
|
151 |
self assert:(wBytes unsignedInt16At:1 MSB:false) = 16r1020.
|
|
152 |
self assert:(wBytes signedInt16At:1 MSB:false) = 16r1020.
|
1361
|
153 |
|
1447
|
154 |
wBytes unsignedInt16At:1 put:16r1020 MSB:true.
|
|
155 |
self assert:(wBytes unsignedInt16At:1 MSB:false) = 16r2010.
|
|
156 |
self assert:(wBytes signedInt16At:1 MSB:false) = 16r2010.
|
1357
|
157 |
|
1447
|
158 |
wBytes unsignedInt16At:1 put:16rFFFE MSB:false.
|
|
159 |
self assert:(wBytes unsignedInt16At:1 MSB:false) = 16rFFFE.
|
|
160 |
self assert:(wBytes signedInt16At:1 MSB:false) = -2.
|
1357
|
161 |
|
1447
|
162 |
wBytes unsignedInt16At:1 put:16rFFFE MSB:true.
|
|
163 |
self assert:(wBytes unsignedInt16At:1 MSB:false) = 16rFEFF.
|
|
164 |
self assert:(wBytes signedInt16At:1 MSB:false) = -257. "/ 16rFEFF signExtendedShortValue
|
1357
|
165 |
|
1447
|
166 |
wBytes signedInt16At:1 put:16r1020 MSB:false.
|
|
167 |
self assert:(wBytes unsignedInt16At:1 MSB:false) = 16r1020.
|
|
168 |
self assert:(wBytes signedInt16At:1 MSB:false) = 16r1020.
|
1357
|
169 |
|
1447
|
170 |
wBytes signedInt16At:1 put:16r1020 MSB:true.
|
|
171 |
self assert:(wBytes unsignedInt16At:1 MSB:false) = 16r2010.
|
|
172 |
self assert:(wBytes signedInt16At:1 MSB:false) = 16r2010.
|
1357
|
173 |
|
1447
|
174 |
wBytes signedInt16At:1 put:-3 MSB:false.
|
|
175 |
self assert:(wBytes unsignedInt16At:1 MSB:false) = 16rFFFD.
|
|
176 |
self assert:(wBytes signedInt16At:1 MSB:false) = -3.
|
|
177 |
].
|
1357
|
178 |
|
1447
|
179 |
check
|
|
180 |
value: #[ 16r10 16r20 16r30 16r40 ]
|
|
181 |
value: #[ 16rFF 16r7F 16r80 16r81 ].
|
1357
|
182 |
|
1447
|
183 |
check
|
|
184 |
value: (WordArray with:16r2010 with:16r4030)
|
|
185 |
value: (WordArray with:16r7FFF with:16r8180).
|
1357
|
186 |
|
1447
|
187 |
check
|
|
188 |
value: (IntegerArray with:16r40302010)
|
|
189 |
value: (IntegerArray with:16r81807FFF).
|
1361
|
190 |
|
1362
|
191 |
"/ check immutablility checks
|
|
192 |
bytes := #[ 1 2 ] beImmutable.
|
1447
|
193 |
self
|
|
194 |
should:[
|
|
195 |
bytes unsignedInt16At:1 put:0
|
|
196 |
]
|
|
197 |
raise:NoModificationError.
|
1362
|
198 |
self assert:(bytes at:1) == 1.
|
|
199 |
self assert:(bytes at:2) == 2.
|
|
200 |
|
|
201 |
"/ check bounds checks
|
|
202 |
#(2 0 -1 -2) do:[:badIndex |
|
1447
|
203 |
self
|
|
204 |
should:[
|
|
205 |
#[ 16rFF 16r00 ] unsignedInt16At:badIndex MSB:true
|
|
206 |
]
|
|
207 |
raise:SubscriptOutOfBoundsError.
|
1362
|
208 |
|
1447
|
209 |
self
|
|
210 |
should:[
|
|
211 |
#[ 16rFF 16r00 ] unsignedInt16At:badIndex MSB:false
|
|
212 |
]
|
|
213 |
raise:SubscriptOutOfBoundsError.
|
1362
|
214 |
]
|
1357
|
215 |
|
|
216 |
"
|
|
217 |
self run:#test01_int16Access
|
|
218 |
"
|
|
219 |
!
|
|
220 |
|
|
221 |
test02_int32Access
|
|
222 |
|bytes|
|
|
223 |
|
|
224 |
bytes := #[ 16r10 16r20 16r30 16r40 16r50 ].
|
|
225 |
|
|
226 |
self assert:(bytes unsignedInt32At:1 MSB:true) = 16r10203040.
|
|
227 |
self assert:(bytes unsignedInt32At:1 MSB:false) = 16r40302010.
|
|
228 |
self assert:(bytes unsignedInt32At:2 MSB:true) = 16r20304050.
|
|
229 |
self assert:(bytes unsignedInt32At:2 MSB:false) = 16r50403020.
|
|
230 |
|
|
231 |
self assert:(bytes signedInt32At:1 MSB:true) = 16r10203040.
|
|
232 |
self assert:(bytes signedInt32At:1 MSB:false) = 16r40302010.
|
|
233 |
self assert:(bytes signedInt32At:2 MSB:true) = 16r20304050.
|
|
234 |
self assert:(bytes signedInt32At:2 MSB:false) = 16r50403020.
|
|
235 |
|
|
236 |
|
|
237 |
bytes := #[ 16r80 16rFF 16r01 16r03 16r80 ].
|
|
238 |
|
|
239 |
self assert:(bytes unsignedInt32At:1 MSB:true) = 16r80FF0103.
|
|
240 |
self assert:(bytes unsignedInt32At:1 MSB:false) = 16r0301FF80.
|
|
241 |
self assert:(bytes unsignedInt32At:2 MSB:true) = 16rFF010380.
|
|
242 |
self assert:(bytes unsignedInt32At:2 MSB:false) = 16r800301FF.
|
|
243 |
|
|
244 |
self assert:(bytes signedInt32At:1 MSB:true) = -2130771709. "/ 16r80FF0103 signExtendedLongValue
|
|
245 |
self assert:(bytes signedInt32At:1 MSB:false) = 16r0301FF80.
|
|
246 |
self assert:(bytes signedInt32At:2 MSB:true) = -16710784. "/ 16rFF010380 signExtendedLongValue.
|
|
247 |
self assert:(bytes signedInt32At:2 MSB:false) = -2147286529. "/ 16r800301FF signExtendedLongValue.
|
|
248 |
|
|
249 |
bytes := bytes copy.
|
|
250 |
|
|
251 |
bytes unsignedInt32At:1 put:16r10203040 MSB:false.
|
|
252 |
self assert:(bytes unsignedInt32At:1 MSB:false) = 16r10203040.
|
|
253 |
self assert:(bytes signedInt32At:1 MSB:false) = 16r10203040.
|
|
254 |
|
|
255 |
bytes unsignedInt32At:1 put:16r10203040 MSB:true.
|
|
256 |
self assert:(bytes unsignedInt32At:1 MSB:false) = 16r40302010.
|
|
257 |
self assert:(bytes signedInt32At:1 MSB:false) = 16r40302010.
|
|
258 |
|
|
259 |
bytes unsignedInt32At:1 put:16r10203080 MSB:true.
|
|
260 |
self assert:(bytes unsignedInt32At:1 MSB:false) = 16r80302010.
|
|
261 |
self assert:(bytes signedInt32At:1 MSB:false) = -2144329712. "/ 16r80302010 signExtendedLongValue.
|
|
262 |
|
|
263 |
bytes unsignedInt32At:1 put:16rFFFFFFFE MSB:false.
|
|
264 |
self assert:(bytes unsignedInt32At:1 MSB:false) = 16rFFFFFFFE.
|
|
265 |
self assert:(bytes signedInt32At:1 MSB:false) = -2.
|
|
266 |
|
|
267 |
bytes signedInt32At:1 put:16r40302010 MSB:false.
|
|
268 |
self assert:(bytes unsignedInt32At:1 MSB:false) = 16r40302010.
|
|
269 |
self assert:(bytes signedInt32At:1 MSB:false) = 16r40302010.
|
|
270 |
|
|
271 |
bytes signedInt32At:1 put:-3 MSB:false.
|
|
272 |
self assert:(bytes unsignedInt32At:1 MSB:false) = 16rFFFFFFFD.
|
|
273 |
self assert:(bytes signedInt32At:1 MSB:false) = -3.
|
|
274 |
|
1362
|
275 |
"/ check immutablility checks
|
|
276 |
bytes := #[ 1 2 3 4 ] beImmutable.
|
1447
|
277 |
self
|
|
278 |
should:[
|
|
279 |
bytes unsignedInt32At:1 put:0
|
|
280 |
]
|
|
281 |
raise:NoModificationError.
|
1362
|
282 |
self assert:(bytes at:1) == 1.
|
|
283 |
self assert:(bytes at:2) == 2.
|
|
284 |
self assert:(bytes at:3) == 3.
|
|
285 |
self assert:(bytes at:4) == 4.
|
|
286 |
|
|
287 |
"/ check bounds checks
|
|
288 |
#(2 0 -1 -2) do:[:badIndex |
|
1447
|
289 |
self
|
|
290 |
should:[
|
|
291 |
#[ 16rFF 16r01 16r02 16r03 ] unsignedInt32At:badIndex MSB:true
|
|
292 |
]
|
|
293 |
raise:SubscriptOutOfBoundsError.
|
1362
|
294 |
|
1447
|
295 |
self
|
|
296 |
should:[
|
|
297 |
#[ 16rFF 16r01 16r02 16r03 ] unsignedInt32At:badIndex MSB:false
|
|
298 |
]
|
|
299 |
raise:SubscriptOutOfBoundsError.
|
1362
|
300 |
]
|
|
301 |
|
1357
|
302 |
"
|
|
303 |
self run:#test02_int32Access
|
|
304 |
"
|
|
305 |
!
|
|
306 |
|
|
307 |
test03_int64Access
|
|
308 |
|bytes|
|
|
309 |
|
|
310 |
bytes := #[ 16r10 16r20 16r30 16r40 16r50 16r60 16r70 16r80 16r90].
|
|
311 |
|
|
312 |
self assert:(bytes unsignedInt64At:1 MSB:true) = 16r1020304050607080.
|
|
313 |
self assert:(bytes unsignedInt64At:1 MSB:false) = 16r8070605040302010.
|
|
314 |
self assert:(bytes unsignedInt64At:2 MSB:true) = 16r2030405060708090.
|
|
315 |
self assert:(bytes unsignedInt64At:2 MSB:false) = 16r9080706050403020.
|
|
316 |
|
|
317 |
self assert:(bytes signedInt64At:1 MSB:true) = 16r1020304050607080.
|
|
318 |
self assert:(bytes signedInt64At:1 MSB:false) = -9191740941672636400. "/ 16r8070605040302010 signExtendedLongLongValue
|
|
319 |
self assert:(bytes signedInt64At:2 MSB:true) = 16r2030405060708090.
|
|
320 |
self assert:(bytes signedInt64At:2 MSB:false) = -8034298176263409632. "/ 16r9080706050403020 signExtendedLongLongValue.
|
|
321 |
|
|
322 |
bytes := bytes copy.
|
|
323 |
bytes unsignedInt64At:1 put:16r30405060708090A0 MSB:true.
|
|
324 |
self assert:(bytes unsignedInt64At:1 MSB:true) = 16r30405060708090A0.
|
|
325 |
self assert:(bytes unsignedInt64At:1 MSB:false) = 16rA090807060504030.
|
|
326 |
self assert:(bytes signedInt64At:1 MSB:true) = 16r30405060708090A0.
|
|
327 |
self assert:(bytes signedInt64At:1 MSB:false) = -6876855410854182864. "/ 16rA090807060504030 signExtendedLongLongValue.
|
|
328 |
|
|
329 |
bytes signedInt64At:1 put:-6876855410854182864 MSB:true.
|
|
330 |
self assert:(bytes unsignedInt64At:1 MSB:true) = 16rA090807060504030.
|
|
331 |
self assert:(bytes signedInt64At:1 MSB:true) = -6876855410854182864.
|
|
332 |
|
|
333 |
bytes signedInt64At:1 put:-6876855410854182864 MSB:false.
|
|
334 |
self assert:(bytes unsignedInt64At:1 MSB:false) = 16rA090807060504030.
|
|
335 |
self assert:(bytes signedInt64At:1 MSB:false) = -6876855410854182864.
|
|
336 |
|
|
337 |
bytes unsignedInt64At:1 put:16r30405060708090A0 MSB:false.
|
|
338 |
self assert:(bytes unsignedInt64At:1 MSB:true) = 16rA090807060504030.
|
|
339 |
self assert:(bytes unsignedInt64At:1 MSB:false) = 16r30405060708090A0.
|
|
340 |
self assert:(bytes signedInt64At:1 MSB:true) = -6876855410854182864. "/ 16rA090807060504030 signExtendedLongLongValue.
|
|
341 |
self assert:(bytes signedInt64At:1 MSB:false) = 16r30405060708090A0.
|
|
342 |
|
1362
|
343 |
"/ check immutablility checks
|
|
344 |
bytes := #[ 1 2 3 4 5 6 7 8 ] beImmutable.
|
1447
|
345 |
self
|
|
346 |
should:[
|
|
347 |
bytes unsignedInt64At:1 put:0
|
|
348 |
]
|
|
349 |
raise:NoModificationError.
|
1362
|
350 |
self assert:(bytes at:1) == 1.
|
|
351 |
self assert:(bytes at:2) == 2.
|
|
352 |
self assert:(bytes at:3) == 3.
|
|
353 |
self assert:(bytes at:4) == 4.
|
|
354 |
self assert:(bytes at:5) == 5.
|
|
355 |
self assert:(bytes at:6) == 6.
|
|
356 |
self assert:(bytes at:7) == 7.
|
|
357 |
self assert:(bytes at:8) == 8.
|
|
358 |
|
|
359 |
"/ check bounds checks
|
|
360 |
#(2 0 -1 -2) do:[:badIndex |
|
1447
|
361 |
self
|
|
362 |
should:[
|
|
363 |
#[ 16rFF 16r01 16r02 16r03 16r04 16r05 16r06 16r07 ] unsignedInt64At:badIndex MSB:true
|
|
364 |
]
|
|
365 |
raise:SubscriptOutOfBoundsError.
|
1362
|
366 |
|
1447
|
367 |
self
|
|
368 |
should:[
|
|
369 |
#[ 16rFF 16r01 16r02 16r03 16r04 16r05 16r06 16r07 ] unsignedInt64At:badIndex MSB:false
|
|
370 |
]
|
|
371 |
raise:SubscriptOutOfBoundsError.
|
1362
|
372 |
]
|
|
373 |
|
1357
|
374 |
"
|
|
375 |
self run:#test03_int64Access
|
|
376 |
"
|
|
377 |
!
|
|
378 |
|
|
379 |
test10_floatAccess
|
1113
|
380 |
|bytes|
|
|
381 |
|
|
382 |
bytes := ByteArray new:4.
|
|
383 |
bytes floatAt:1 put:1.234.
|
|
384 |
self assert:(bytes = #[182 243 157 63]).
|
|
385 |
|
|
386 |
bytes floatAt:1 put:2.345 asShortFloat.
|
|
387 |
self assert:(bytes = #[123 20 22 64]).
|
|
388 |
|
|
389 |
bytes floatAt:1 put:345.
|
|
390 |
self assert:(bytes = #[0 128 172 67]).
|
|
391 |
|
|
392 |
|
|
393 |
bytes := ByteArray new:8.
|
|
394 |
bytes doubleAt:1 put:1.234.
|
|
395 |
self assert:(bytes = #[88 57 180 200 118 190 243 63]).
|
|
396 |
|
|
397 |
bytes doubleAt:1 put:2.345 asShortFloat.
|
|
398 |
self assert:(bytes = #[0 0 0 96 143 194 2 64]).
|
|
399 |
|
|
400 |
bytes doubleAt:1 put:345.
|
|
401 |
self assert:(bytes = #[0 0 0 0 0 144 117 64]).
|
|
402 |
|
1362
|
403 |
"/ check bounds checks
|
|
404 |
#(2 0 -1 -2) do:[:badIndex |
|
1447
|
405 |
self
|
|
406 |
should:[
|
|
407 |
#[ 16rFF 16r01 16r02 16r03 ] floatAt:badIndex MSB:true
|
|
408 |
]
|
|
409 |
raise:SubscriptOutOfBoundsError.
|
1362
|
410 |
|
1447
|
411 |
self
|
|
412 |
should:[
|
|
413 |
#[ 16rFF 16r01 16r02 16r03 ] floatAt:badIndex MSB:false
|
|
414 |
]
|
|
415 |
raise:SubscriptOutOfBoundsError.
|
1362
|
416 |
|
1447
|
417 |
self
|
|
418 |
should:[
|
|
419 |
#[ 16rFF 16r01 16r02 16r03 16rFF 16r01 16r02 16r03 ] doubleAt:badIndex MSB:true
|
|
420 |
]
|
|
421 |
raise:SubscriptOutOfBoundsError.
|
1362
|
422 |
|
1447
|
423 |
self
|
|
424 |
should:[
|
|
425 |
#[ 16rFF 16r01 16r02 16r03 16rFF 16r01 16r02 16r03 ] doubleAt:badIndex MSB:false
|
|
426 |
]
|
|
427 |
raise:SubscriptOutOfBoundsError.
|
1362
|
428 |
]
|
|
429 |
|
1113
|
430 |
"
|
1357
|
431 |
self run:#test10_floatAccess
|
1113
|
432 |
"
|
1358
|
433 |
!
|
|
434 |
|
|
435 |
test90_backwardCompatibility
|
|
436 |
"/ backward compatibility stuff
|
|
437 |
self assert:(#[ 16r10 16r20 ] wordAt:1 MSB:true) = 16r1020.
|
|
438 |
self assert:(#[ 16r10 16r20 ] wordAt:1 MSB:false) = 16r2010.
|
|
439 |
self assert:(#[ 16r80 16r20 ] wordAt:1 MSB:true) = 16r8020.
|
|
440 |
self assert:(#[ 16r80 16r20 ] wordAt:1 MSB:false) = 16r2080.
|
|
441 |
|
|
442 |
self assert:(#[ 16r10 16r20 ] signedWordAt:1 MSB:true) = 16r1020.
|
|
443 |
self assert:(#[ 16r10 16r20 ] signedWordAt:1 MSB:false) = 16r2010.
|
|
444 |
self assert:(#[ 16r80 16r20 ] signedWordAt:1 MSB:true) = -32736. "/ 16r8020 signExtendedShortValue.
|
|
445 |
self assert:(#[ 16r80 16r20 ] signedWordAt:1 MSB:false) = 16r2080.
|
|
446 |
|
|
447 |
self assert:(#[ 16r10 16r20 16r30 16r40 ] longAt:1 bigEndian:true) = 16r10203040.
|
|
448 |
self assert:(#[ 16r10 16r20 16r30 16r40 ] longAt:1 bigEndian:false) = 16r40302010.
|
|
449 |
self assert:(#[ 16r80 16r20 16r30 16r40 ] longAt:1 bigEndian:true) = -2145374144. "/ 16r80203040 signExtendedLongValue.
|
|
450 |
self assert:(#[ 16r80 16r20 16r30 16r40 ] longAt:1 bigEndian:false) = 16r40302080.
|
|
451 |
|
|
452 |
"
|
|
453 |
self run:#test90_backwardCompatibility
|
|
454 |
"
|
1113
|
455 |
! !
|
|
456 |
|
|
457 |
!UninterpretedBytesTest class methodsFor:'documentation'!
|
|
458 |
|
|
459 |
version
|
|
460 |
^ '$Header$'
|
|
461 |
!
|
|
462 |
|
|
463 |
version_CVS
|
|
464 |
^ '$Header$'
|
|
465 |
! !
|
|
466 |
|