299 ! ! |
299 ! ! |
300 |
300 |
301 !CollectionTests methodsFor:'tests-interval'! |
301 !CollectionTests methodsFor:'tests-interval'! |
302 |
302 |
303 testInterval01 |
303 testInterval01 |
304 |i| |
304 |i1 i2| |
305 |
305 |
306 i := 1 to:10. |
306 i1 := 1 to:10. |
307 |
307 |
308 self assert: ( i size == 10 ). |
308 self assert: ( i1 size == 10 ). |
309 |
309 |
310 self assert: ( i includes:1 ). |
310 self assert: ( i1 includes:1 ). |
311 self assert: ( i includes:10 ). |
311 self assert: ( i1 includes:10 ). |
312 |
312 |
313 self assert: ( i min == 1 ). |
313 self assert: ( i1 min == 1 ). |
314 self assert: ( i max == 10 ). |
314 self assert: ( i1 max == 10 ). |
315 |
315 |
316 "cannot add/remove" |
316 "cannot add/remove" |
317 self should:[i add:99] raise:Error. |
317 self should:[i1 add:99] raise:Error. |
318 self should:[i remove:10] raise:Error. |
318 self should:[i1 remove:10] raise:Error. |
|
319 |
|
320 i2 := 2 to:20 by:2. |
|
321 self assert: ( i2 size == 10 ). |
|
322 |
|
323 self assert: ( i2 includes:0 ) not. |
|
324 self assert: ( i2 includes:1 ) not. |
|
325 self assert: ( i2 includes:2 ). |
|
326 self assert: ( i2 includes:3 ) not. |
|
327 self assert: ( i2 includes:10 ). |
|
328 self assert: ( i2 includes:19 ) not. |
|
329 self assert: ( i2 includes:20 ). |
|
330 self assert: ( i2 includes:21 ) not. |
|
331 self assert: ( i2 includes:22 ) not. |
|
332 |
|
333 self assert: ( i2 min == 2 ). |
|
334 self assert: ( i2 max == 20 ). |
|
335 |
|
336 self assert: ( i2 keys asArray = (1 to:10) asArray ). |
319 |
337 |
320 " |
338 " |
321 self basicNew testInterval01 |
339 self basicNew testInterval01 |
322 " |
340 " |
|
341 |
|
342 "Modified: / 10-10-2011 / 13:10:43 / cg" |
323 ! ! |
343 ! ! |
324 |
344 |
325 !CollectionTests methodsFor:'tests-orderedCollection'! |
345 !CollectionTests methodsFor:'tests-orderedCollection'! |
326 |
346 |
327 testOrderedCollection01_Sort1 |
347 testOrderedCollection01_Sort1 |