The Trunk: CollectionsTests-topa.230.mcz

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

The Trunk: CollectionsTests-topa.230.mcz

commits-2
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'
+ !