fix failing unit tests with Scilab V6
This commit is contained in:
parent
18832e938c
commit
0b07622a11
7 changed files with 67 additions and 79 deletions
|
|
@ -21,10 +21,10 @@ checkequal(PubBase_virtualMethod(pubBase), "PublicBase", "PubBase_virtualMethod(
|
|||
class = PubBase_instanceMethod(pubBase, klass);
|
||||
checkequal(Klass_getName(class), "allprotected_klass", "Klass_getName(PubBase_instanceMethod(pubBase, klass))");
|
||||
|
||||
class = PubBase_instanceOverloaded(pubBase, klass);
|
||||
class = PubBase_instanceOverload(pubBase, klass);
|
||||
checkequal(Klass_getName(class), "allprotected_klass", "Klass_getName(PubBase_instanceOverloaded(pubBase, klass))");
|
||||
|
||||
class = PubBase_instanceOverloaded(pubBase, klass, "allprotected_klass2");
|
||||
class = PubBase_instanceOverload(pubBase, klass, "allprotected_klass2");
|
||||
checkequal(Klass_getName(class), "allprotected_klass2", "Klass_getName(PubBase_instanceOverloaded(pubBase, klass, ""allprotected_klass2""))");
|
||||
|
||||
class = PubBase_staticMethod(klass);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ checkException('Test_throw_domain_error(t)', 20009, 'ValueError: oops');
|
|||
|
||||
checkException('Test_throw_exception(t)', 20010, 'SystemError: std::exception');
|
||||
|
||||
checkException('Test_throw_invalid_argument(t)', 20009, 'ValueError: oops');
|
||||
checkException('Test_throw_invalid_argum(t)', 20009, 'ValueError: oops');
|
||||
|
||||
checkException('Test_throw_length_error(t)', 20004, 'IndexError: oops');
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ checkException('Test_throw_logic_error(t)', 20003, 'RuntimeError: oops');
|
|||
|
||||
checkException('Test_throw_out_of_range(t)', 20004, 'IndexError: oops');
|
||||
|
||||
checkException('Test_throw_overflow_error(t)', 20007, 'OverflowError: oops');
|
||||
checkException('Test_throw_overflow_erro(t)', 20007, 'OverflowError: oops');
|
||||
|
||||
checkException('Test_throw_range_error(t)', 20007, 'OverflowError: oops');
|
||||
|
||||
|
|
|
|||
|
|
@ -3,66 +3,65 @@
|
|||
exec("swigtest.start", -1);
|
||||
|
||||
// test matrix passed as output argument from fonction
|
||||
function test_out_matrix(func, value_type, expected_out_matrix)
|
||||
func_name = msprintf("out_%s_%s", value_type, func);
|
||||
cmd = msprintf("out_matrix = %s();", func_name);
|
||||
function test_outMatrix(func, valueType, expectedOutMatrix)
|
||||
funcName = msprintf("out%s%s", valueType, func);
|
||||
cmd = msprintf("outMatrix = %s();", funcName);
|
||||
ierr = execstr(cmd, "errcatch");
|
||||
if ierr <> 0 then
|
||||
swigtesterror(msprintf("Error %d in %s", ierr, func_name));
|
||||
swigtesterror(msprintf("Error %d in %s", ierr, funcName));
|
||||
end
|
||||
checkequal(out_matrix, expected_out_matrix, func_name);
|
||||
checkequal(outMatrix, expectedOutMatrix, funcName);
|
||||
endfunction
|
||||
|
||||
// test matrix passed as input argument of fonction
|
||||
function test_in_matrix(func, value_type, in_matrix, expected_in_value)
|
||||
func_name = msprintf("in_%s_%s", value_type, func);
|
||||
cmd = msprintf("in_value = %s(in_matrix);", func_name);
|
||||
function test_inMatrix(func, valueType, inMatrix, expectedInValue)
|
||||
funcName = msprintf("in%s%s", valueType, func);
|
||||
cmd = msprintf("inValue = %s(inMatrix);", funcName);
|
||||
ierr = execstr(cmd, "errcatch");
|
||||
if ierr <> 0 then
|
||||
swigtesterror(msprintf("Error %d in %s", ierr, func_name));
|
||||
swigtesterror(msprintf("Error %d in %s", ierr, funcName));
|
||||
end
|
||||
checkequal(in_value, expected_in_value, func_name);
|
||||
checkequal(inValue, expectedInValue, funcName);
|
||||
endfunction
|
||||
|
||||
// test matrixes passed as input and output arguments of fonction
|
||||
function test_inout_matrix(func, value_type, inout_matrix, expected_inout_matrix)
|
||||
func_name = msprintf("inout_%s_%s", value_type, func);
|
||||
cmd = msprintf("inout_matrix = %s(inout_matrix);", func_name);
|
||||
function test_inoutMatrix(func, valueType, inoutMatrix, expectedInoutMatrix)
|
||||
funcName = msprintf("inout%s%s", valueType, func);
|
||||
cmd = msprintf("inoutMatrix = %s(inoutMatrix);", funcName);
|
||||
ierr = execstr(cmd, "errcatch");
|
||||
if ierr <> 0 then
|
||||
swigtesterror(msprintf("Error %d in %s", ierr, func_name));
|
||||
swigtesterror(msprintf("Error %d in %s", ierr, funcName));
|
||||
end
|
||||
checkequal(inout_matrix, expected_inout_matrix, func_name);
|
||||
checkequal(inoutMatrix, expectedInoutMatrix, funcName);
|
||||
endfunction
|
||||
|
||||
function test_matrix_typemaps(value_type, ..
|
||||
expected_out_matrix_dims, expected_out_matrix_size, ..
|
||||
expected_in_value, ..
|
||||
expected_inout_matrix_dims, expected_inout_matrix_size)
|
||||
function test_matrix_typemaps(valueType, ..
|
||||
expectedOutMatrixDims, expectedOutMatrixSize, ..
|
||||
expectedInValue, ..
|
||||
expectedInoutMatrixDims, expectedInoutMatrixSize)
|
||||
|
||||
test_out_matrix("matrix_dims", value_type, expected_out_matrix_dims);
|
||||
test_out_matrix("matrix_size", value_type, expected_out_matrix_size);
|
||||
matrix_dims = expected_out_matrix_dims;
|
||||
matrix_size = expected_out_matrix_size;
|
||||
test_in_matrix("matrix_dims", value_type, matrix_dims, expected_in_value);
|
||||
test_in_matrix("matrix_size", value_type, matrix_size, expected_in_value);
|
||||
test_inout_matrix("matrix_dims", value_type, matrix_dims, expected_inout_matrix_dims);
|
||||
test_inout_matrix("matrix_size", value_type, matrix_size, expected_inout_matrix_size);
|
||||
test_outMatrix("MatrixDims", valueType, expectedOutMatrixDims);
|
||||
test_outMatrix("MatrixSize", valueType, expectedOutMatrixSize);
|
||||
matrixDims = expectedOutMatrixDims;
|
||||
matrixSize = expectedOutMatrixSize;
|
||||
test_inMatrix("MatrixDims", valueType, matrixDims, expectedInValue);
|
||||
test_inMatrix("MatrixSize", valueType, matrixSize, expectedInValue);
|
||||
test_inoutMatrix("MatrixDims", valueType, matrixDims, expectedInoutMatrixDims);
|
||||
test_inoutMatrix("MatrixSize", valueType, matrixSize, expectedInoutMatrixSize);
|
||||
endfunction
|
||||
|
||||
|
||||
m = [0 3; 1 4; 2 5];
|
||||
v = [0 1 2 3 4 5];
|
||||
test_matrix_typemaps("int", m, v, sum(m), m .* m, v .* v);
|
||||
test_matrix_typemaps("double", m, v, sum(m), m .* m, v .* v);
|
||||
test_matrix_typemaps("Int", m, v, sum(m), m .* m, v .* v);
|
||||
test_matrix_typemaps("Double", m, v, sum(m), m .* m, v .* v);
|
||||
|
||||
m = ["A" "D"; "B" "E"; "C" "F"];
|
||||
v = ["A" "B" "C" "D" "E" "F"];
|
||||
test_matrix_typemaps("charptr", m, v, strcat(m), m + m, v + v);
|
||||
test_matrix_typemaps("CharPtr", m, v, strcat(m), m + m, v + v);
|
||||
|
||||
m = [%T %F; %F %T; %T %F];
|
||||
v = [%T %F %T %F %T %F];
|
||||
test_matrix_typemaps("bool", m, v, %T, ~m, ~v);
|
||||
|
||||
test_matrix_typemaps("Bool", m, v, %T, ~m, ~v);
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue