1 UnitTests define: #SortedArray &parents: {UnitTests ExtensibleArray}.
3 tc@(UnitTests SortedArray traits) testIndexForInsertingAsLastElement
5 se ::= SortedArray new.
6 insertIndex ::= se indexForInserting: 1.
7 tc assert: insertIndex = 0 description: 'Empty SortedArray should insert to 0.'.
8 se at: insertIndex insert: 1.
9 2 upTo: 10 do: [| :ind insertAt |
10 insertAt := se indexForInserting: ind.
11 tc assert: insertAt = (ind - 1)
12 description: 'SortedArray should maintain sort order for: ' ; (ind as: String).
13 se at: insertAt insert: 1].
16 tc@(UnitTests SortedArray traits) testAddByInsert
18 se ::= SortedArray new.
19 0 below: 10 do: [| :ind | se add: ind + 1].
20 tc assert: se size = 10 description: '#add: should increase size.'.
23 tc@(UnitTests SortedArray traits) suite
25 tc suiteForSelectors: {
26 #testIndexForInsertingAsLastElement.