Merged from trunk
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12656 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
954256979c
557 changed files with 27074 additions and 5555 deletions
24
Examples/test-suite/java/char_binary_runme.java
Normal file
24
Examples/test-suite/java/char_binary_runme.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import char_binary.*;
|
||||
|
||||
public class char_binary_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("char_binary");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
Test t = new Test();
|
||||
byte[] hile = "hile".getBytes();
|
||||
byte[] hil0 = "hil\0".getBytes();
|
||||
if (t.strlen(hile) != 4)
|
||||
throw new RuntimeException("bad multi-arg typemap");
|
||||
|
||||
if (t.strlen(hil0) != 4)
|
||||
throw new RuntimeException("bad multi-arg typemap");
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ public class director_protected_runme {
|
|||
Foo f = b.create();
|
||||
director_protected_FooBar fb = new director_protected_FooBar();
|
||||
director_protected_FooBar2 fb2 = new director_protected_FooBar2();
|
||||
director_protected_FooBar3 fb3 = new director_protected_FooBar3();
|
||||
|
||||
{
|
||||
String s = fb.used();
|
||||
|
|
@ -60,11 +61,34 @@ public class director_protected_runme {
|
|||
if ( !Modifier.isProtected(method.getModifiers()) )
|
||||
throw new RuntimeException("Foo::ping should be protected" );
|
||||
|
||||
method = b.getClass().getDeclaredMethod("cheer", (java.lang.Class[])null);
|
||||
if ( !Modifier.isProtected(method.getModifiers()) )
|
||||
throw new RuntimeException("Bar::cheer should be protected" );
|
||||
|
||||
method = f.getClass().getDeclaredMethod("cheer", (java.lang.Class[])null);
|
||||
if ( !Modifier.isProtected(method.getModifiers()) )
|
||||
throw new RuntimeException("Foo::cheer should be protected" );
|
||||
|
||||
} catch (NoSuchMethodException n) {
|
||||
throw new RuntimeException("NoSuchmethodException caught. Test failed.");
|
||||
throw new RuntimeException(n);
|
||||
} catch (SecurityException s) {
|
||||
throw new RuntimeException("SecurityException caught. Test failed.");
|
||||
}
|
||||
|
||||
if (!fb3.cheer().equals("director_protected_FooBar3::cheer();"))
|
||||
throw new RuntimeException("bad fb3::cheer");
|
||||
|
||||
if (!fb2.callping().equals("director_protected_FooBar2::ping();"))
|
||||
throw new RuntimeException("bad fb2.callping");
|
||||
|
||||
if (!fb2.callcheer().equals("director_protected_FooBar2::pang();Bar::pong();Foo::pong();director_protected_FooBar2::ping();"))
|
||||
throw new RuntimeException("bad fb2.callcheer");
|
||||
|
||||
if (!fb3.callping().equals("Bar::ping();"))
|
||||
throw new RuntimeException("bad fb3.callping");
|
||||
|
||||
if (!fb3.callcheer().equals("director_protected_FooBar3::cheer();"))
|
||||
throw new RuntimeException("bad fb3.callcheer");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,3 +107,9 @@ class director_protected_FooBar2 extends Bar {
|
|||
}
|
||||
}
|
||||
|
||||
class director_protected_FooBar3 extends Bar {
|
||||
public String cheer() {
|
||||
return "director_protected_FooBar3::cheer();";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,6 +416,28 @@ public class enum_thorough_proper_runme {
|
|||
if (enum_thorough_proper.repeatTest(repeat.llast).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_proper.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typeint).swigValue() != 10) throw new RuntimeException("differentTypes 1 failed");
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typeboolfalse).swigValue() != 0) throw new RuntimeException("differentTypes 2 failed");
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typebooltrue).swigValue() != 1) throw new RuntimeException("differentTypes 3 failed");
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typebooltwo).swigValue() != 2) throw new RuntimeException("differentTypes 4 failed");
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typechar).swigValue() != 'C') throw new RuntimeException("differentTypes 5 failed");
|
||||
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typedefaultint).swigValue() != 'D') throw new RuntimeException("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough_proper.global_typeint;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough_proper.global_typeboolfalse;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough_proper.global_typebooltrue;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough_proper.global_typebooltwo;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough_proper.global_typechar;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_proper.global_typedefaultint;
|
||||
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,6 +416,28 @@ public class enum_thorough_runme {
|
|||
if (enum_thorough.repeatTest(repeat.llast).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typeint).swigValue() != 10) throw new RuntimeException("differentTypes 1 failed");
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typeboolfalse).swigValue() != 0) throw new RuntimeException("differentTypes 2 failed");
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typebooltrue).swigValue() != 1) throw new RuntimeException("differentTypes 3 failed");
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typebooltwo).swigValue() != 2) throw new RuntimeException("differentTypes 4 failed");
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typechar).swigValue() != 'C') throw new RuntimeException("differentTypes 5 failed");
|
||||
if (enum_thorough.differentTypesTest(DifferentTypes.typedefaultint).swigValue() != 'D') throw new RuntimeException("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough.global_typeint;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough.global_typeboolfalse;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough.global_typebooltrue;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough.global_typebooltwo;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough.global_typechar;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough.global_typedefaultint;
|
||||
if (enum_thorough.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,6 +416,28 @@ public class enum_thorough_simple_runme {
|
|||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.llast) != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.end) != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typeint) != 10) throw new RuntimeException("differentTypes 1 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typeboolfalse) != 0) throw new RuntimeException("differentTypes 2 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typebooltrue) != 1) throw new RuntimeException("differentTypes 3 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typebooltwo) != 2) throw new RuntimeException("differentTypes 4 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typechar) != 'C') throw new RuntimeException("differentTypes 5 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typedefaultint) != 'D') throw new RuntimeException("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough_simple.global_typeint;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough_simple.global_typeboolfalse;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough_simple.global_typebooltrue;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough_simple.global_typebooltwo;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough_simple.global_typechar;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_simple.global_typedefaultint;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,6 +416,28 @@ public class enum_thorough_typeunsafe_runme {
|
|||
if (enum_thorough_typeunsafe.repeatTest(repeat.llast) != 3) throw new RuntimeException("repeatTest 5 failed");
|
||||
if (enum_thorough_typeunsafe.repeatTest(repeat.end) != 3) throw new RuntimeException("repeatTest 6 failed");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typeint) != 10) throw new RuntimeException("differentTypes 1 failed");
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typeboolfalse) != 0) throw new RuntimeException("differentTypes 2 failed");
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typebooltrue) != 1) throw new RuntimeException("differentTypes 3 failed");
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typebooltwo) != 2) throw new RuntimeException("differentTypes 4 failed");
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typechar) != 'C') throw new RuntimeException("differentTypes 5 failed");
|
||||
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typedefaultint) != 'D') throw new RuntimeException("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough_typeunsafe.global_typeint;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough_typeunsafe.global_typeboolfalse;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough_typeunsafe.global_typebooltrue;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough_typeunsafe.global_typebooltwo;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough_typeunsafe.global_typechar;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_typeunsafe.global_typedefaultint;
|
||||
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
53
Examples/test-suite/java/friends_runme.java
Normal file
53
Examples/test-suite/java/friends_runme.java
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import friends.*;
|
||||
|
||||
public class friends_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("friends");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) throws Throwable
|
||||
{
|
||||
A a = new A(2);
|
||||
|
||||
if (friends.get_val1(a) != 2)
|
||||
throw new RuntimeException("failed");
|
||||
if (friends.get_val2(a) != 4)
|
||||
throw new RuntimeException("failed");
|
||||
if (friends.get_val3(a) != 6)
|
||||
throw new RuntimeException("failed");
|
||||
|
||||
// nice overload working fine
|
||||
if (friends.get_val1(1,2,3) != 1)
|
||||
throw new RuntimeException("failed");
|
||||
|
||||
B b = new B(3);
|
||||
|
||||
// David's case
|
||||
if (friends.mix(a,b) != 5)
|
||||
throw new RuntimeException("failed");
|
||||
|
||||
D_d di = new D_d(2);
|
||||
D_d dd = new D_d(3.3);
|
||||
|
||||
// incredible template overloading working just fine
|
||||
if (friends.get_val1(di) != 2)
|
||||
throw new RuntimeException("failed");
|
||||
if (friends.get_val1(dd) != 3.3)
|
||||
throw new RuntimeException("failed");
|
||||
|
||||
friends.set(di, 4);
|
||||
friends.set(dd, 1.3);
|
||||
|
||||
if (friends.get_val1(di) != 4)
|
||||
throw new RuntimeException("failed");
|
||||
if (friends.get_val1(dd) != 1.3)
|
||||
throw new RuntimeException("failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ public class nspace_runme {
|
|||
throw new RuntimeException("Transmission2 wrong");
|
||||
|
||||
// turn feature off / ignoring
|
||||
nspacePackage.Outer.nspace ns = new nspacePackage.Outer.nspace();
|
||||
nspacePackage.Outer.namespce ns = new nspacePackage.Outer.namespce();
|
||||
nspacePackage.NoNSpacePlease nons = new nspacePackage.NoNSpacePlease();
|
||||
|
||||
// Derived class
|
||||
|
|
|
|||
|
|
@ -19,5 +19,8 @@ public class pointer_reference_runme {
|
|||
Struct ss = new Struct(20);
|
||||
pointer_reference.set(ss);
|
||||
if (Struct.getInstance().getValue() != 20) throw new RuntimeException("set test failed");
|
||||
|
||||
if (pointer_reference.overloading(1) != 111) throw new RuntimeException("overload test 1 failed");
|
||||
if (pointer_reference.overloading(ss) != 222) throw new RuntimeException("overload test 2 failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
14
Examples/test-suite/java/rename_pcre_encoder_runme.java
Normal file
14
Examples/test-suite/java/rename_pcre_encoder_runme.java
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import rename_pcre_encoder.*;
|
||||
|
||||
public class rename_pcre_encoder_runme {
|
||||
static { System.loadLibrary("rename_pcre_encoder"); }
|
||||
|
||||
public static void main(String argv[])
|
||||
{
|
||||
SomeWidget w = new SomeWidget();
|
||||
w.putBorderWidth(17);
|
||||
if ( w.getBorderWidth() != 17 )
|
||||
throw new RuntimeException(String.format("Border with should be 17, not %d",
|
||||
w.getBorderWidth()));
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ public class rname_runme {
|
|||
throw new RuntimeException("base.newname");
|
||||
|
||||
RenamedDerived derived = new RenamedDerived();
|
||||
derived.func(base, base, base);
|
||||
derived.Xfunc(base, base, base);
|
||||
if (!derived.newname(10.0).equals("Derived"))
|
||||
throw new RuntimeException("derived.newname");
|
||||
}
|
||||
|
|
|
|||
19
Examples/test-suite/java/typemap_arrays_runme.java
Normal file
19
Examples/test-suite/java/typemap_arrays_runme.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import typemap_arrays.*;
|
||||
|
||||
public class typemap_arrays_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("typemap_arrays");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
if (typemap_arrays.sumA(null) != 60)
|
||||
throw new RuntimeException("Sum is wrong");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -19,7 +19,9 @@ public class wallkw_runme {
|
|||
throw new RuntimeException("delegate keyword fail");
|
||||
if (!wallkw._pass().equals("pass"))
|
||||
throw new RuntimeException("pass keyword fail");
|
||||
if (!wallkw.C_alias().equals("alias"))
|
||||
if (!wallkw._alias().equals("alias"))
|
||||
throw new RuntimeException("alias keyword fail");
|
||||
if (!wallkw.C_rescue().equals("rescue"))
|
||||
throw new RuntimeException("rescue keyword fail");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue