scilab: add tests in arrays_global test (double management)
This commit is contained in:
parent
143b1a395e
commit
eb7d2bd43b
1 changed files with 25 additions and 16 deletions
|
|
@ -1,13 +1,18 @@
|
||||||
exec("swigtest.start", -1);
|
exec("swigtest.start", -1);
|
||||||
|
|
||||||
function testArray(arrayName, arraySetFunc, arrayGetFunc, values)
|
function testArray(arrayName, arraySetFunc, arrayGetFunc, in_values, ..
|
||||||
|
expected_out_values)
|
||||||
try
|
try
|
||||||
arraySetFunc(values);
|
arraySetFunc(in_values);
|
||||||
catch
|
catch
|
||||||
swigtesterror("error in " + arrayName + "_set()");
|
swigtesterror("error in " + arrayName + "_set()");
|
||||||
end
|
end
|
||||||
try
|
try
|
||||||
if arrayGetFunc() <> values then
|
out_values = arrayGetFunc();
|
||||||
|
if type(out_values) <> type(expected_out_values) then
|
||||||
|
swigtesterror("wrong values type returned from " + arrayName + "_get()");
|
||||||
|
end
|
||||||
|
if out_values <> expected_out_values then
|
||||||
swigtesterror("wrong values returned from " + arrayName + "_get()");
|
swigtesterror("wrong values returned from " + arrayName + "_get()");
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
|
|
@ -15,19 +20,23 @@ function testArray(arrayName, arraySetFunc, arrayGetFunc, values)
|
||||||
end
|
end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
// TODO: fix error in array_c_set
|
m = [10, 20];
|
||||||
//testArray("array_c", array_c_set, array_c_get, ['a', 'b']);
|
um = [-10, 20];
|
||||||
|
testArray("array_c", array_c_set, array_c_get, ['ab'], ['ab']);
|
||||||
testArray("array_sc", array_sc_set, array_sc_get, int8([-10, 20]));
|
testArray("array_sc", array_sc_set, array_sc_get, m, m);
|
||||||
testArray("array_s", array_s_set, array_s_get, int16([-10, 20]));
|
testArray("array_sc", array_sc_set, array_sc_get, int8(m), m);
|
||||||
testArray("array_us", array_us_set, array_us_get, uint16([10, 20]));
|
testArray("array_uc", array_uc_set, array_uc_get, uint8(um), uint8(um));
|
||||||
testArray("array_i", array_i_set, array_i_get, int32([-10, 20]));
|
testArray("array_s", array_s_set, array_s_get, m, m);
|
||||||
testArray("array_ui", array_ui_set, array_ui_get, uint32([10, 20]));
|
testArray("array_s", array_s_set, array_s_get, int16(m), m);
|
||||||
testArray("array_l", array_l_set, array_l_get, int32([-10, 20]));
|
testArray("array_us", array_us_set, array_us_get, uint16(um), uint16(um));
|
||||||
testArray("array_ul", array_ul_set, array_ul_get, uint32([10, 20]));
|
testArray("array_i", array_i_set, array_i_get, m, m);
|
||||||
//testArray("array_ll", array_l_set, array_ll_get, int32([-10, 20]));
|
testArray("array_i", array_i_set, array_i_get, int32(m), m);
|
||||||
testArray("array_f", array_f_set, array_f_get, [-10.5, 20.4]);
|
testArray("array_ui", array_ui_set, array_ui_get, uint32(um), uint32(um));
|
||||||
testArray("array_d", array_d_set, array_d_get, [-10.5, 20.4]);
|
testArray("array_l", array_l_set, array_l_get, m, m);
|
||||||
|
testArray("array_l", array_l_set, array_l_get, int32(m), m);
|
||||||
|
testArray("array_ul", array_ul_set, array_ul_get, uint32(um), uint32(um));
|
||||||
|
testArray("array_f", array_f_set, array_f_get, [-10.5, 20.4], [-10.5, 20.4]);
|
||||||
|
testArray("array_d", array_d_set, array_d_get, [-10.5, 20.4], [-10.5, 20.4]);
|
||||||
|
|
||||||
if array_const_i_get() <> [10, 20] then swigtesterror(); end
|
if array_const_i_get() <> [10, 20] then swigtesterror(); end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue