The Trunk: WebClient-Tests-nice.59.mcz

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

The Trunk: WebClient-Tests-nice.59.mcz

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

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

Name: WebClient-Tests-nice.59
Author: nice
Time: 12 September 2019, 1:01:51.119792 am
UUID: 1b6684ed-38ab-4d9c-a205-2162efb06eac
Ancestors: WebClient-Tests-pre.58

More thorough tests for json number decoding

This might uncover some serious bugs until WebClient-core-nice.119 (signed exponents or exponent = 1)

Also assert correct rounding to nearest Float for crafted examples. This is the least expectation nowadays.

=============== Diff against WebClient-Tests-pre.58 ===============

Item was added:
+ ----- Method: WebClientServerTest>>assert:classAndValueEquals: (in category 'private') -----
+ assert: a classAndValueEquals: b
+ self assert: a equals: b.
+ self assert: a class equals: b class.!

Item was changed:
  ----- Method: WebClientServerTest>>testNumbers (in category 'tests - json') -----
  testNumbers
  "Test the encodings of numbers"
 
+ self assert: 42 classAndValueEquals: (self decode: '42').
+ self assert: -123 classAndValueEquals: (self decode: '-0123').
+ self assert: 42.3 classAndValueEquals: (self decode: '42.3').
+ self assert: -42.9e44 classAndValueEquals: (self decode: '-42.9e44').
+ self assert: -42.95e-44 classAndValueEquals: (self decode: '-42.95e-44').
+ self assert: -0.0 classAndValueEquals: (self decode: '-0.0e0').
+
+ self assert: 1.0 classAndValueEquals: (self decode: '1.').
+ self assert: 100.0 classAndValueEquals: (self decode: '1.e+2').
+ self assert: 1000 classAndValueEquals: (self decode: '1e3'). "This remains an Integer like in Squeak, though questionable"
+ self assert: 0.01 classAndValueEquals: (self decode: '1e-2').
- self assert: 42 equals: (self decode: '42').
- self assert: -123 equals: (self decode: '-0123').
- self assert: 42.3 equals: (self decode: '42.3').
- self assert: -42.3e44 equals: (self decode: '-42.3e44').
- self assert: -0.0 equals: (self decode: '-0.0e0').
 
  self assert: '42' equals: (self encode: 42).
  self assert: '-123' equals: (self encode: -123).
  self assert: '42.3' equals: (self encode: 42.3).
+ self assert: '-4.29e45' equals: (self encode: -42.9e44).
+ self assert: '-4.295e-43' equals: (self encode: -42.95e-44).
- self assert: '-4.23e45' equals: (self encode: -42.3e44).
  self assert: '-0.0' equals: (self encode: -0.0e0).
 
  self should: [self decode: '0x123'] raise: Error.
  self should: [self decode: '-.e'] raise: Error.
  !