[squeak-dev] The Trunk: KernelTests-nice.209.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Nov 2 19:12:36 UTC 2011


Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.209.mcz

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

Name: KernelTests-nice.209
Author: nice
Time: 2 November 2011, 8:12:16.968 pm
UUID: 91e9e8ee-ff2b-4cce-8df3-ff2d1ade58ea
Ancestors: KernelTests-nice.208

Restore the intention of testNaN2 which is to test both = and == (there can be several instances of NaN)
Complete the ScaledDecimalTest (from Pharo) and correct intention (test absolute value of difference).

=============== Diff against KernelTests-nice.208 ===============

Item was changed:
  ----- Method: FloatTest>>testNaN2 (in category 'NaN behavior') -----
  testNaN2
  	"Two NaN values are always considered to be different.
  	On an little-endian machine (32 bit Intel), Float nan is 16rFFF80000 16r00000000.
  	On a big-endian machine (PowerPC), Float nan is 16r7FF80000 16r00000000. Changing
  	the bit pattern of the first word of a NaN produces another value that is still
  	considered equal to NaN. This test should work on both little endian and big
  	endian machines. However, it is not guaranteed to work on future 64 bit versions
  	of Squeak, for which Float may have different internal representations."
  
  	"FloatTest new testNaN2"
  
  	| nan1 nan2 |
  	nan1 := Float nan copy.
  	nan2 := Float nan copy.
  
  	"test two instances of NaN with the same bit pattern"
  	self deny: nan1 = nan2.
+ 	self deny: nan1 == nan2.
- 	self deny: nan1 = nan2.
  	self deny: nan1 = nan1.
  	self assert: nan1 == nan1.
  
  	"change the bit pattern of nan1"
  	self assert: nan1 size = 2.
  	self assert: (nan1 at: 2) = 0.
  	nan1 at: 1 put: (nan1 at: 1) + 999.
  	self assert: nan1 isNaN.
  	self assert: nan2 isNaN.
  	self deny: (nan1 at: 1) = (nan2 at: 1).
  
  	"test two instances of NaN with different bit patterns"
  	self deny: nan1 = nan2.
+ 	self deny: nan1 == nan2.
- 	self deny: nan1 = nan2.
  	self deny: nan1 = nan1.
  	self assert: nan1 == nan1
  !

Item was changed:
  ----- Method: ScaledDecimalTest>>testConvertFromFloat (in category 'tests') -----
  testConvertFromFloat
  
  	| aFloat sd f2 diff |
  	aFloat := 11/13 asFloat.
  	sd := aFloat asScaledDecimal: 2.
  	self assert: 2 = sd scale.
  	self assert: '0.84s2' = sd printString.
+ 	self assert: '-0.84s2' = sd negated printString.
  	f2 := sd asFloat.
  	diff := f2 - aFloat.
+ 	self assert: diff abs < 1.0e-9. "actually, f = f2, but this is not a requirement"
- 	self assert: diff < 1.0e-9. "actually, f = f2, but this is not a requirement"
  !

Item was changed:
  ----- Method: ScaledDecimalTest>>testConvertFromFractionWithScale (in category 'tests') -----
  testConvertFromFractionWithScale
  
  	| sd |
  	sd := (13 / 11) asScaledDecimal: 6.
  	self assert: ScaledDecimal == sd class.
  	self assert: ('1.181818s6' = sd printString).
+ 	self assert: 6 = sd scale.
+ 	sd := (-13 / 11) asScaledDecimal: 6.
+ 	self assert: ScaledDecimal == sd class.
+ 	self assert: ('-1.181818s6' = sd printString).
  	self assert: 6 = sd scale
  !




More information about the Squeak-dev mailing list