[squeakdev] The Trunk: KernelTestsnice.140.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Feb 23 14:19:17 UTC 2010
Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTestsnice.140.mcz
==================== Summary ====================
Name: KernelTestsnice.140
Author: nice
Time: 23 February 2010, 3:19:21.227 pm
UUID: da1c4e8f3fcb5440a09a7662b1b2ef58
Ancestors: KernelTestsdtl.139
Change the expectations to reflect current implementation:
1) '1.0e+14' asNumber > 1.0e14
2) '123.' asNumber > 123.0
=============== Diff against KernelTestsdtl.139 ===============
Item was changed:
 Method: IntegerTest>>testReadFrom (in category 'tests  instance creation') 
testReadFrom
"Ensure remaining characters in a stream are not lost when parsing an integer."
 rs i s 
rs := ReadStream on: '123s could be confused with a ScaledDecimal'.
i := Number readFrom: rs.
self assert: i == 123.
s := rs upToEnd.
self assert: 's could be confused with a ScaledDecimal' = s.
+
rs := ReadStream on: '123.s could be confused with a ScaledDecimal'.
i := Number readFrom: rs.
+ self assert: i = 123.0.
 self assert: i == 123.
s := rs upToEnd.
+ self assert: 's could be confused with a ScaledDecimal' = s
 self assert: '.s could be confused with a ScaledDecimal' = s
!
Item was changed:
 Method: NumberParsingTest>>testFloatFromStringWithExponent (in category 'tests  Float') 
testFloatFromStringWithExponent
"This covers parsing in Number>>readFrom:"
 aFloat 
aFloat := '1.0e14' asNumber.
self assert: 1.0e14 = aFloat.
aFloat := '1.0e14 1' asNumber.
self assert: 1.0e14 = aFloat.
aFloat := '1.0e14e' asNumber.
self assert: 1.0e14 = aFloat.
aFloat := '1.0e14e' asNumber.
self assert: 1.0e14 = aFloat.
+ aFloat := '1.0e+14e' asNumber. "Plus sign is parseable too"
+ self assert: 1.0e14 = aFloat.
 aFloat := '1.0e+14e' asNumber. "Plus sign is not parseable"
 self assert: 1.0 = aFloat.
!
Item was changed:
 Method: IntegerTest>>testStringAsNumber (in category 'tests  instance creation') 
testStringAsNumber
"This covers parsing in Number>>readFrom:
Trailing decimal points should be ignored."
self assert: ('123' asNumber == 123).
self assert: ('123' asNumber == 123).
+ self assert: ('123.' asNumber = 123).
+ self assert: ('123.' asNumber) isFloat.
+ self assert: ('123.' asNumber = 123).
+ self assert: ('123.' asNumber) isFloat.
 self assert: ('123.' asNumber == 123).
 self assert: ('123.' asNumber == 123).
self assert: ('123This is not to be read' asNumber == 123).
self assert: ('123s could be confused with a ScaledDecimal' asNumber == 123).
self assert: ('123e could be confused with a Float' asNumber == 123).
!
Item was changed:
 Method: NumberParsingTest>>testIntegerReadFrom (in category 'tests  Integer') 
testIntegerReadFrom
"Ensure remaining characters in a stream are not lost when parsing an integer."
 rs i s 
rs := ReadStream on: '123s could be confused with a ScaledDecimal'.
i := Number readFrom: rs.
self assert: i == 123.
s := rs upToEnd.
self assert: 's could be confused with a ScaledDecimal' = s.
rs := ReadStream on: '123.s could be confused with a ScaledDecimal'.
i := Number readFrom: rs.
+ self assert: i = 123.
 self assert: i == 123.
s := rs upToEnd.
+ self assert: 's could be confused with a ScaledDecimal' = s.
 self assert: '.s could be confused with a ScaledDecimal' = s.
rs := ReadStream on: '123sA has unary message sA'.
i := Number readFrom: rs.
self assert: i == 123.
s := rs upToEnd.
self assert: 'sA has unary message sA' = s.
rs := ReadStream on: '123sB has unary message sB'.
i := Number readFrom: rs.
self assert: i == 123.
s := rs upToEnd.
self assert: 'sB has unary message sB' = s.
!
Item was changed:
 Method: NumberParsingTest>>testIntegerFromString (in category 'tests  Integer') 
testIntegerFromString
"This covers parsing in Number>>readFrom:
Trailing decimal points should be ignored."
self assert: ('123' asNumber == 123).
self assert: ('123' asNumber == 123).
+ self assert: ('123.' asNumber = 123).
+ self assert: ('123.' asNumber) isFloat.
+ self assert: ('123.' asNumber = 123).
+ self assert: ('123.' asNumber) isFloat.
 self assert: ('123.' asNumber == 123).
 self assert: ('123.' asNumber == 123).
self assert: ('123This is not to be read' asNumber == 123).
self assert: ('123s could be confused with a ScaledDecimal' asNumber == 123).
self assert: ('123e could be confused with a Float' asNumber == 123).
!
Item was changed:
 Method: NumberParsingTest>>testFloatFromStreamWithExponent (in category 'tests  Float') 
testFloatFromStreamWithExponent
"This covers parsing in Number>>readFrom:"
 rs aFloat 
rs := '1.0e14' readStream.
aFloat := Number readFrom: rs.
self assert: 1.0e14 = aFloat.
self assert: rs atEnd.
rs := '1.0e14 1' readStream.
aFloat := Number readFrom: rs.
self assert: 1.0e14 = aFloat.
self assert: rs upToEnd = ' 1'.
rs := '1.0e14eee' readStream.
aFloat := Number readFrom: rs.
self assert: 1.0e14 = aFloat.
self assert: rs upToEnd = 'eee'.
rs := '1.0e14e10' readStream.
aFloat := Number readFrom: rs.
self assert: 1.0e14 = aFloat.
self assert: rs upToEnd = 'e10'.
+ rs := '1.0e+14e' readStream. "Plus sign is parseable too"
 rs := '1.0e+14e' readStream. "Plus sign is not parseable"
aFloat := Number readFrom: rs.
+ self assert: 1.0e14 = aFloat.
+ self assert: rs upToEnd = 'e'.
 self assert: 1.0 = aFloat.
 self assert: rs upToEnd = 'e+14e'.
rs := '1.0e' readStream.
aFloat := Number readFrom: rs.
self assert: 1.0 = aFloat.
self assert: rs upToEnd = 'e'.!
More information about the Squeakdev
mailing list
