The Trunk: KernelTests-nice.317.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: KernelTests-nice.317.mcz

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

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

Name: KernelTests-nice.317
Author: nice
Time: 27 January 2017, 10:04:37.372536 pm
UUID: 42d2ef78-acd4-4909-aa38-c4a709f40482
Ancestors: KernelTests-eem.316

Change the expectation of -0.0 sign, it is now 0 rather than -1.
Consequently adopt the new way to test a negativeZero result using signBit rather than sign.

=============== Diff against KernelTests-eem.316 ===============

Item was added:
+ ----- Method: FloatTest>>assertIsNegativeZero: (in category 'accessing') -----
+ assertIsNegativeZero: aFloat
+ "Assert that aFloat is Float negativeZero"
+ self assert: aFloat = 0.0.
+ self assert: aFloat signBit = 1!

Item was added:
+ ----- Method: FloatTest>>assertIsPositiveZero: (in category 'accessing') -----
+ assertIsPositiveZero: aFloat
+ "Assert that aFloat is Float zero (the positive one)"
+ self assert: aFloat = 0.0.
+ self assert: aFloat signBit = 0!

Item was changed:
  ----- Method: FloatTest>>testArSinh (in category 'tests - mathematical functions') -----
  testArSinh
+ self assertIsPositiveZero: 0.0 arSinh.
+ self assertIsNegativeZero: Float negativeZero arSinh.
- self assert: 0.0 arSinh = 0.0.
- self assert: Float negativeZero arSinh = 0.0.
- self assert: Float negativeZero arSinh sign = -1.
  self deny: Float infinity arSinh isFinite.
  self assert: (0.5 arSinh negated closeTo: 0.5 negated arSinh).
  self assert: (0.5 arSinh sinh closeTo: 0.5).
  self assert: (-2.5 arSinh sinh closeTo: -2.5).!

Item was changed:
  ----- Method: FloatTest>>testArTanh (in category 'tests - mathematical functions') -----
  testArTanh
+ self assertIsPositiveZero: 0.0 arTanh.
+ self assertIsNegativeZero: Float negativeZero arTanh.
- self assert: 0.0 arTanh = 0.0.
- self assert: Float negativeZero arTanh = 0.0.
- self assert: Float negativeZero arTanh sign = -1.
  self deny: 1 arTanh isFinite.
  self assert: (0.5 arTanh negated closeTo: 0.5 negated arTanh).
  self assert: (0.5 arTanh tanh closeTo: 0.5).
  self assert: (-0.5 arTanh tanh closeTo: -0.5).!

Item was changed:
  ----- Method: FloatTest>>testCharacterization (in category 'characterization') -----
  testCharacterization
 
  "Test the largest finite representable floating point value"
  self assert: Float fmax successor = Float infinity.
  self assert: Float infinity predecessor = Float fmax.
  self assert: Float fmax negated predecessor = Float negativeInfinity.
  self assert: Float negativeInfinity successor = Float fmax negated.
 
  "Test the smallest positive representable floating point value"
  self assert: Float fmin predecessor = 0.0.
  self assert: 0.0 successor = Float fmin.
  self assert: Float fmin negated successor = 0.0.
  self assert: 0.0 predecessor = Float fmin negated.
 
  "Test the relative precision"
  self assert: Float one + Float epsilon > Float one.
  self assert: Float one + Float epsilon = Float one successor.
  self assert: Float one + (Float epsilon / Float radix) = Float one.
 
  "Test maximum and minimum exponent"
  self assert: Float fmax exponent = Float emax.
  self assert: Float fminNormalized exponent = Float emin.
  Float denormalized ifTrue: [
  self assert: Float fminDenormalized exponent = (Float emin + 1 - Float precision)].
 
  "Alternative tests for maximum and minimum"
  self assert: (Float radix - Float epsilon) * (Float radix raisedTo: Float emax) = Float fmax.
  self assert: Float epsilon * (Float radix raisedTo: Float emin) = Float fmin.
 
  "Test sucessors and predecessors"
  self assert: Float one predecessor successor = Float one.
  self assert: Float one successor predecessor = Float one.
  self assert: Float one negated predecessor successor = Float one negated.
  self assert: Float one negated successor predecessor = Float one negated.
  self assert: Float infinity successor = Float infinity.
  self assert: Float negativeInfinity predecessor = Float negativeInfinity.
+ self assertIsNegativeZero: Float fmin negated successor.
- self assert: Float fmin negated successor = 0.0.
- self assert: Float fmin negated successor sign = -1.
  self assert: Float nan predecessor isNaN.
  self assert: Float nan successor isNaN.
 
  "SPECIFIC FOR IEEE 754 double precision - 64 bits"
  self assert: Float fmax hex = '7FEFFFFFFFFFFFFF'.
  self assert: Float fminDenormalized hex = '0000000000000001'.
  self assert: Float fminNormalized hex = '0010000000000000'.
  self assert: 0.0 hex = '0000000000000000'.
  self assert: Float negativeZero hex = '8000000000000000'.
  self assert: Float one hex = '3FF0000000000000'.
  self assert: Float infinity hex = '7FF0000000000000'.
  self assert: Float negativeInfinity hex = 'FFF0000000000000'.!

Item was changed:
  ----- Method: FloatTest>>testCopySign (in category 'zero behavior') -----
  testCopySign
  self assert: (0.0 copySignTo: 1) = 1.
  self assert: (Float negativeZero copySignTo: 1) = -1.
+ self assertIsNegativeZero: (-1 copySignTo: 0.0).
+ self assertIsPositiveZero: (1 copySignTo: Float negativeZero).!
- self assert: (-1 copySignTo: 0.0) = 0.0.
- self assert: (-1 copySignTo: 0.0) sign = -1.
- self assert: (1 copySignTo: Float negativeZero) sign = 0.!

Item was changed:
  ----- Method: FloatTest>>testFractionAsFloatWithUnderflow (in category 'testing - conversion') -----
  testFractionAsFloatWithUnderflow
  "test rounding to nearest even"
 
  | underflowPower |
  underflowPower := Float emin - Float precision.
  self assert: (2 raisedTo: underflowPower) asFloat = 0.0.
  self assert: (2 raisedTo: underflowPower) negated asFloat = 0.0.
+ self assert: (2 raisedTo: underflowPower) negated asFloat signBit = 1 description: 'a negative underflow should return a negative zero'.!
- self assert: (2 raisedTo: underflowPower) negated asFloat sign = -1 description: 'a negative underflow should return a negative zero'.!

Item was changed:
  ----- Method: FloatTest>>testLiteralEqualityOfZeroAndNegativeZero (in category 'testing compare') -----
  testLiteralEqualityOfZeroAndNegativeZero
+ self assert: 1
+ equals: (Compiler evaluate: '1>2 ifTrue: [0.0] ifFalse: [-0.0]') signBit
- self assert: -1
- equals: (Compiler evaluate: '1>2 ifTrue: [0.0] ifFalse: [-0.0]') sign
  description: 'Float zero and negativeZero are not literally substituable'.!

Item was changed:
  ----- Method: FloatTest>>testNegativeZeroAbs (in category 'zero behavior') -----
  testNegativeZeroAbs
+ self assert: Float negativeZero abs signBit = 0 description: 'the absolute value of a negative zero is zero'!
- self assert: Float negativeZero abs sign positive description: 'the absolute value of a negative zero is zero'!

Item was changed:
  ----- Method: FloatTest>>testNegativeZeroSign (in category 'zero behavior') -----
  testNegativeZeroSign
+ self assert: Float negativeZero sign = 0.
+ self assert: Float negativeZero signBit = 1 "That's how we can distinguish from positive zero"!
- self assert: Float negativeZero sign = -1!

Item was changed:
  ----- Method: FloatTest>>testSign (in category 'testing') -----
  testSign
 
  "Set up"
  | negatives negz positives strictNegatives strictPositives zero |
  strictPositives := {2. 2.5. Float infinity}.
  strictNegatives := {-3. -3.25. Float negativeInfinity}.
  zero := 0.0.
  negz := Float negativeZero.
  positives := strictPositives copyWith: zero.
  negatives := strictNegatives copyWith: negz.
 
  "The sign of non zeros"
  strictPositives do: [:aPositive | self assert: aPositive sign = 1].
  strictNegatives do: [:aNegative | self assert: aNegative sign = -1].
 
  "The sign of zeros"
  self assert: zero sign = 0.
+ self assert: negz sign = 0. "remark that negz can't be distinguished from zero and is thus considered positive..."
+ self assert: negz signBit = 1. "but we can differentiate"
- self assert: negz sign = -1. "remark though that negz >= 0.0, and is thus considered positive... Weird"
 
  "Test the copy sign functions"
  positives do: [:aPositiveSign |
  positives do: [:aPositive |
  self assert: (aPositive sign: aPositiveSign) = aPositive].
  negatives do: [:aNegative |
  self assert: (aNegative sign: aPositiveSign) = aNegative negated].
+ (zero sign: aPositiveSign) signBit = 0.
+ (negz sign: aPositiveSign) signBit = 0].
- (zero sign: aPositiveSign) sign = 0.
- (negz sign: aPositiveSign) sign = 0].
 
  negatives do: [:aNegativeSign |
  positives do: [:aPositive |
  self assert: (aPositive sign: aNegativeSign) = aPositive negated].
  negatives do: [:aNegative |
  self assert: (aNegative sign: aNegativeSign) = aNegative].
+ (zero sign: aNegativeSign) signBit = 1.
+ (negz sign: aNegativeSign) signBit = 1].!
- (zero sign: aNegativeSign) sign = -1.
- (negz sign: aNegativeSign) sign = -1].!

Item was changed:
  ----- Method: FloatTest>>testSinh (in category 'tests - mathematical functions') -----
  testSinh
+ self assertIsPositiveZero: 0.0 sinh.
+ self assertIsNegativeZero: Float negativeZero sinh.
- self assert: 0.0 sinh = 0.0.
- self assert: Float negativeZero sinh = 0.0.
- self assert: Float negativeZero sinh sign = -1.
  self deny: Float infinity sinh isFinite.
  self assert: (2.0 cosh squared - 2.0 sinh squared closeTo: 1).
  self assert: (2.0 sinh negated closeTo: 2.0 negated sinh).!

Item was changed:
  ----- Method: FloatTest>>testTanh (in category 'tests - mathematical functions') -----
  testTanh
+ self assertIsPositiveZero: 0.0 tanh.
+ self assertIsNegativeZero: Float negativeZero tanh.
- self assert: 0.0 tanh = 0.0.
- self assert: Float negativeZero tanh = 0.0.
- self assert: Float negativeZero tanh sign = -1.
  self assert: (Float infinity tanh closeTo: 1).
  self assert: (2.0 cosh squared - 2.0 sinh squared closeTo: 1).
  self assert: (2.0 tanh negated closeTo: 2.0 negated tanh).!