Improved runtime tests
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5661 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e9ee50827d
commit
c4d49d6c2a
2 changed files with 47 additions and 3 deletions
|
|
@ -17,6 +17,10 @@ public class cpp_typedef_runme {
|
|||
|
||||
public static void main(String argv[]) {
|
||||
|
||||
Foo f = new Foo();
|
||||
SWIGTYPE_p_Bar pbar = f.bar();
|
||||
pbar = Foo.sbar();
|
||||
|
||||
Test test = new Test();
|
||||
UnnamedStruct unnamed = new UnnamedStruct();
|
||||
TypedefNamedStruct named = new TypedefNamedStruct();
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ public class lib_typemaps_runme {
|
|||
lib_typemaps.outr_double(22.22, var);
|
||||
if (var[0] != 22.22) exit_test("outr_double");
|
||||
}
|
||||
try {
|
||||
double[] var = null;
|
||||
lib_typemaps.out_double(22.22, var);
|
||||
exit_test("null out_double");
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
|
||||
// Check double INOUT typemaps
|
||||
{
|
||||
|
|
@ -44,7 +50,12 @@ public class lib_typemaps_runme {
|
|||
lib_typemaps.inoutr_double(var);
|
||||
if (var[0] != 44.44) exit_test("inoutr_double");
|
||||
}
|
||||
|
||||
try {
|
||||
double[] var = null;
|
||||
lib_typemaps.inout_double(var);
|
||||
exit_test("null inout_double");
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
|
||||
// Check unsigned long long INPUT typemaps
|
||||
BigInteger forty = new BigInteger("40");
|
||||
|
|
@ -52,6 +63,12 @@ public class lib_typemaps_runme {
|
|||
if (!lib_typemaps.in_ulonglong(twenty).equals(twenty)) exit_test("in_ulonglong");
|
||||
if (!lib_typemaps.inr_ulonglong(twenty).equals(twenty)) exit_test("inr_ulonglong");
|
||||
|
||||
try {
|
||||
lib_typemaps.in_ulonglong(null);
|
||||
exit_test("null in_ulonglong");
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
|
||||
// Check unsigned long long OUTPUT typemaps
|
||||
{
|
||||
BigInteger[] var = {new BigInteger("40")};
|
||||
|
|
@ -63,6 +80,17 @@ public class lib_typemaps_runme {
|
|||
lib_typemaps.outr_ulonglong(twenty, var);
|
||||
if (!var[0].equals(twenty)) exit_test("outr_ulonglong");
|
||||
}
|
||||
try {
|
||||
BigInteger[] var = null;
|
||||
lib_typemaps.out_ulonglong(twenty, var);
|
||||
exit_test("null out_ulonglong");
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
{
|
||||
BigInteger[] var = { null };
|
||||
lib_typemaps.out_ulonglong(twenty, var);
|
||||
if (!var[0].equals(twenty)) exit_test("null element out_ulonglong");
|
||||
}
|
||||
|
||||
// Check unsigned long long INOUT typemaps
|
||||
{
|
||||
|
|
@ -75,11 +103,23 @@ public class lib_typemaps_runme {
|
|||
lib_typemaps.inoutr_ulonglong(var);
|
||||
if (!var[0].equals(forty)) exit_test("inoutr_ulonglong");
|
||||
}
|
||||
try {
|
||||
BigInteger[] var = null;
|
||||
lib_typemaps.inout_ulonglong(var);
|
||||
exit_test("null inout_ulonglong");
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
try {
|
||||
BigInteger[] var = { null };
|
||||
lib_typemaps.inout_ulonglong(var);
|
||||
exit_test("null element inout_ulonglong");
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void exit_test(String funcName) {
|
||||
System.err.println("Test FAILED in function " + funcName);
|
||||
System.exit(1);
|
||||
throw new RuntimeException("Test FAILED in function " + funcName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue