[squeak-dev] The Trunk: CollectionsTests-ar.120.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Nov 25 05:49:27 UTC 2009


Andreas Raab uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-ar.120.mcz

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

Name: CollectionsTests-ar.120
Author: ar
Time: 24 November 2009, 9:49:18 am
UUID: 71e8d97b-5b4a-734a-8d8f-4efe5edd211a
Ancestors: CollectionsTests-ul.118, CollectionsTests-ul.119

Merging CollectionsTests-ul.119:

- new test for HashedCollection sizing

=============== Diff against CollectionsTests-ul.118 ===============

Item was added:
+ ----- Method: HashedCollectionTest>>testGoodPrimeAtLeast (in category 'test - class - sizing') -----
+ testGoodPrimeAtLeast
+ 
+ 	| primes |
+ 	primes := HashedCollection goodPrimes.
+ 	primes do: [ :each |
+ 		self assert: (HashedCollection goodPrimeAtLeast: each) = each.
+ 		self assert: (HashedCollection goodPrimeAtLeast: each - 1) = each.
+ 		self assert: (HashedCollection goodPrimeAtLeast: each + 1) > each ].
+ 	(0 to: 1000) do: [ :each |
+ 		| goodPrime |
+ 		goodPrime := HashedCollection goodPrimeAtLeast: each.
+ 		self assert: goodPrime isPrime.
+ 		self assert: goodPrime >= each.
+ 		self assert: (primes detect: [ :ea | ea >= each ] ifNone: [ each + 1 ]) = goodPrime ].
+ 	self assert: (HashedCollection goodPrimeAtLeast: primes last + 1) odd!

Item was added:
+ TestCase subclass: #HashedCollectionTest
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'CollectionsTests-Abstract'!

Item was added:
+ ----- Method: HashedCollectionTest>>testGoodPrimes (in category 'test - class - sizing') -----
+ testGoodPrimes
+ 
+ 	| 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.!

Item was added:
+ ----- Method: HashedCollectionTest>>testSizeFor (in category 'test - class - sizing') -----
+ testSizeFor
+ 
+ 	#(
+ 		0 1 5 10 30 57 89 578 1234 1912 2411 2591 5627 7849
+ 		10999 61356 68602 73189 79868 86789 239984 239985 501175 661865 841558
+ 		9669391 15207345 19827345 23469817 27858432 65223175 106650047
+ 		157687845 190892299 234947087 264782114 269617510 270995400 
+ 		392236508 456647275 468699153 606865011 606997796 617927086
+ 		837938371 880614337 989233852 1000473294 1060034095) do: [ :each |
+ 			| size |
+ 			size := HashedCollection sizeFor: each.
+ 			size <= HashedCollection goodPrimes last ifTrue: [
+ 				self assert: size isPrime ].
+ 			self assert: size odd.
+ 			self assert: size * 3 // 4 >= each ]!




More information about the Squeak-dev mailing list