[squeak-dev] The Trunk: CollectionsTests-topa.230.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jan 16 07:49:02 UTC 2015


Tobias Pape uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-topa.230.mcz

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

Name: CollectionsTests-topa.230
Author: topa
Time: 16 January 2015, 8:48:49.694 am
UUID: b39de6a2-93e5-4c2b-b2d5-6f0b5cf26e8e
Ancestors: CollectionsTests-mt.229

Add description to #flatten test.
Add #flattened test (Collections-topa.594)

=============== Diff against CollectionsTests-mt.229 ===============

Item was changed:
  ----- Method: SequenceableCollectionTest>>testFlatten (in category 'tests - converting') -----
  testFlatten
  
+ 	self
+ 		assert: {3 .4 .2 .4 .'hi' .'ho'}
+ 		equals: {3 .4 .{2 .4 .{'hi'} .'ho'}} flatten
+ 		description: '#flatten should deeply inline all collection-like elements'.
+ 	self
+ 		assert: #( (1 2) (3 4) ) concatenation
+ 		equals: #( (1 2) (3 4) ) flatten
+ 		description: '#flatten of one-level collection-nesting should be the same as its concatenation'.
+ !
- 	self assert: {3 .4 .{2 .4 .{'hi'} .'ho'}} flatten = {3 .4 .2 .4 .'hi' .'ho'}.
- 	self assert: #( (1 2) (3 4) ) flatten = #( (1 2) (3 4) ) concatenation.!

Item was added:
+ ----- Method: SequenceableCollectionTest>>testFlattened (in category 'tests - converting') -----
+ testFlattened
+ 
+ 	| randomCollection |
+ 	self
+ 		assert: {3 .4 .2 .4 .'hi' .'ho'}
+ 		equals: {3 .4 .{2 .4 .{'hi'} .'ho'}} flattened
+ 		description: '#flattened should deeply inline all collection-like elements'.
+ 	self
+ 		assert: #( (1 2) (3 4) ) concatenation
+ 		equals: #( (1 2) (3 4) ) flattened
+ 		description: '#flattened of one-level collection-nesting should be the same as its concatenation'.
+ 	
+ 	" ensure that #flatten and #flattened are compatible "
+ 	randomCollection := OrderedCollection new: 10.
+ 	10 timesRepeat: [randomCollection add: 50 atRandom].
+ 	
+ 	self
+ 		assert: randomCollection flatten
+ 		equals: randomCollection flattened
+ 		description: '#flatten and #flattened should be exchangeable'
+ 	!



More information about the Squeak-dev mailing list