[squeak-dev] The Trunk: KernelTests-eem.390.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jan 1 19:24:55 UTC 2021


Eliot Miranda uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-eem.390.mcz

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

Name: KernelTests-eem.390
Author: eem
Time: 1 January 2021, 11:24:53.814816 am
UUID: 82abce52-6291-4621-8946-3575c4f4f9c3
Ancestors: KernelTests-ct.389

Add a test to check Float's constants.  Add a utility (e.g for package prologs) to answer whether the test passes.  At least in my image Float fmax had become NaN.

=============== Diff against KernelTests-ct.389 ===============

Item was added:
+ ----- Method: FloatTest class>>testClassConstantsPasses (in category 'utilities') -----
+ testClassConstantsPasses
+ 	"Answer if testClassConstants passes. This can be used in e.g. the Kernel Package prolog
+ 	 to test if Float initialize needs to be run."
+ 	[self new testClassConstants]
+ 		on: TestResult failure
+ 		do: [:ex| ^false].
+ 	^true!

Item was added:
+ ----- Method: FloatTest>>testClassConstants (in category 'tests - characterization') -----
+ testClassConstants
+ 
+ 	"Test all the class constants that are floats to check that they are valid.
+ 	 Sometimes compiler bugs mean that the initialization method is incorrect, etc"
+ 	| expectedVariables unexpectedVariables "these two are for determining if this test is correct, not its results"
+ 	  finiteVariables infiniteVariables nanVariables |
+ 	finiteVariables := #(Pi Halfpi Twopi ThreePi RadiansPerDegree Ln2 Ln10 Sqrt2 E Epsilon MaxVal MaxValLn NegativeZero).
+ 	infiniteVariables := #(Infinity NegativeInfinity).
+ 	nanVariables := #(NaN).
+ 	expectedVariables := Set new.
+ 	unexpectedVariables := Set new.
+ 	Float classPool keysAndValuesDo:
+ 		[:name :value|
+ 		value isFloat
+ 			ifTrue:
+ 				[(finiteVariables includes: name) ifTrue:
+ 					[expectedVariables add: name.
+ 					 self assert: value isFinite.
+ 					 self deny: value isInfinite.
+ 					 self deny: value isNaN].
+ 				(infiniteVariables includes: name) ifTrue:
+ 					[expectedVariables add: name.
+ 					 self deny: value isFinite.
+ 					 self assert: value isInfinite.
+ 					 self deny: value isNaN].
+ 				(nanVariables includes: name) ifTrue:
+ 					[expectedVariables add: name.
+ 					 self deny: value isFinite.
+ 					 self deny: value isInfinite.
+ 					 self assert: value isNaN].
+ 				(expectedVariables includes: name) ifFalse:
+ 					[unexpectedVariables add: name]]
+ 			ifFalse:
+ 				[self deny: ((finiteVariables includes: name) or: [(infiniteVariables includes: name) or: [nanVariables includes: name]])]]!



More information about the Squeak-dev mailing list