The Trunk: CollectionsTests-ar.162.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-ar.162.mcz

commits-2
Andreas Raab uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-ar.162.mcz

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

Name: CollectionsTests-ar.162
Author: ar
Time: 4 May 2010, 8:55:11.194 am
UUID: bcb3bfc7-296f-9949-be07-34c766d8b3c5
Ancestors: CollectionsTests-ul.161

Add test for #reduce:

=============== Diff against CollectionsTests-ul.161 ===============

Item was added:
+ ----- Method: CollectionTest>>testReduce (in category 'tests') -----
+ testReduce
+ "self run: #testReduce"
+
+ | array set bag |
+ array := Array with: 1 with: 2 with: 3.
+ self assert: (array reduce:[:a :b| a + b]) = 6.
+ set := array asSet.
+ self assert: (set reduce:[:a :b| a + b]) = 6.
+
+ array := Array with: Color red with: Color green with: Color blue.
+ self assert: (array reduce:[:a :b| a + b]) = Color white.
+ set := array asSet.
+ self assert: (set reduce:[:a :b| a + b]) = Color white.
+
+ array := Array with: 1 with: 1 with: 1.
+ self assert: (array reduce:[:a :b| a + b]) = 3.
+ bag := array asBag.
+ self assert: (bag reduce:[:a :b| a + b]) = 3.
+ !