summaryrefslogtreecommitdiff
path: root/erts/emulator/test/list_bif_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/test/list_bif_SUITE.erl')
-rw-r--r--erts/emulator/test/list_bif_SUITE.erl46
1 files changed, 20 insertions, 26 deletions
diff --git a/erts/emulator/test/list_bif_SUITE.erl b/erts/emulator/test/list_bif_SUITE.erl
index b398e22707..2e43e9ad5a 100644
--- a/erts/emulator/test/list_bif_SUITE.erl
+++ b/erts/emulator/test/list_bif_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2020. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2022. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -21,7 +21,8 @@
-module(list_bif_SUITE).
-include_lib("common_test/include/ct.hrl").
--export([all/0, suite/0]).
+-export([all/0, suite/0,
+ init_per_testcase/2, end_per_testcase/2]).
-export([hd_test/1,tl_test/1,t_length/1,t_list_to_pid/1,
t_list_to_ref/1, t_list_to_ext_pidportref/1,
t_list_to_port/1,t_list_to_float/1,t_list_to_integer/1]).
@@ -37,6 +38,11 @@ all() ->
t_list_to_ref, t_list_to_ext_pidportref,
t_list_to_float, t_list_to_integer].
+init_per_testcase(_TestCase, Config) ->
+ Config.
+end_per_testcase(_TestCase, Config) ->
+ erts_test_utils:ept_check_leaked_nodes(Config).
+
%% Tests list_to_integer and string:to_integer
t_list_to_integer(Config) when is_list(Config) ->
{'EXIT',{badarg,_}} = (catch list_to_integer("12373281903728109372810937209817320981321ABC")),
@@ -44,14 +50,21 @@ t_list_to_integer(Config) when is_list(Config) ->
12373 = (catch list_to_integer("12373")),
-12373 = (catch list_to_integer("-12373")),
12373 = (catch list_to_integer("+12373")),
- {'EXIT',{badarg,_}} = ( catch list_to_integer(abc)),
+ {'EXIT',{badarg,_}} = (catch list_to_integer(abc)),
{'EXIT',{badarg,_}} = (catch list_to_integer("")),
{12373281903728109372810937209817320981321,"ABC"} = string:to_integer("12373281903728109372810937209817320981321ABC"),
{-12373281903728109372810937209817320981321,"ABC"} = string:to_integer("-12373281903728109372810937209817320981321ABC"),
{12,[345]} = string:to_integer([$1,$2,345]),
- {error, badarg} = string:to_integer([$1,$2,a]),
+ {error,badarg} = string:to_integer([$1,$2,a]),
{error,no_integer} = string:to_integer([$A]),
{error,badarg} = string:to_integer($A),
+
+ %% System limit.
+ Digits = lists:duplicate(11_000_000, $9),
+ {'EXIT',{system_limit,_}} = catch list_to_integer(Digits),
+ {'EXIT',{system_limit,_}} = catch list_to_integer(Digits, 16),
+ {error,system_limit} = string:to_integer(Digits),
+
ok.
%% Test hd/1 with correct and incorrect arguments.
@@ -143,7 +156,7 @@ t_list_to_ref(Config) when is_list(Config) ->
%% Test list_to_pid/port/ref for external pids/ports/refs.
t_list_to_ext_pidportref(Config) when is_list(Config) ->
- {ok, Node} = slave:start(net_adm:localhost(), t_list_to_ext_pidportref),
+ {ok, Peer, Node} = ?CT_PEER(),
Pid = rpc:call(Node, erlang, self, []),
Port = hd(rpc:call(Node, erlang, ports, [])),
Ref = rpc:call(Node, erlang, make_ref, []),
@@ -175,27 +188,8 @@ t_list_to_ext_pidportref(Config) when is_list(Config) ->
true = rpc:call(Node, erlang, '=:=', [Ref, Ref2]),
true = rpc:call(Node, erlang, '==', [Ref, Ref2]),
- %% Make sure no ugly comparison with 0-creation as wildcard is done.
- Pid0 = make_0_creation(Pid),
- Port0 = make_0_creation(Port),
- Ref0 = make_0_creation(Ref),
- false = (Pid =:= Pid0),
- false = (Port =:= Port0),
- false = (Ref =:= Ref0),
- false = (Pid == Pid0),
- false = (Port == Port0),
- false = (Ref == Ref0),
-
- %% Check 0-creations are converted to local node creations
- %% when sent to matching node name.
- true = rpc:call(Node, erlang, '=:=', [Pid, Pid0]),
- true = rpc:call(Node, erlang, '==', [Pid, Pid0]),
- true = rpc:call(Node, erlang, '=:=', [Port, Port0]),
- true = rpc:call(Node, erlang, '==', [Port, Port0]),
- true = rpc:call(Node, erlang, '=:=', [Ref, Ref0]),
- true = rpc:call(Node, erlang, '==', [Ref, Ref0]),
-
- slave:stop(Node),
+
+ peer:stop(Peer),
ok.
-define(NEW_PID_EXT, 88).