[Pkg] The Trunk: CollectionsTestsul.160.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Apr 19 00:24:53 UTC 2010
Levente Uzonyi uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTestsul.160.mcz
==================== Summary ====================
Name: CollectionsTestsul.160
Author: ul
Time: 13 April 2010, 12:13:45.952 am
UUID: ba43ad5d8431d54ab7a289104e400e4a
Ancestors: CollectionsTestsar.159
 updated the tests for HashedCollection's table sizes
=============== Diff against CollectionsTestsar.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!
More information about the Packages
mailing list