aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-03-31 15:08:40 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-03-31 15:08:40 +0200
commit2fc541ea6ecaf7dd8d98071ef82332fe67adfbef (patch)
tree6faa4c51933785792da5096c502d64a1be7df9e6 /erts/emulator/test
parentdbad08513df1ea3f3de47375a50d16551df6f208 (diff)
downloadotp-2fc541ea6ecaf7dd8d98071ef82332fe67adfbef.tar.gz
otp-2fc541ea6ecaf7dd8d98071ef82332fe67adfbef.tar.bz2
otp-2fc541ea6ecaf7dd8d98071ef82332fe67adfbef.zip
erts: Try to test deep Maps collision
Ensure maps:size/1 is correct.
Diffstat (limited to 'erts/emulator/test')
-rw-r--r--erts/emulator/test/map_SUITE.erl11
1 files changed, 11 insertions, 0 deletions
diff --git a/erts/emulator/test/map_SUITE.erl b/erts/emulator/test/map_SUITE.erl
index a72c8dafe4..c7800a5540 100644
--- a/erts/emulator/test/map_SUITE.erl
+++ b/erts/emulator/test/map_SUITE.erl
@@ -644,6 +644,17 @@ t_map_size(Config) when is_list(Config) ->
Ks = [build_key(fun(K) -> <<1,K:32,1>> end,I)||I<-lists:seq(1,100)],
ok = build_and_check_size(Ks,0,#{}),
+ %% try deep collisions
+ %% statistically we get another subtree at 50k -> 100k elements
+ %% Try to be nice and don't use too much memory in the testcase,
+
+ N = 500000,
+ Is = lists:seq(1,N),
+ N = map_size(maps:from_list([{I,I}||I<-Is])),
+ N = map_size(maps:from_list([{<<I:32>>,I}||I<-Is])),
+ N = map_size(maps:from_list([{integer_to_list(I),I}||I<-Is])),
+ N = map_size(maps:from_list([{float(I),I}||I<-Is])),
+
%% Error cases.
{'EXIT',{badarg,_}} = (catch map_size([])),
{'EXIT',{badarg,_}} = (catch map_size(<<1,2,3>>)),