aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/num_bif_SUITE.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2013-02-13 14:18:36 +0100
committerLukas Larsson <[email protected]>2013-02-13 14:18:36 +0100
commite55aff9434072dc9ba45b610d2e5110b0d537692 (patch)
tree621ad19e00799bd3e7bc7501f715918d3743fedc /erts/emulator/test/num_bif_SUITE.erl
parentcd08400f92ec7672025bf39a458effcf33a423dc (diff)
parent4326a0b5030c46a679de0c39dba547783f1dc0e9 (diff)
downloadotp-e55aff9434072dc9ba45b610d2e5110b0d537692.tar.gz
otp-e55aff9434072dc9ba45b610d2e5110b0d537692.tar.bz2
otp-e55aff9434072dc9ba45b610d2e5110b0d537692.zip
Merge branch 'saleyn/float_to_list_2/OTP-10837'
* saleyn/float_to_list_2/OTP-10837: Fix memory leak in error case Use macros instead of constants float_to_list/2 changed rounding and cosmetic cleanup
Diffstat (limited to 'erts/emulator/test/num_bif_SUITE.erl')
-rw-r--r--erts/emulator/test/num_bif_SUITE.erl22
1 files changed, 19 insertions, 3 deletions
diff --git a/erts/emulator/test/num_bif_SUITE.erl b/erts/emulator/test/num_bif_SUITE.erl
index bf33c337ee..c625e655ce 100644
--- a/erts/emulator/test/num_bif_SUITE.erl
+++ b/erts/emulator/test/num_bif_SUITE.erl
@@ -128,10 +128,17 @@ t_float_to_list(Config) when is_list(Config) ->
"-1.00000000000000000000e+00" = float_to_list(-1.0, []),
"-1.00000000000000000000" = float_to_list(-1.0, [{decimals, 20}]),
{'EXIT', {badarg, _}} = (catch float_to_list(1.0, [{decimals, -1}])),
- {'EXIT', {badarg, _}} = (catch float_to_list(1.0, [{decimals, 250}])),
+ {'EXIT', {badarg, _}} = (catch float_to_list(1.0, [{decimals, 254}])),
+ {'EXIT', {badarg, _}} = (catch float_to_list(1.0, [{scientific, 250}])),
{'EXIT', {badarg, _}} = (catch float_to_list(1.0e+300, [{decimals, 1}])),
"1.0e+300" = float_to_list(1.0e+300, [{scientific, 1}]),
- "1.0" = float_to_list(1.0, [{decimals, 249}, compact]),
+ "1.0" = float_to_list(1.0, [{decimals, 249}, compact]),
+ "1" = float_to_list(1.0, [{decimals, 0}]),
+ "2" = float_to_list(1.9, [{decimals, 0}]),
+ "123456789012345680.0" = erlang:float_to_list(
+ 123456789012345678.0, [{decimals, 236}, compact]),
+ {'EXIT', {badarg, _}} = (catch float_to_list(
+ 123456789012345678.0, [{decimals, 237}])),
Expected = "1." ++ string:copies("0", 249) ++ "e+00",
Expected = float_to_list(1.0, [{scientific, 249}, compact]),
@@ -139,7 +146,8 @@ t_float_to_list(Config) when is_list(Config) ->
X2 = float_to_list(1.0, [{scientific, 20}]),
X1 = X2,
"1.000e+00" = float_to_list(1.0, [{scientific, 3}]),
- "1.000" = float_to_list(1.0, [{decimals, 3}]),
+ "1.000" = float_to_list(1.0, [{decimals, 3}]),
+ "1.0" = float_to_list(1.0, [{decimals, 1}]),
"1.0" = float_to_list(1.0, [{decimals, 3}, compact]),
"1.12" = float_to_list(1.123, [{decimals, 2}]),
"1.123" = float_to_list(1.123, [{decimals, 3}]),
@@ -148,6 +156,14 @@ t_float_to_list(Config) when is_list(Config) ->
"1.12300" = float_to_list(1.123, [{decimals, 5}]),
"1.123" = float_to_list(1.123, [{decimals, 5}, compact]),
"1.1234" = float_to_list(1.1234,[{decimals, 6}, compact]),
+ "1.01" = float_to_list(1.005, [{decimals, 2}]),
+ "-1.01" = float_to_list(-1.005,[{decimals, 2}]),
+ "0.999" = float_to_list(0.999, [{decimals, 3}]),
+ "-0.999" = float_to_list(-0.999,[{decimals, 3}]),
+ "1.0" = float_to_list(0.999, [{decimals, 2}, compact]),
+ "-1.0" = float_to_list(-0.999,[{decimals, 2}, compact]),
+ "0.5" = float_to_list(0.5, [{decimals, 1}]),
+ "-0.5" = float_to_list(-0.5, [{decimals, 1}]),
"2.333333" = erlang:float_to_list(7/3, [{decimals, 6}, compact]),
"2.333333" = erlang:float_to_list(7/3, [{decimals, 6}]),
"0.00000000000000000000e+00" = float_to_list(0.0, [compact]),