mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
* fix printing negative zero in JS backend * move tests
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
discard """
|
||||
targets: "c cpp js"
|
||||
"""
|
||||
|
||||
proc main()=
|
||||
block:
|
||||
let a = -0.0
|
||||
doAssert $a == "-0.0"
|
||||
doAssert $(-0.0) == "-0.0"
|
||||
|
||||
block:
|
||||
let a = 0.0
|
||||
when nimvm: discard ## TODO VM print wrong -0.0
|
||||
else:
|
||||
doAssert $a == "0.0"
|
||||
doAssert $(0.0) == "0.0"
|
||||
|
||||
block:
|
||||
let b = -0
|
||||
doAssert $b == "0"
|
||||
doAssert $(-0) == "0"
|
||||
|
||||
block:
|
||||
let b = 0
|
||||
doAssert $b == "0"
|
||||
doAssert $(0) == "0"
|
||||
|
||||
|
||||
static: main()
|
||||
main()
|
||||
@@ -77,3 +77,29 @@ block: # #14350 for JS
|
||||
doAssert cstr == nil
|
||||
doAssert cstr.isNil
|
||||
doAssert cstr != cstring("")
|
||||
|
||||
|
||||
proc main()=
|
||||
block:
|
||||
let a = -0.0
|
||||
doAssert $a == "-0.0"
|
||||
doAssert $(-0.0) == "-0.0"
|
||||
|
||||
block:
|
||||
let a = 0.0
|
||||
doAssert $a == "0.0"
|
||||
doAssert $(0.0) == "0.0"
|
||||
|
||||
block:
|
||||
let b = -0
|
||||
doAssert $b == "0"
|
||||
doAssert $(-0) == "0"
|
||||
|
||||
block:
|
||||
let b = 0
|
||||
doAssert $b == "0"
|
||||
doAssert $(0) == "0"
|
||||
|
||||
|
||||
static: main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user