Levente Uzonyi uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-ul.165.mcz==================== Summary ====================
Name: CollectionsTests-ul.165
Author: ul
Time: 12 June 2010, 9:20:39.481 pm
UUID: 046873df-ac6a-e249-a30e-0bc7cff04542
Ancestors: CollectionsTests-nice.164
- added a test for a current bug of WeakKeyDictionary >> #finalizeValues. Since CollectionsTests is already a mess I didn't create a new class, but added the test to WeakIdentityKeyDictionaryTest.
=============== Diff against CollectionsTests-nice.164 ===============
Item was added:
+ ----- Method: WeakIdentityKeyDictionaryTest>>testFinalizeValuesWhenLastChainContinuesAtFront (in category 'tests') -----
+ testFinalizeValuesWhenLastChainContinuesAtFront
+
+ | objectWithHashModulo dictionary capacity a b c |
+ objectWithHashModulo := [ :requestedHash :modulo |
+ | object |
+ [
+ object := Object new.
+ object hash \\ modulo = requestedHash ] whileFalse.
+ object ].
+ dictionary := self classToBeTested new.
+ capacity := dictionary capacity.
+ a := objectWithHashModulo value: capacity - 2 value: capacity.
+ dictionary at: a put: 1.
+ b := objectWithHashModulo value: capacity - 1 value: capacity.
+ dictionary at: b put: 2.
+ c := objectWithHashModulo value: capacity - 2 value: capacity.
+ dictionary at: c put: 3.
+ self assert: dictionary capacity = capacity.
+ self assert: (dictionary array at: capacity - 1) key == a.
+ self assert: (dictionary array at: capacity) key == b.
+ self assert: (dictionary array at: 1) key == c.
+ a := nil.
+ Smalltalk garbageCollect.
+ dictionary finalizeValues.
+ self assert: (dictionary includesKey: b).
+ self assert: (dictionary includesKey: c).
+ self assert: dictionary slowSize = 2.
+ !
Item was added:
+ ----- Method: WeakIdentityKeyDictionaryTest>>classToBeTested (in category 'coverage') -----
+ classToBeTested
+
+ ^WeakIdentityKeyDictionary!