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

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

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

Name: CollectionsTests-ul.157
Author: ul
Time: 19 March 2010, 2:25:07.287 pm
UUID: e17425ea-3857-2341-9c73-2acc7dd39f64
Ancestors: CollectionsTests-ar.156

- added a test for HashedCollection class >> #goodPrimesForIdentityBasedHashedCollections

=============== Diff against CollectionsTests-ar.156 ===============

Item was added:
+ ----- Method: HashedCollectionTest>>testPrimes: (in category 'test - class - sizing') -----
+ testPrimes: primes
+
+ self assert: primes isSorted.
+ 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 added:
+ ----- Method: HashedCollectionTest>>testGoodPrimesForIdentityBasedHashedCollections (in category 'test - class - sizing') -----
+ testGoodPrimesForIdentityBasedHashedCollections
+
+ self testPrimes: HashedCollection goodPrimesForIdentityBasedHashedCollections!

Item was changed:
  ----- Method: HashedCollectionTest>>testGoodPrimes (in category 'test - class - sizing') -----
  testGoodPrimes
 
+ self testPrimes: HashedCollection goodPrimes!
- | primes |
- primes := HashedCollection goodPrimes.
- self assert: primes isSorted.
- 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.!