scilab: new test for constants (scilabconst)

This commit is contained in:
Simon Marchetto 2014-02-17 16:28:42 +01:00
commit d8135e7387
3 changed files with 76 additions and 1 deletions

View file

@ -11,7 +11,8 @@ top_srcdir = $(abspath @top_srcdir@)
top_builddir = $(abspath @top_builddir@)
C_TEST_CASES += \
scilab_enums
scilab_enums \
scilab_consts \
CPP_STD_TEST_CASES += \
primitive_types \

View file

@ -0,0 +1,32 @@
exec("swigtest.start", -1);
function checkConst(const_val, expected_type, expected_const_val)
if typeof(const_val) <> expected_type then swigtesterror(); end
if const_val <> expected_const_val then swigtesterror(); end
endfunction
checkConst(ICONST0_get(), "constant", 42);
checkConst(FCONST0_get(), "constant", 2.1828);
checkConst(CCONST0_get(), "string", "x");
//checkConst(CCONST0_2_get(), "string", "\n");
checkConst(SCONST0_get(), "string", "Hello World");
checkConst(SCONST0_2_get(), "string", """Hello World""");
checkConst(EXPR0_get(), "constant", 48.5484);
checkConst(iconst0_get(), "constant", 37);
checkConst(fconst0_get(), "constant", 42.2);
if isdef('BAR0') then swigtesterror(); end
checkConst(ICONST1, "int32", 42);
checkConst(FCONST1, "constant", 2.1828);
checkConst(CCONST1, "string", "x");
//checkConst(CCONST1_2, "string", "\n");
checkConst(SCONST1, "string", "Hello World");
checkConst(SCONST1_2, "string", """Hello World""");
checkConst(EXPR1, "constant", 48.5484);
checkConst(iconst0_get(), "constant", 37);
checkConst(fconst0_get(), "constant", 42.2);
if isdef('BAR1') then swigtesterror(); end
exec("swigtest.quit", -1);