[Pkg] The Trunk: KernelTests-ul.351.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Oct 24 21:08:59 UTC 2018


Levente Uzonyi uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ul.351.mcz

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

Name: KernelTests-ul.351
Author: ul
Time: 24 October 2018, 11:07:17.060553 pm
UUID: a1fcd460-09b2-46a3-8ea4-4700121ead86
Ancestors: KernelTests-pre.350

- more thorough #testIsPrime

=============== Diff against KernelTests-pre.350 ===============

Item was changed:
  ----- Method: IntegerTest>>testIsPrime (in category 'tests - basic') -----
  testIsPrime
  
+ 	| i |
  	"Not primes:"
+ 	#(-1000000000000000 -100 -5 -3 -2 -1 0 1) do: [ :each |
- 	#(-100 -5 -3 -2 -1 0 1) do: [ :each |
  		self deny: each isPrime ].
  
+ 	"Check all non-negative integers up to one million."
+ 	i := 0.
+ 	Integer primesUpTo: 1000000 do: [ :prime |
+ 		[ i < prime ] whileTrue: [
+ 			self deny: i isPrime.
+ 			i := i + 1 ].
+ 		self assert: i isPrime.
+ 		i := i + 1 ].
+ 	[ i <= 1000000 ] whileTrue: [
+ 		self deny: i isPrime.
+ 		i := i + 1 ].
+ 
  	"The following tests should return 'true'"
  	#(17 78901 104729 15485863 2038074743) do: [ :each |
  		self assert: each isPrime ].
  	
+ 	"The following tests should return 'false' (first 5 are Carmichael numbers)"
- 	"The following tests should return 'false' (first 5 are Carmichael integers)"
  	#(561 2821 6601 10585 15841 256 29996224275831) do: [ :each |
+ 		self deny: each isPrime ].
+ 	!
- 		self deny: each isPrime ].!



More information about the Packages mailing list