diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-05-11 17:49:45 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-05-11 17:49:45 +0200 |
commit | d3cde2d80d1cbcbbb70e4b8057a4f3772b7fa97f (patch) | |
tree | 6bb10917dffcd1d2f3f369ae8826e6105f9bd1bd /erts/emulator/test/nif_SUITE.erl | |
parent | 8d8d8c3817988a50ed1e058e73b247ce0a8c3616 (diff) | |
download | otp-d3cde2d80d1cbcbbb70e4b8057a4f3772b7fa97f.tar.gz otp-d3cde2d80d1cbcbbb70e4b8057a4f3772b7fa97f.tar.bz2 otp-d3cde2d80d1cbcbbb70e4b8057a4f3772b7fa97f.zip |
erts: Add tests for enif_snprintf
Diffstat (limited to 'erts/emulator/test/nif_SUITE.erl')
-rw-r--r-- | erts/emulator/test/nif_SUITE.erl | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/erts/emulator/test/nif_SUITE.erl b/erts/emulator/test/nif_SUITE.erl index a7767132ee..e764071415 100644 --- a/erts/emulator/test/nif_SUITE.erl +++ b/erts/emulator/test/nif_SUITE.erl @@ -46,7 +46,8 @@ nif_now_time/1, nif_cpu_time/1, nif_unique_integer/1, nif_is_process_alive/1, nif_is_port_alive/1, nif_term_to_binary/1, nif_binary_to_term/1, - nif_port_command/1 + nif_port_command/1, + nif_snprintf/1 ]). -export([many_args_100/100]). @@ -81,8 +82,8 @@ all() -> nif_now_time, nif_cpu_time, nif_unique_integer, nif_is_process_alive, nif_is_port_alive, nif_term_to_binary, nif_binary_to_term, - nif_port_command - ]. + nif_port_command, + nif_snprintf]. init_per_testcase(_Case, Config) -> Config. @@ -2024,9 +2025,18 @@ nif_port_command(Config) -> port_close(Port), {'EXIT', {badarg, _}} = (catch port_command_nif(Port, "hello\n")), + ok. +nif_snprintf(Config) -> + ensure_lib_loaded(Config), + <<"ok",0>> = format_term_nif(3,ok), + <<"o",0>> = format_term_nif(2,ok), + <<"\"hello world\"",0>> = format_term_nif(14,"hello world"), + <<"{{hello,world,-33},3.14",_/binary>> = format_term_nif(50,{{hello,world, -33}, 3.14, self()}), + <<"{{hello,world,-33},",0>> = format_term_nif(20,{{hello,world, -33}, 3.14, self()}), ok. + %% The NIFs: lib_version() -> undefined. call_history() -> ?nif_stub. @@ -2091,6 +2101,7 @@ is_port_alive_nif(_) -> ?nif_stub. term_to_binary_nif(_, _) -> ?nif_stub. binary_to_term_nif(_, _, _) -> ?nif_stub. port_command_nif(_, _) -> ?nif_stub. +format_term_nif(_,_) -> ?nif_stub. %% maps is_map_nif(_) -> ?nif_stub. |