The Trunk: CollectionsTests-ul.294.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-ul.294.mcz

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

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

Name: CollectionsTests-ul.294
Author: ul
Time: 22 October 2018, 9:29:02.258936 pm
UUID: 2f84992c-436c-49cc-98c4-52ce173dabed
Ancestors: CollectionsTests-dtl.293

- added a test for KeyedSet >> #put:

=============== Diff against CollectionsTests-dtl.293 ===============

Item was added:
+ ----- Method: KeyedSetTest>>testPut (in category 'tests') -----
+ testPut
+
+ | set result |
+ set := KeyedSet keyBlock: [ :each | each ifNil: [ 1 ] ifNotNil: [ each first ] ].
+ 1 to: 10 do: [ :each | set add: { each. each asString } ].
+ self assert: 10 equals: set size.
+
+ 1 to: 10 do: [ :each |
+ | original |
+ original := set at: each.
+ result := set put: { each. each asString }.
+ self assert: 10 equals: set size.
+ self assert: { each. each asString } equals: result enclosedSetElement.
+ self assert: original == result.
+ self deny: original == (set at: each).
+ self assert: original equals: (set at: each).
+ self assert:  { each. each asString } equals: (set at: each) ].
+
+ result := set put: { 11. '11' }.
+ self assert: nil equals: result.
+ self assert: 11 equals: set size.
+ self assert: { 11. '11' } equals: (set at: 11).
+
+ result := set put: { 11. '12' }.
+ self assert: { 11. '11' } equals: result enclosedSetElement.
+ self assert: 11 equals: set size.
+ self assert: { 11. '12' } equals: (set at: 11).
+
+ result := set put: nil.
+ self assert: { 1. '1' } equals: result enclosedSetElement.
+ self assert: 11 equals: set size.
+ self assert: nil equals: (set at: 1)!