aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/nif_SUITE.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2015-12-17 14:14:54 +0100
committerLukas Larsson <[email protected]>2016-03-29 14:57:11 +0200
commit1bd56e2b5141a3afdca4e854e9b667807bf4e2f3 (patch)
tree0171c0a573a08068d7155ac73bcd6a6d3fc941d6 /erts/emulator/test/nif_SUITE.erl
parent348f3f2ee2d2707e30658c3600e05309ad0e72bf (diff)
downloadotp-1bd56e2b5141a3afdca4e854e9b667807bf4e2f3.tar.gz
otp-1bd56e2b5141a3afdca4e854e9b667807bf4e2f3.tar.bz2
otp-1bd56e2b5141a3afdca4e854e9b667807bf4e2f3.zip
erts: Add enif_term_to_binary and enif_binary_to_term
Diffstat (limited to 'erts/emulator/test/nif_SUITE.erl')
-rw-r--r--erts/emulator/test/nif_SUITE.erl25
1 files changed, 23 insertions, 2 deletions
diff --git a/erts/emulator/test/nif_SUITE.erl b/erts/emulator/test/nif_SUITE.erl
index 3202986ce7..af25af9eeb 100644
--- a/erts/emulator/test/nif_SUITE.erl
+++ b/erts/emulator/test/nif_SUITE.erl
@@ -44,7 +44,8 @@
nif_nan_and_inf/1, nif_atom_too_long/1,
nif_monotonic_time/1, nif_time_offset/1, nif_convert_time_unit/1,
nif_now_time/1, nif_cpu_time/1, nif_unique_integer/1,
- nif_is_process_alive/1, nif_is_port_alive/1
+ nif_is_process_alive/1, nif_is_port_alive/1,
+ nif_term_to_binary/1, nif_binary_to_term/1
]).
-export([many_args_100/100]).
@@ -77,7 +78,8 @@ all() ->
nif_exception, nif_nan_and_inf, nif_atom_too_long,
nif_monotonic_time, nif_time_offset, nif_convert_time_unit,
nif_now_time, nif_cpu_time, nif_unique_integer,
- nif_is_process_alive, nif_is_port_alive
+ nif_is_process_alive, nif_is_port_alive,
+ nif_term_to_binary, nif_binary_to_term
].
init_per_testcase(_Case, Config) ->
@@ -1958,6 +1960,23 @@ nif_is_port_alive(Config) ->
port_close(Port),
false = is_port_alive_nif(Port).
+nif_term_to_binary(Config) ->
+ ensure_lib_loaded(Config),
+ T = {#{ok => nok}, <<0:8096>>, lists:seq(1,100)},
+ Bin = term_to_binary(T),
+ ct:log("~p",[Bin]),
+ Bin = term_to_binary_nif(T, undefined),
+ true = term_to_binary_nif(T, self()),
+ receive Bin -> ok end.
+
+nif_binary_to_term(Config) ->
+ ensure_lib_loaded(Config),
+ T = {#{ok => nok}, <<0:8096>>, lists:seq(1,100)},
+ Bin = term_to_binary(T),
+ T = binary_to_term_nif(Bin, undefined),
+ true = binary_to_term_nif(Bin, self()),
+ receive T -> ok end.
+
%% The NIFs:
lib_version() -> undefined.
call_history() -> ?nif_stub.
@@ -2018,6 +2037,8 @@ call_nif_atom_too_long(_) -> ?nif_stub.
unique_integer_nif(_) -> ?nif_stub.
is_process_alive_nif(_) -> ?nif_stub.
is_port_alive_nif(_) -> ?nif_stub.
+term_to_binary_nif(_, _) -> ?nif_stub.
+binary_to_term_nif(_, _) -> ?nif_stub.
%% maps
is_map_nif(_) -> ?nif_stub.