close #13196 now that we have dragonbox (#18316)

This commit is contained in:
Timothee Cour 2021-06-21 03:51:00 -07:00 • committed by GitHub
commit d398c558a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -11,6 +11,8 @@ import std/[json,parsejson,strutils]
from std/math import isNaN
when not defined(js):
import std/streams
import stdtest/testutils
from std/fenv import epsilon
proc testRoundtrip[T](t: T, expected: string) =
# checks that `T => json => T2 => json2` is such that json2 = json
@ -325,6 +327,15 @@ block: # bug #18007
let a = parseJson($(%NaN)).to(float)
doAssert a.isNaN
whenRuntimeJs: discard # refs bug #18009
do:
testRoundtripVal(0.0): "0.0"
testRoundtripVal(-0.0): "-0.0"
block: # bug #15397, bug #13196
testRoundtripVal(1.0 + epsilon(float64)): "1.0000000000000002"
testRoundtripVal(0.12345678901234567890123456789): "0.12345678901234568"
block:
let a = "18446744073709551615"
let b = a.parseJson