A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-ul.160.mcz==================== Summary ====================
Name: CollectionsTests-ul.160
Author: ul
Time: 13 April 2010, 12:13:45.952 am
UUID: ba43ad5d-8431-d54a-b7a2-89104e400e4a
Ancestors: CollectionsTests-ar.159
- updated the tests for HashedCollection's table sizes
=============== Diff against CollectionsTests-ar.159 ===============
Item was changed:
----- Method: HashedCollectionTest>>testPrimes: (in category 'test - class - sizing') -----
testPrimes: primes
+ | badPrimes |
+ badPrimes := #(3 5 71 139 479 5861 277421). "These primes are less than the hashMultiply constant (1664525) and 1664525 \\ prime is close to 0 (mod prime). The following snippet reproduces these numbers:
+ | hashMultiplyConstant |
+ hashMultiplyConstant := 1 hashMultiply.
+ (Integer primesUpTo: hashMultiplyConstant) select: [ :each |
+ | remainder |
+ remainder := hashMultiplyConstant \\ each.
+ remainder <= 1 or: [ remainder + 1 = each ] ]."
self assert: primes isSorted.
+ primes do: [ :each |
+ self assert: each isPrime.
+ self deny: (each > 2069 and: [ badPrimes includes: each ]) ].
- primes do: [ :each | self assert: each isPrime ].
self assert: (
primes select: [ :p |
| result |
result := false.
p > 2069 ifTrue: [
1 to: 8 do: [ :k |
1 to: 32 do: [ :a |
(p gcd: (256 raisedTo: k) + a) = 1 ifFalse: [
result := true ].
(p gcd: (256 raisedTo: k) - a) = 1 ifFalse: [
result := true ] ] ] ].
result ]) isEmpty.!
Item was removed:
- ----- Method: HashedCollectionTest>>testGoodPrimesForIdentityBasedHashedCollections (in category 'test - class - sizing') -----
- testGoodPrimesForIdentityBasedHashedCollections
-
- self testPrimes: HashedCollection goodPrimesForIdentityBasedHashedCollections!