[squeak-dev] The Trunk: CollectionsTests-ul.182.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Mar 1 07:25:12 UTC 2011


Levente Uzonyi uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-ul.182.mcz

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

Name: CollectionsTests-ul.182
Author: ul
Time: 1 March 2011, 8:25:05.964 am
UUID: 6dcc19af-ee78-8a41-9b31-fc2246252240
Ancestors: CollectionsTests-ul.181

- added a test for #overlappingPairsCollect: to OrderedCollectionTest
- recategorized some methods in SequenceableCollectionTest

=============== Diff against CollectionsTests-ul.181 ===============

Item was added:
+ ----- Method: OrderedCollectionTest>>testOverlappingPairsCollect (in category 'testsEnumerating') -----
+ testOverlappingPairsCollect
+ 
+ 	| o |
+ 	o := #(5 4 3 2 1) asOrderedCollection.
+ 	self
+ 		assert: #(9 7 5 3) asOrderedCollection
+ 		equals: (o overlappingPairsCollect: [ :a :b | a + b ])!

Item was changed:
+ ----- Method: SequenceableCollectionTest>>testAfterIfAbsent (in category 'tests - testing') -----
- ----- Method: SequenceableCollectionTest>>testAfterIfAbsent (in category 'testing - testing') -----
  testAfterIfAbsent
  
  	| col |
  	col := #(2 3 4).
  	self assert: ((col after: 4 ifAbsent: ['block']) = 'block').
  	self assert: ((col after: 5 ifAbsent: ['block']) = 'block').
  	self assert: ((col after: 2 ifAbsent: ['block']) = 3).!

Item was changed:
+ ----- Method: SequenceableCollectionTest>>testBeforeIfAbsent (in category 'tests - testing') -----
- ----- Method: SequenceableCollectionTest>>testBeforeIfAbsent (in category 'testing - testing') -----
  testBeforeIfAbsent
  
  	| col |
  	col := #(2 3 4).	
  	self assert: ((col before: 2 ifAbsent: ['block']) = 'block').
  	self assert: ((col before: 5 ifAbsent: ['block']) = 'block').
  	self assert: ((col before: 3 ifAbsent: ['block']) = 2).!

Item was changed:
+ ----- Method: SequenceableCollectionTest>>testBeginsWith (in category 'tests - testing') -----
- ----- Method: SequenceableCollectionTest>>testBeginsWith (in category 'testing - testing') -----
  testBeginsWith
  	"We can't test SequenceableCollection directly. However, we can test a sampling of its descendants."
  
  	| la prefix oc |
  	la := #(1 2 3 4 5 6).
  	oc := OrderedCollection new.
  	oc add: 1; add: 2; add: 3.
  
  	self assert: (la beginsWith: #(1)).
  	self assert: (la beginsWith: #(1 2)).
  	self assert: (la beginsWith: #(1 2 3)).
  	self assert: (la beginsWith: oc).
  	self deny: (la beginsWith: #()).
  	self deny: (la beginsWith: '').
  	self deny: (la beginsWith: OrderedCollection new).
  	
  	self assert: (oc beginsWith: #(1 2)).
  	
  	prefix := OrderedCollection new.
  	self deny: (oc beginsWith: prefix).
  	prefix add: 1.
  	self assert: (oc beginsWith: prefix).
  	prefix add: 2.
  	self assert: (oc beginsWith: prefix).
  	prefix add: 3.
  	self assert: (oc beginsWith: prefix).
  	prefix add: 4.
  	self deny: (oc beginsWith: prefix).!

Item was changed:
+ ----- Method: SequenceableCollectionTest>>testBeginsWithAnyOf (in category 'tests - testing') -----
- ----- Method: SequenceableCollectionTest>>testBeginsWithAnyOf (in category 'testing - testing') -----
  testBeginsWithAnyOf
  	"We can't test SequenceableCollection directly. However, we can test a sampling of its descendants."
  
  	| la oc |
  	la := #(1 2 3 4 5 6).
  	oc := OrderedCollection new.
  	oc add: 1; add: 2; add: 3.
  
  	self assert: (la beginsWithAnyOf: #((17) (1) (42))).
  	self assert: (la beginsWithAnyOf: #((17) (1 2) (42))).
  	self assert: (la beginsWithAnyOf: #((17) (1 2 3) (42))).
  	self deny: (la beginsWithAnyOf: #()).
  	self deny: (la beginsWithAnyOf: #(())).
  	self deny: (la beginsWithAnyOf: #((42))).
  !

Item was changed:
+ ----- Method: SequenceableCollectionTest>>testEndsWith (in category 'tests - testing') -----
- ----- Method: SequenceableCollectionTest>>testEndsWith (in category 'testing - testing') -----
  testEndsWith
  	"We can't test SequenceableCollection directly. However, we can test a sampling of its descendants."
  
  	| la oc suffix |
  	la := #(1 2 3 4 5 6).
  	oc := OrderedCollection new.
  	oc add: 4; add: 5; add: 6.
  	
  	self assert: (la endsWith: #(6)).
  	self assert: (la endsWith: #(5 6)).
  	self assert: (la endsWith: #(4 5 6)).
  	self assert: (la endsWith: oc).
  	self deny: (la endsWith: #()).
  	self deny: (la endsWith: '').
  	
  	suffix := OrderedCollection new.
  	suffix add: 6.
  	self assert: (oc endsWith: suffix).
  	suffix addFirst: 5.
  	self assert: (oc endsWith: suffix).
  	suffix addFirst: 4.
  	self assert: (oc endsWith: suffix).
  	suffix addFirst: 3.
  	self deny: (oc endsWith: suffix).!

Item was changed:
+ ----- Method: SequenceableCollectionTest>>testEndsWithAnyOf (in category 'tests - testing') -----
- ----- Method: SequenceableCollectionTest>>testEndsWithAnyOf (in category 'testing - testing') -----
  testEndsWithAnyOf
  	"We can't test SequenceableCollection directly. However, we can test a sampling of its descendants."
  
  	| la oc |
  	la := #(6 5 4 3 2 1).
  	oc := OrderedCollection new.
  	oc add: 3; add: 2; add: 1.
  
  	self assert: (la endsWithAnyOf: #((17) (1) (42))).
  	self assert: (la endsWithAnyOf: #((17) (2 1) (42))).
  	self assert: (la endsWithAnyOf: #((17) (3 2 1) (42))).
  	self deny: (la endsWithAnyOf: #()).
  	self deny: (la endsWithAnyOf: #(())).
  	self deny: (la endsWithAnyOf: #((42))).
  !

Item was changed:
+ ----- Method: SequenceableCollectionTest>>testReplaceFromToWithStartingAt (in category 'tests - accessing') -----
- ----- Method: SequenceableCollectionTest>>testReplaceFromToWithStartingAt (in category 'testing') -----
  testReplaceFromToWithStartingAt
  	| string |
  
  	string := 'abcd' copy.
  	string replaceFrom: 1 to: 3 with: 'lmnop' startingAt: 1.
  	self assert: string = 'lmnd'.
  	
  	string := 'abcd' copy.
  	string replaceFrom: 1 to: 3 with: 'lmnop' startingAt: 2.
  	self assert: string = 'mnod'.
  	
  	string := 'abcd' copy.
  	string replaceFrom: 2 to: 3 with: 'lmnop' startingAt: 1.
  	self assert: string = 'almd'.!




More information about the Squeak-dev mailing list