The Trunk: CollectionsTests-mt.260.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-mt.260.mcz

commits-2
Marcel Taeumel uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-mt.260.mcz

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

Name: CollectionsTests-mt.260
Author: mt
Time: 12 April 2016, 11:25:28.083799 am
UUID: 82d502c8-eb72-5a43-989f-f49c08225575
Ancestors: CollectionsTests-mt.259

Tests for latest stream additions.

=============== Diff against CollectionsTests-mt.259 ===============

Item was added:
+ ----- Method: ReadStreamTest>>testCollect (in category 'tests - enumerating') -----
+ testCollect
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4)) collect: [:num | 2 * num].
+ self
+ assert: (stream next: 4) asArray = #(2 4 6 8);
+ assert: stream atEnd;
+ assert: stream next isNil.!

Item was added:
+ ----- Method: ReadStreamTest>>testCollectInfinitely (in category 'tests - enumerating - infinitely') -----
+ testCollectInfinitely
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4)) collectInfinitely: [:num | 2 * num].
+ self
+ assert: stream upToNil asArray = #(2 4 6 8);
+ deny: stream atEnd;
+ assert: stream next isNil.!

Item was added:
+ ----- Method: ReadStreamTest>>testGather (in category 'tests - enumerating') -----
+ testGather
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4)) gather: [:num | 1 to: num].
+ self assert: stream upToEnd asArray = #(1 1 2 1 2 3 1 2 3 4).!

Item was added:
+ ----- Method: ReadStreamTest>>testGatherInfinitely (in category 'tests - enumerating - infinitely') -----
+ testGatherInfinitely
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4)) gatherInfinitely: [:num | 1 to: num].
+ self
+ assert: stream upToNil asArray = #(1 1 2 1 2 3 1 2 3 4);
+ deny: stream atEnd;
+ assert: stream next isNil.!

Item was added:
+ ----- Method: ReadStreamTest>>testGatherInfinitely2 (in category 'tests - enumerating - infinitely') -----
+ testGatherInfinitely2
+ "Try gathering infinite streams as results."
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4)) gatherInfinitely: [:num | (self streamOn: (1 to: num)) collectInfinitely: [:ea | ea * ea]].
+ self
+ assert: stream upToNil asArray = #(1 1 4 1 4 9 1 4 9 16);
+ deny: stream atEnd;
+ assert: stream next isNil.!

Item was added:
+ ----- Method: ReadStreamTest>>testNextSatisfy (in category 'tests - accessing') -----
+ testNextSatisfy
+
+ | stream |
+ stream := self streamOn: #(1 2 3 4).
+ self assert: 2 = (stream nextSatisfy: [:ea | ea even]).
+ self assert: 4 = (stream nextSatisfy: [:ea | ea even]).
+ self should: [stream nextSatisfy: [:ea | ea even]] raise: Error.!

Item was added:
+ ----- Method: ReadStreamTest>>testReject (in category 'tests - enumerating') -----
+ testReject
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4)) reject: [:num | num even].
+ self assert: (stream next: 2) asArray = #(1 3).!

Item was added:
+ ----- Method: ReadStreamTest>>testRejectInfinitely (in category 'tests - enumerating - infinitely') -----
+ testRejectInfinitely
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4)) rejectInfinitely: [:num | num even].
+ self
+ assert: stream upToNil asArray = #(1 3);
+ deny: stream atEnd;
+ assert: stream next isNil.!

Item was added:
+ ----- Method: ReadStreamTest>>testSelect (in category 'tests - enumerating') -----
+ testSelect
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4)) select: [:num | num even].
+ self assert: (stream next: 2) asArray = #(2 4).!

Item was added:
+ ----- Method: ReadStreamTest>>testSelectCollect (in category 'tests - enumerating') -----
+ testSelectCollect
+
+ | stream |
+ stream := ((self streamOn: #(1 2 3 4))
+ select: [:num | num even])
+ collect: [:num | 2 * num].
+ self assert: (stream next: 2) asArray = #(4 8).!

Item was added:
+ ----- Method: ReadStreamTest>>testSelectInfinitely (in category 'tests - enumerating - infinitely') -----
+ testSelectInfinitely
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4)) selectInfinitely: [:num | num even].
+ self
+ assert: stream upToNil asArray = #(2 4);
+ deny: stream atEnd;
+ assert: stream next isNil.!

Item was added:
+ ----- Method: ReadStreamTest>>testSelectThenCollect (in category 'tests - enumerating') -----
+ testSelectThenCollect
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4))
+ select: [:num | num even]
+ thenCollect: [:num | 2 * num].
+ self assert: (stream next: 2) asArray = #(4 8).!

Item was added:
+ ----- Method: ReadStreamTest>>testUpToNil (in category 'tests - accessing') -----
+ testUpToNil
+
+ | stream |
+ stream := self streamOn: #(1 2 3 4).
+ self assert: stream upToNil asArray = #(1 2 3 4).
+ self assert: stream atEnd.!

Item was added:
+ ----- Method: ReadStreamTest>>testUpToNil2 (in category 'tests - accessing') -----
+ testUpToNil2
+
+ | stream |
+ stream := (self streamOn: #(1 2 3 4)) collect: [:ea | 2 * ea].
+ self assert: stream upToNil asArray = #(2 4 6 8).
+ self assert: stream atEnd.!