Add tests + small modifications

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12402 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Vincent Couvert 2011-01-28 13:14:32 +00:00
commit 454b1c8ab6
12 changed files with 241 additions and 1 deletions

View file

@ -0,0 +1,11 @@
exec("swigtest.start", -1);
try
Spam = new_Spam()
catch
swigtesterror();
end
if Foo_blah(Spam)<>0 then swigtesterror; end
exec("swigtest.quit", -1);

View file

@ -0,0 +1,10 @@
exec("swigtest.start", -1);
try
// This call must fail because the constructor does not exist
Spam = new_Spam()
swigtesterror();
catch
end
exec("swigtest.quit", -1);

View file

@ -0,0 +1,17 @@
exec("swigtest.start", -1);
try
// This call must fail
abstract_foo_meth(1);
swigtesterror();
catch
end
try
// This call must fail
abstract_bar_meth(1);
swigtesterror();
catch
end
exec("swigtest.quit", -1);

View file

@ -0,0 +1,15 @@
exec("swigtest.start", -1);
try
a = new_A_UF();
catch
swigtesterror();
end
try
delete_A_UF(a);
catch
swigtesterror();
end
exec("swigtest.quit", -1);

View file

@ -0,0 +1,17 @@
exec("swigtest.start", -1);
try
e = new_Engine();
catch
swigtesterror();
end
try
a = new_A();
catch
swigtesterror();
end
// TODO: test write method
exec("swigtest.quit", -1);

View file

@ -0,0 +1,27 @@
exec("swigtest.start", -1);
try
d = new_D();
catch
swigtesterror();
end
try
delete_D(d);
catch
swigtesterror();
end
try
e = new_E();
catch
swigtesterror();
end
try
delete_E(e);
catch
swigtesterror();
end
exec("swigtest.quit", -1);

View file

@ -0,0 +1,39 @@
exec("swigtest.start", -1);
try
baseInt = new_BaseInt();
catch
swigtesterror();
end
try
delete_BaseInt(baseInt);
catch
swigtesterror();
end
try
derivedInt = new_DerivedInt();
catch
swigtesterror();
end
try
delete_DerivedInt(derivedInt);
catch
swigtesterror();
end
try
bottomInt = new_BottomInt();
catch
swigtesterror();
end
try
delete_BottomInt(bottomInt);
catch
swigtesterror();
end
exec("swigtest.quit", -1);

View file

@ -0,0 +1,27 @@
exec("swigtest.start", -1);
try
foo = new_Foo();
catch
swigtesterror();
end
try
foo2 = Foo_blah(foo);
catch
swigtesterror();
end
try
delete_Foo(foo);
catch
swigtesterror();
end
try
delete_Foo(foo2);
catch
swigtesterror();
end
exec("swigtest.quit", -1);

View file

@ -0,0 +1,5 @@
exec("swigtest.start", -1);
// TODO: add tests here
exec("swigtest.quit", -1);

View file

@ -0,0 +1,65 @@
exec("swigtest.start", -1);
try
foo = new_Foo();
catch
swigtesterror();
end
if Foo_x_get(foo)<>0 then swigtesterror(); end
if typeof(Foo_x_get(foo))<>"constant" then swigtesterror(); end
if Foo_y_get(foo)<>0 then swigtesterror(); end
if typeof(Foo_y_get(foo))<>"constant" then swigtesterror(); end
if Foo_z_get(foo)<>0 then swigtesterror(); end
if typeof(Foo_z_get(foo))<>"constant" then swigtesterror(); end
if Foo_f_get(foo)<>uint32(0) then swigtesterror(); end
if typeof(Foo_f_get(foo))<>"uint32" then swigtesterror(); end
if Foo_seq_get(foo)<>uint32(0) then swigtesterror(); end
if typeof(Foo_seq_get(foo))<>"uint32" then swigtesterror(); end
try
Foo_x_set(foo, 5);
catch
swigtesterror();
end
if Foo_x_get(foo)<>5 then swigtesterror(); end
try
Foo_y_set(foo, 5);
catch
swigtesterror();
end
if Foo_y_get(foo)<>5 then swigtesterror(); end
try
Foo_f_set(foo, 5);
catch
swigtesterror();
end
if Foo_y_get(foo)<>uint32(5) then swigtesterror(); end
try
Foo_z_set(foo, 13);
catch
swigtesterror();
end
if Foo_z_get(foo)<>13 then swigtesterror(); end
try
Foo_seq_set(foo, 3);
catch
swigtesterror();
end
if Foo_seq_get(foo)<>uint32(3) then swigtesterror(); end
try
delete_Foo(foo);
catch
swigtesterror();
end
exec("swigtest.quit", -1);

View file

@ -79,6 +79,13 @@ SWIGINTERN int SWIG_AsVal_dec(long)(int iPos, long* val)
}
}
%fragment(SWIG_From_frag(long),"header") {
SWIGINTERNINLINE int SWIG_From_dec(long) (long value)
{
return 0;
}
}
/*%fragment(SWIG_AsPtr_frag(std::string),"header") {
SWIGINTERN int
SWIG_AsPtr_std_string(int iPos, std::string **val)

View file

@ -568,7 +568,7 @@
iRowsOut = 1;
iColsOut = 1;
sciErr = SCIAPIFUNCTION(pvApiCtx, iVarOut, iRowsOut, iColsOut, (CTYPE *)&$result);
sciErr = SCIAPIFUNCTION(pvApiCtx, iVarOut, iRowsOut, iColsOut, (CTYPE *)&$1);
if (sciErr.iErr)
{
printError(&sciErr, 0);