diff options
author | Sverker Eriksson <[email protected]> | 2019-02-06 20:00:20 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2019-02-06 20:00:20 +0100 |
commit | 2e36105479b300a6c51e21b31e03ded39df8c02b (patch) | |
tree | 89d47147dd90e0700df6eb3960a9b14e69277c56 /erts | |
parent | 98cfd6016f8b40fc97e03b31177d14318349040f (diff) | |
download | otp-2e36105479b300a6c51e21b31e03ded39df8c02b.tar.gz otp-2e36105479b300a6c51e21b31e03ded39df8c02b.tar.bz2 otp-2e36105479b300a6c51e21b31e03ded39df8c02b.zip |
erts: Add test for bug in enif_make_maps_from_arrays
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/test/nif_SUITE.erl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/erts/emulator/test/nif_SUITE.erl b/erts/emulator/test/nif_SUITE.erl index a2f3489943..ca5f90621f 100644 --- a/erts/emulator/test/nif_SUITE.erl +++ b/erts/emulator/test/nif_SUITE.erl @@ -1175,6 +1175,15 @@ maps(Config) when is_list(Config) -> M2 = maps_from_list_nif(maps:to_list(M2)), M3 = maps_from_list_nif(maps:to_list(M3)), + %% Test different map sizes (OTP-15567) + repeat_while(fun({35,_}) -> false; + ({K,Map}) -> + Map = maps_from_list_nif(maps:to_list(Map)), + Map = maps:filter(fun(K,V) -> V =:= K*100 end, Map), + {K+1, maps:put(K,K*100,Map)} + end, + {1,#{}}), + has_duplicate_keys = maps_from_list_nif([{1,1},{1,1}]), verify_tmpmem(TmpMem), @@ -2471,6 +2480,13 @@ repeat(0, _, Arg) -> repeat(N, Fun, Arg0) -> repeat(N-1, Fun, Fun(Arg0)). +repeat_while(Fun, Acc0) -> + case Fun(Acc0) of + false -> ok; + Acc1 -> + repeat_while(Fun, Acc1) + end. + check(Exp,Got,Line) -> case Got of Exp -> Exp; |