From 9532951cfc4280d815160a4c86c7fec60d2a2001 Mon Sep 17 00:00:00 2001 From: katlogic Date: Sun, 15 Jun 2014 01:53:09 +0200 Subject: [PATCH] Tests for `$`(float) --- tests/matrix/tmatrix2.nim | 2 +- tests/showoff/tdrdobbs_examples.nim | 2 +- tests/system/tfloatToString.nim | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 tests/system/tfloatToString.nim diff --git a/tests/matrix/tmatrix2.nim b/tests/matrix/tmatrix2.nim index 442096e93a..82990f1a59 100644 --- a/tests/matrix/tmatrix2.nim +++ b/tests/matrix/tmatrix2.nim @@ -1,5 +1,5 @@ discard """ - output: "5.0000000000000000e+00" + output: "5.0" """ type diff --git a/tests/showoff/tdrdobbs_examples.nim b/tests/showoff/tdrdobbs_examples.nim index 8a39990ba5..13a685950e 100644 --- a/tests/showoff/tdrdobbs_examples.nim +++ b/tests/showoff/tdrdobbs_examples.nim @@ -1,7 +1,7 @@ discard """ output: '''108 11 -1 1936 -4.0000000000000002e-01 +0.4 true truefalse''' """ diff --git a/tests/system/tfloatToString.nim b/tests/system/tfloatToString.nim new file mode 100644 index 0000000000..bb45a91d70 --- /dev/null +++ b/tests/system/tfloatToString.nim @@ -0,0 +1,22 @@ +discard """ + output:'''2.3242 +2.982 +123912.1 +123912.1823 +5.0 +1e+100 +inf +-inf +nan +''' +""" + +echo($(2.3242)) +echo($(2.982)) +echo($(123912.1)) +echo($(123912.1823)) +echo($(5.0)) +echo($(1e100)) +echo($(1e1000000)) +echo($(-1e1000000)) +echo($(0.0/0.0))