Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.125.mcz==================== Summary ====================
Name: CollectionsTests-nice.125
Author: nice
Time: 22 December 2009, 7:44:05 am
UUID: e8206d49-62d5-c141-8852-cc39d4e011ab
Ancestors: CollectionsTests-nice.124
merge two tests from pharo
=============== Diff against CollectionsTests-nice.124 ===============
Item was changed:
+ ----- Method: OrderedCollectionTest>>testAddAfterIndex (in category 'testing-public methods') -----
- ----- Method: OrderedCollectionTest>>testAddAfterIndex (in category 'testsAdding') -----
testAddAfterIndex
"self run: #testAddAfterIndex"
| l |
l := #(1 2 3 4) asOrderedCollection.
l add: 77 afterIndex: 0.
self assert: (l = #(77 1 2 3 4) asOrderedCollection).
l add: 88 afterIndex: 2.
self assert: (l = #(77 1 88 2 3 4) asOrderedCollection).
l add: 99 afterIndex: l size.
self assert: (l = #(77 1 88 2 3 4 99) asOrderedCollection).
self should:[l add: 666 afterIndex: -1] raise: Error.
self should:[l add: 666 afterIndex: l size+1] raise: Error.
+
+ "Now make room by removing first two and last two elements,
+ and see if the illegal bounds test still fails"
+ (l first: 2) , (l last: 2) reverse do: [:e | l remove: e].
+ self should: [l add: 666 afterIndex: -1] raise: Error.
+ self should: [l add: 666 afterIndex: l size+1] raise: Error.!
- !
Item was changed:
+ ----- Method: OrderedCollectionTest>>testAddBeforeIndex (in category 'testing-public methods') -----
- ----- Method: OrderedCollectionTest>>testAddBeforeIndex (in category 'testsAdding') -----
testAddBeforeIndex
"self run: #testAddBeforeIndex"
| l |
l := #(1 2 3 4) asOrderedCollection.
l add: 77 beforeIndex: 1.
self assert: (l = #(77 1 2 3 4) asOrderedCollection).
l add: 88 beforeIndex: 3.
self assert: (l = #(77 1 88 2 3 4) asOrderedCollection).
l add: 99 beforeIndex: l size+1.
self assert: (l = #(77 1 88 2 3 4 99) asOrderedCollection).
self should:[l add: 666 beforeIndex: 0] raise: Error.
self should:[l add: 666 beforeIndex: l size+2] raise: Error.
+
+ "Now make room by removing first two and last two elements,
+ and see if the illegal bounds test still fails"
+ (l first: 2) , (l last: 2) reverse do: [:e | l remove: e].
+ self should:[l add: 666 beforeIndex: 0] raise: Error.
+ self should:[l add: 666 beforeIndex: l size+2] raise: Error.
!