The Inbox: CollectionsTests-tonyg.275.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: CollectionsTests-tonyg.275.mcz

commits-2
A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-tonyg.275.mcz

==================== Summary ====================

Name: CollectionsTests-tonyg.275
Author: tonyg
Time: 23 February 2017, 2:35:33.052791 pm
UUID: f65bf120-417c-4e73-9eb2-eadc9046f189
Ancestors: CollectionsTests-topa.274

Test SequenceableCollection>>#indexOfSubCollection:startingAt:.

=============== Diff against CollectionsTests-topa.274 ===============

Item was added:
+ ----- Method: SequenceableCollectionTest>>testIndexOfSubCollectionStartingAt (in category 'tests - accessing') -----
+ testIndexOfSubCollectionStartingAt
+ | c |
+ c := 'abcdefg' asArray. "NB. As of Collections-topa.733, String already permitted out-of-bounds start indexes, so we are careful here to select the SequenceableCollection implementation by using asArray."
+ self assert: (c indexOfSubCollection: 'cde' startingAt: 400) = 0.
+ self assert: (c indexOfSubCollection: 'cde' startingAt: 4) = 0.
+ self assert: (c indexOfSubCollection: 'cde' startingAt: 1) = 3.
+ self assert: (c indexOfSubCollection: 'cde' startingAt: 0) = 3.
+ self assert: (c indexOfSubCollection: 'cde' startingAt: -1) = 3.
+
+ self assert: (c indexOfSubCollection: 'abcdefg' startingAt: 400) = 0.
+ self assert: (c indexOfSubCollection: 'abcdefg' startingAt: 4) = 0.
+ self assert: (c indexOfSubCollection: 'abcdefg' startingAt: 1) = 1.
+ self assert: (c indexOfSubCollection: 'abcdefg' startingAt: 0) = 1.
+ self assert: (c indexOfSubCollection: 'abcdefg' startingAt: -1) = 1.
+
+ self assert: (c indexOfSubCollection: 'abcdefghij' startingAt: 400) = 0.
+ self assert: (c indexOfSubCollection: 'abcdefghij' startingAt: 4) = 0.
+ self assert: (c indexOfSubCollection: 'abcdefghij' startingAt: 1) = 0.
+ self assert: (c indexOfSubCollection: 'abcdefghij' startingAt: 0) = 0.
+ self assert: (c indexOfSubCollection: 'abcdefghij' startingAt: -1) = 0.
+ !