tests: Add test consecutive frrscript_call

Signed-off-by: Donald Lee <dlqs@gmx.com>
This commit is contained in:
Donald Lee 2021-08-10 06:29:19 +08:00
parent c123e9df54
commit 80bfe93670

View File

@ -62,6 +62,14 @@ int main(int argc, char **argv)
long long *ansptr = long long *ansptr =
frrscript_get_result(fs, "fact", "ans", lua_tointegerp); frrscript_get_result(fs, "fact", "ans", lua_tointegerp);
assert(*ansptr == 120); assert(*ansptr == 120);
/* check consecutive call + get_result without re-loading */
n = 4;
result = frrscript_call(fs, "fact", ("n", &n));
assert(result == 0);
ansptr = frrscript_get_result(fs, "fact", "ans", lua_tointegerp);
assert(*ansptr == 24);
XFREE(MTYPE_SCRIPT_RES, ansptr); XFREE(MTYPE_SCRIPT_RES, ansptr);
/* Negative testing */ /* Negative testing */