aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-09-11 12:17:06 +0200
committerFredrik Gustafsson <[email protected]>2013-09-11 12:17:06 +0200
commite04d25d707d77453f7acd0c098d46a24b828830b (patch)
tree2e0cd437356d884420606db5ce8b22e98542a852 /erts/emulator/test
parentf13bf23b904fc155e41da4d00a2a8387ef27b1fd (diff)
parentbb73eb3cbf6d7754389ffbe7e0bfe91fab865888 (diff)
downloadotp-e04d25d707d77453f7acd0c098d46a24b828830b.tar.gz
otp-e04d25d707d77453f7acd0c098d46a24b828830b.tar.bz2
otp-e04d25d707d77453f7acd0c098d46a24b828830b.zip
Merge branch 'maint'
Conflicts: erts/preloaded/ebin/erlang.beam
Diffstat (limited to 'erts/emulator/test')
-rw-r--r--erts/emulator/test/num_bif_SUITE.erl22
1 files changed, 22 insertions, 0 deletions
diff --git a/erts/emulator/test/num_bif_SUITE.erl b/erts/emulator/test/num_bif_SUITE.erl
index b92a0e2059..ff8d18eef8 100644
--- a/erts/emulator/test/num_bif_SUITE.erl
+++ b/erts/emulator/test/num_bif_SUITE.erl
@@ -350,12 +350,34 @@ t_integer_to_string(Config) when is_list(Config) ->
(catch erlang:integer_to_list(Value))
end,[atom,1.2,0.0,[$1,[$2]]]),
+ %% Base-2 integers
+ test_its("0", 0, 2),
+ test_its("1", 1, 2),
+ test_its("110110", 54, 2),
+ test_its("-1000000", -64, 2),
+ %% Base-16 integers
+ test_its("0", 0, 16),
+ test_its("A", 10, 16),
+ test_its("D4BE", 54462, 16),
+ test_its("-D4BE", -54462, 16),
+
+ lists:foreach(fun(Value) ->
+ {'EXIT', {badarg, _}} =
+ (catch erlang:integer_to_binary(Value, 8)),
+ {'EXIT', {badarg, _}} =
+ (catch erlang:integer_to_list(Value, 8))
+ end,[atom,1.2,0.0,[$1,[$2]]]),
+
ok.
test_its(List,Int) ->
Int = list_to_integer(List),
Int = binary_to_integer(list_to_binary(List)).
+test_its(List,Int,Base) ->
+ Int = list_to_integer(List, Base),
+ Int = binary_to_integer(list_to_binary(List), Base).
+
%% Tests binary_to_integer/1.
t_string_to_integer(Config) when is_list(Config) ->