aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/nif_SUITE_data/nif_SUITE.c
diff options
context:
space:
mode:
authorFilipe David Manana <[email protected]>2011-06-08 17:33:18 +0100
committerFilipe David Manana <[email protected]>2011-06-08 17:36:39 +0100
commit8db78b0c92a26e2a7766f8ece2f0ed7abb5db791 (patch)
tree6c51aec6b82b4420e5284c5aac077df32ed8e8c0 /erts/emulator/test/nif_SUITE_data/nif_SUITE.c
parent3b818d5ec09cd2bb4c650776b898af9206f13c68 (diff)
downloadotp-8db78b0c92a26e2a7766f8ece2f0ed7abb5db791.tar.gz
otp-8db78b0c92a26e2a7766f8ece2f0ed7abb5db791.tar.bz2
otp-8db78b0c92a26e2a7766f8ece2f0ed7abb5db791.zip
Add NIF function enif_is_number
This function allows for easily determining if a term represents or not a number (integer, float, small or big).
Diffstat (limited to 'erts/emulator/test/nif_SUITE_data/nif_SUITE.c')
-rw-r--r--erts/emulator/test/nif_SUITE_data/nif_SUITE.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c
index 0bb93daa33..014215bd68 100644
--- a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c
+++ b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c
@@ -781,6 +781,7 @@ static ERL_NIF_TERM release_resource(ErlNifEnv* env, int argc, const ERL_NIF_TER
* argv[7] an empty list
* argv[8] a non-empty list
* argv[9] a tuple
+ * argv[10] a number (small, big integer or float)
*/
static ERL_NIF_TERM check_is(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
@@ -797,6 +798,7 @@ static ERL_NIF_TERM check_is(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]
if (!enif_is_list(env, argv[7])) return enif_make_badarg(env);
if (!enif_is_list(env, argv[8])) return enif_make_badarg(env);
if (!enif_is_tuple(env, argv[9])) return enif_make_badarg(env);
+ if (!enif_is_number(env, argv[10])) return enif_make_badarg(env);
return ok_atom;
}
@@ -1399,7 +1401,7 @@ static ErlNifFunc nif_funcs[] =
{"release_resource", 1, release_resource},
{"last_resource_dtor_call", 0, last_resource_dtor_call},
{"make_new_resource", 2, make_new_resource},
- {"check_is", 10, check_is},
+ {"check_is", 11, check_is},
{"check_is_exception", 0, check_is_exception},
{"length_test", 5, length_test},
{"make_atoms", 0, make_atoms},