Merge branch 'master' into javalist
This commit is contained in:
commit
4db1300622
798 changed files with 26703 additions and 7774 deletions
|
|
@ -28,6 +28,7 @@ CPP_TEST_CASES = \
|
|||
java_director_exception_feature \
|
||||
java_director_exception_feature_nspace \
|
||||
java_director_ptrclass \
|
||||
java_director_typemaps \
|
||||
java_enums \
|
||||
java_jnitypes \
|
||||
java_lib_arrays_dimensionless \
|
||||
|
|
|
|||
|
|
@ -33,6 +33,19 @@ public class director_smartptr_runme {
|
|||
director_smartptr.Foo myFoo2 = new director_smartptr.Foo().makeFoo();
|
||||
check(myFoo2.pong(), "Foo::pong();Foo::ping()");
|
||||
check(director_smartptr.Foo.callPong(myFoo2), "Foo::pong();Foo::ping()");
|
||||
|
||||
director_smartptr.FooDerived myBarFooDerived = new director_smartptr_MyBarFooDerived();
|
||||
check(myBarFooDerived.ping(), "director_smartptr_MyBarFooDerived.ping()");
|
||||
check(director_smartptr.FooDerived.callPong(myBarFooDerived), "director_smartptr_MyBarFooDerived.pong();director_smartptr_MyBarFooDerived.ping()");
|
||||
check(director_smartptr.FooDerived.callUpcall(myBarFooDerived, fooBar), "overrideDerived;Bar::Foo2::Foo2Bar()");
|
||||
|
||||
director_smartptr.Foo myFoo3 = myBarFoo.makeFoo();
|
||||
myFoo3.swigReleaseOwnership();
|
||||
myFoo3.swigTakeOwnership();
|
||||
director_smartptr.FooDerived myBarFooDerived2 = new director_smartptr_MyBarFooDerived();
|
||||
myBarFooDerived2.swigReleaseOwnership();
|
||||
myBarFooDerived2.swigTakeOwnership();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -58,3 +71,26 @@ class director_smartptr_MyBarFoo extends director_smartptr.Foo {
|
|||
return new director_smartptr.Foo();
|
||||
}
|
||||
}
|
||||
|
||||
class director_smartptr_MyBarFooDerived extends director_smartptr.FooDerived {
|
||||
|
||||
@Override
|
||||
public String ping() {
|
||||
return "director_smartptr_MyBarFooDerived.ping()";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String pong() {
|
||||
return "director_smartptr_MyBarFooDerived.pong();" + ping();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upcall(director_smartptr.FooBar fooBarPtr) {
|
||||
return "overrideDerived;" + fooBarPtr.FooBarDo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public director_smartptr.Foo makeFoo() {
|
||||
return new director_smartptr.Foo();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
63
Examples/test-suite/java/extend_template_method_runme.java
Normal file
63
Examples/test-suite/java/extend_template_method_runme.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
|
||||
import extend_template_method.*;
|
||||
|
||||
public class extend_template_method_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("extend_template_method");
|
||||
} 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[]) {
|
||||
{
|
||||
ExtendMe em = new ExtendMe();
|
||||
|
||||
{
|
||||
double ret_double = em.do_stuff_double(1, 1.1);
|
||||
if (ret_double != 1.1)
|
||||
throw new RuntimeException("double failed " + ret_double);
|
||||
String ret_string = em.do_stuff_string(1, "hello there");
|
||||
if (!ret_string.equals("hello there"))
|
||||
throw new RuntimeException("string failed " + ret_string);
|
||||
}
|
||||
{
|
||||
double ret_double = em.do_overloaded_stuff(1.1);
|
||||
if (ret_double != 1.1)
|
||||
throw new RuntimeException("double failed " + ret_double);
|
||||
String ret_string = em.do_overloaded_stuff("hello there");
|
||||
if (!ret_string.equals("hello there"))
|
||||
throw new RuntimeException("string failed " + ret_string);
|
||||
}
|
||||
if (ExtendMe.static_method(123) != 123)
|
||||
throw new RuntimeException("static_method failed");
|
||||
ExtendMe em2 = new ExtendMe(123);
|
||||
}
|
||||
{
|
||||
TemplateExtend em = new TemplateExtend();
|
||||
|
||||
{
|
||||
double ret_double = em.do_template_stuff_double(1, 1.1);
|
||||
if (ret_double != 1.1)
|
||||
throw new RuntimeException("double failed " + ret_double);
|
||||
String ret_string = em.do_template_stuff_string(1, "hello there");
|
||||
if (!ret_string.equals("hello there"))
|
||||
throw new RuntimeException("string failed " + ret_string);
|
||||
}
|
||||
{
|
||||
double ret_double = em.do_template_overloaded_stuff(1.1);
|
||||
if (ret_double != 1.1)
|
||||
throw new RuntimeException("double failed " + ret_double);
|
||||
String ret_string = em.do_template_overloaded_stuff("hello there");
|
||||
if (!ret_string.equals("hello there"))
|
||||
throw new RuntimeException("string failed " + ret_string);
|
||||
}
|
||||
if (TemplateExtend.static_template_method(123) != 123)
|
||||
throw new RuntimeException("static_template_method failed");
|
||||
TemplateExtend em2 = new TemplateExtend(123);
|
||||
}
|
||||
}
|
||||
}
|
||||
151
Examples/test-suite/java/java_director_typemaps_runme.java
Normal file
151
Examples/test-suite/java/java_director_typemaps_runme.java
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// tests for java/typemaps.i used for directors
|
||||
|
||||
import java_director_typemaps.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class java_director_typemaps_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("java_director_typemaps");
|
||||
} 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[]) {
|
||||
Quux quux = new java_director_typemaps_MyQuux();
|
||||
quux.etest();
|
||||
}
|
||||
}
|
||||
|
||||
class java_director_typemaps_MyQuux extends Quux {
|
||||
public java_director_typemaps_MyQuux() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void director_method_bool_output(
|
||||
boolean[] bool_arg,
|
||||
|
||||
byte[] signed_char_arg,
|
||||
short[] unsigned_char_arg,
|
||||
|
||||
short[] short_arg,
|
||||
int[] unsigned_short_arg,
|
||||
|
||||
int[] int_arg,
|
||||
long[] unsigned_int_arg,
|
||||
|
||||
int[] long_arg,
|
||||
long[] unsigned_long_arg,
|
||||
|
||||
long[] long_long_arg,
|
||||
// BigInteger[] unsigned_long_long_arg,
|
||||
|
||||
float[] float_arg,
|
||||
double[] double_arg)
|
||||
{
|
||||
bool_arg[0] = true;
|
||||
signed_char_arg[0] = 1;
|
||||
unsigned_char_arg[0] = 2;
|
||||
short_arg[0] = 3;
|
||||
unsigned_short_arg[0] = 4;
|
||||
int_arg[0] = 5;
|
||||
unsigned_int_arg[0] = 6;
|
||||
long_arg[0] = 7;
|
||||
unsigned_long_arg[0] = 8;
|
||||
long_long_arg[0] = 9;
|
||||
// unsigned_long_long_arg[0] = 10;
|
||||
float_arg[0] = 11;
|
||||
double_arg[0] = 12;
|
||||
}
|
||||
|
||||
public void director_method_bool_inout(
|
||||
boolean[] bool_arg,
|
||||
|
||||
byte[] signed_char_arg,
|
||||
short[] unsigned_char_arg,
|
||||
|
||||
short[] short_arg,
|
||||
int[] unsigned_short_arg,
|
||||
|
||||
int[] int_arg,
|
||||
long[] unsigned_int_arg,
|
||||
|
||||
int[] long_arg,
|
||||
long[] unsigned_long_arg,
|
||||
|
||||
long[] long_long_arg,
|
||||
// BigInteger[] unsigned_long_long_arg,
|
||||
|
||||
float[] float_arg,
|
||||
double[] double_arg)
|
||||
{
|
||||
if (bool_arg[0]) throw new RuntimeException("unexpected value for bool_arg");
|
||||
|
||||
if (signed_char_arg[0] != 101) throw new RuntimeException("unexpected value for signed_char_arg");
|
||||
if (unsigned_char_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_char_arg");
|
||||
if (short_arg[0] != 101) throw new RuntimeException("unexpected value for short_arg");
|
||||
if (unsigned_short_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_short_arg");
|
||||
if (int_arg[0] != 101) throw new RuntimeException("unexpected value for int_arg");
|
||||
if (unsigned_int_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_int_arg");
|
||||
if (long_arg[0] != 101) throw new RuntimeException("unexpected value for long_arg");
|
||||
if (unsigned_long_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_long_arg");
|
||||
if (long_long_arg[0] != 101) throw new RuntimeException("unexpected value for long_long_arg");
|
||||
// if (unsigned_long_long_arg[0] != 101) throw new RuntimeException("unexpected value for unsigned_long_long_arg");
|
||||
if (float_arg[0] != 101) throw new RuntimeException("unexpected value for float_arg");
|
||||
if (double_arg[0] != 101) throw new RuntimeException("unexpected value for double_arg");
|
||||
|
||||
bool_arg[0] = false;
|
||||
signed_char_arg[0] = 11;
|
||||
unsigned_char_arg[0] = 12;
|
||||
short_arg[0] = 13;
|
||||
unsigned_short_arg[0] = 14;
|
||||
int_arg[0] = 15;
|
||||
unsigned_int_arg[0] = 16;
|
||||
long_arg[0] = 17;
|
||||
unsigned_long_arg[0] = 18;
|
||||
long_long_arg[0] = 19;
|
||||
// unsigned_long_long_arg[0] = 110;
|
||||
float_arg[0] = 111;
|
||||
double_arg[0] = 112;
|
||||
}
|
||||
|
||||
public void director_method_bool_nameless_args(
|
||||
boolean[] bool_arg,
|
||||
|
||||
byte[] signed_char_arg,
|
||||
short[] unsigned_char_arg,
|
||||
|
||||
short[] short_arg,
|
||||
int[] unsigned_short_arg,
|
||||
|
||||
int[] int_arg,
|
||||
long[] unsigned_int_arg,
|
||||
|
||||
int[] long_arg,
|
||||
long[] unsigned_long_arg,
|
||||
|
||||
long[] long_long_arg,
|
||||
// BigInteger[] unsigned_long_long_arg,
|
||||
|
||||
float[] float_arg,
|
||||
double[] double_arg)
|
||||
{
|
||||
bool_arg[0] = true;
|
||||
signed_char_arg[0] = 12;
|
||||
unsigned_char_arg[0] = 13;
|
||||
short_arg[0] = 14;
|
||||
unsigned_short_arg[0] = 15;
|
||||
int_arg[0] = 16;
|
||||
unsigned_int_arg[0] = 17;
|
||||
long_arg[0] = 18;
|
||||
unsigned_long_arg[0] = 19;
|
||||
long_long_arg[0] = 20;
|
||||
// unsigned_long_long_arg[0] = 111;
|
||||
float_arg[0] = 112;
|
||||
double_arg[0] = 113;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
public class li_boost_shared_ptr_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("li_boost_shared_ptr");
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
private static void check(String got, String expected) {
|
||||
if (!got.equals(expected))
|
||||
throw new RuntimeException("Failed, got: " + got + " expected: " + expected);
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
li_boost_shared_ptr_director_Derived a = li_boost_shared_ptr_director_Derived.new(false);
|
||||
li_boost_shared_ptr_director_Derived b = li_boost_shared_ptr_director_Derived.new(true);
|
||||
|
||||
check(call_ret_c_shared_ptr(a) == 1);
|
||||
check(call_ret_c_shared_ptr(b) == -1);
|
||||
check(call_ret_c_by_value(a) == 1);
|
||||
|
||||
check(call_take_c_by_value(a) == 5);
|
||||
check(call_take_c_shared_ptr_by_value(a) == 6);
|
||||
check(call_take_c_shared_ptr_by_ref(a) == 7);
|
||||
check(call_take_c_shared_ptr_by_pointer(a) == 8);
|
||||
check(call_take_c_shared_ptr_by_pointer_ref(a) == 9);
|
||||
|
||||
check(call_take_c_shared_ptr_by_value_with_null(a) == -2);
|
||||
check(call_take_c_shared_ptr_by_ref_with_null(a) == -3);
|
||||
check(call_take_c_shared_ptr_by_pointer_with_null(a) == -4);
|
||||
check(call_take_c_shared_ptr_by_pointer_ref_with_null(a) == -5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class li_boost_shared_ptr_director_Derived extends li_boost_shared_ptr_director.Base {
|
||||
|
||||
@Override
|
||||
public String ping() {
|
||||
return "li_boost_shared_ptr_director_MyBarFoo.ping()";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String pong() {
|
||||
return "li_boost_shared_ptr_director_MyBarFoo.pong();" + ping();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upcall(li_boost_shared_ptr_director.FooBar fooBarPtr) {
|
||||
return "override;" + fooBarPtr.FooBarDo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public li_boost_shared_ptr_director.Foo makeFoo() {
|
||||
return new li_boost_shared_ptr_director.Foo();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ public class li_std_vector_runme {
|
|||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("li_std_vector");
|
||||
System.loadLibrary("li_std_vector");
|
||||
} 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);
|
||||
|
|
@ -17,8 +17,34 @@ public class li_std_vector_runme {
|
|||
IntPtrVector v2 = li_std_vector.vecintptr(new IntPtrVector());
|
||||
IntConstPtrVector v3 = li_std_vector.vecintconstptr(new IntConstPtrVector());
|
||||
|
||||
v1.add(123);
|
||||
if (v1.get(0) != 123) throw new RuntimeException("v1 test failed");
|
||||
for (int n : v1) {
|
||||
if (n != 123) throw new RuntimeException("v1 loop test failed");
|
||||
}
|
||||
|
||||
if (!v1.isEmpty()) throw new RuntimeException("v1 test (1) failed");
|
||||
if (v1.size() != 0) throw new RuntimeException("v1 test (2) failed");
|
||||
if (!v1.add(123)) throw new RuntimeException("v1 test (3) failed");
|
||||
if (v1.size() != 1) throw new RuntimeException("v1 test (4) failed");
|
||||
if (v1.isEmpty()) throw new RuntimeException("v1 test (5) failed");
|
||||
if (v1.set(0, 456) != 123) throw new RuntimeException("v1 test (6) failed");
|
||||
if (v1.size() != 1) throw new RuntimeException("v1 test (7) failed");
|
||||
if (v1.get(0) != 456) throw new RuntimeException("v1 test (8) failed");
|
||||
|
||||
java.util.Iterator<Integer> v1_iterator = v1.iterator();
|
||||
if (!v1_iterator.hasNext()) throw new RuntimeException("v1 test (9) failed");
|
||||
if (v1_iterator.next() != 456) throw new RuntimeException("v1 test (10) failed");
|
||||
if (v1_iterator.hasNext()) throw new RuntimeException("v1 test (11) failed");
|
||||
try {
|
||||
v1_iterator.next();
|
||||
throw new RuntimeException("v1 test (12) failed");
|
||||
} catch (java.util.NoSuchElementException e) {
|
||||
}
|
||||
|
||||
if (v1.remove(new Integer(123))) throw new RuntimeException("v1 test (13) failed");
|
||||
if (!v1.remove(new Integer(456))) throw new RuntimeException("v1 test (14) failed");
|
||||
if (!v1.isEmpty()) throw new RuntimeException("v1 test (15) failed");
|
||||
if (v1.size() != 0) throw new RuntimeException("v1 test (16) failed");
|
||||
if (v1.remove(new Integer(456))) throw new RuntimeException("v1 test (17) failed");
|
||||
|
||||
StructVector v4 = li_std_vector.vecstruct(new StructVector());
|
||||
StructPtrVector v5 = li_std_vector.vecstructptr(new StructPtrVector());
|
||||
|
|
@ -28,9 +54,68 @@ public class li_std_vector_runme {
|
|||
v5.add(new Struct(34));
|
||||
v6.add(new Struct(56));
|
||||
|
||||
Struct s = null;
|
||||
if (v4.get(0).getNum() != 12) throw new RuntimeException("v4 test failed");
|
||||
if (v5.get(0).getNum() != 34) throw new RuntimeException("v5 test failed");
|
||||
if (v6.get(0).getNum() != 56) throw new RuntimeException("v6 test failed");
|
||||
|
||||
for (Struct s : v4) {
|
||||
if (s.getNum() != 12) throw new RuntimeException("v4 loop test failed");
|
||||
}
|
||||
for (Struct s : v5) {
|
||||
if (s.getNum() != 34) throw new RuntimeException("v5 loop test failed");
|
||||
}
|
||||
for (Struct s : v6) {
|
||||
if (s.getNum() != 56) throw new RuntimeException("v6 loop test failed");
|
||||
}
|
||||
|
||||
StructVector v7 = li_std_vector.vecstruct(new StructVector());
|
||||
v7.add(new Struct(1));
|
||||
v7.add(new Struct(23));
|
||||
v7.add(new Struct(456));
|
||||
v7.add(new Struct(7890));
|
||||
if (v7.size() != 4) throw new RuntimeException("v7 test (1) failed");
|
||||
{
|
||||
double[] a7 = {1, 23, 456, 7890};
|
||||
int i7 = 0;
|
||||
for (Struct s7 : v7) {
|
||||
if (s7.getNum() != a7[i7]) throw new RuntimeException("v7 test (2) failed");
|
||||
i7++;
|
||||
}
|
||||
if (i7 != a7.length) throw new RuntimeException("v7 test (3) failed");
|
||||
}
|
||||
if (v7.remove(2).getNum() != 456) throw new RuntimeException("v7 test (4) failed");
|
||||
{
|
||||
double[] a7 = {1, 23, 7890};
|
||||
int i7 = 0;
|
||||
for (Struct s7 : v7) {
|
||||
if (s7.getNum() != a7[i7]) throw new RuntimeException("v7 test (5) failed");
|
||||
i7++;
|
||||
}
|
||||
if (i7 != a7.length) throw new RuntimeException("v7 test (6) failed");
|
||||
}
|
||||
v7.add(1, new Struct(123));
|
||||
{
|
||||
double[] a7 = {1, 123, 23, 7890};
|
||||
int i7 = 0;
|
||||
for (Struct s7 : v7) {
|
||||
if (s7.getNum() != a7[i7]) throw new RuntimeException("v7 test (7) failed");
|
||||
i7++;
|
||||
}
|
||||
if (i7 != a7.length) throw new RuntimeException("v7 test (8) failed");
|
||||
}
|
||||
|
||||
BoolVector v8 = new BoolVector();
|
||||
if (!v8.add(true)) throw new RuntimeException("v8 test (1) failed");;
|
||||
if (v8.get(0) != true) throw new RuntimeException("v8 test (2) failed");;
|
||||
if (v8.set(0, false) != true) throw new RuntimeException("v8 test (3) failed");;
|
||||
if (v8.set(0, false) != false) throw new RuntimeException("v8 test (4) failed");;
|
||||
if (v8.size() != 1) throw new RuntimeException("v8 test (5) failed");;
|
||||
|
||||
java.util.ArrayList<Boolean> bl = new java.util.ArrayList<Boolean>(java.util.Arrays.asList(true, false, true, false));
|
||||
BoolVector bv = new BoolVector(java.util.Arrays.asList(true, false, true, false));
|
||||
BoolVector bv2 = new BoolVector(bl);
|
||||
java.util.ArrayList<Boolean> bl2 = new java.util.ArrayList<Boolean>(bv);
|
||||
boolean bbb1 = bv.get(0);
|
||||
Boolean bbb2 = bv.get(0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
60
Examples/test-suite/java/member_pointer_const_runme.java
Normal file
60
Examples/test-suite/java/member_pointer_const_runme.java
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import member_pointer_const.*;
|
||||
|
||||
public class member_pointer_const_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("member_pointer_const");
|
||||
} 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 SWIGTYPE_m_Shape__f_void__double memberPtr = null;
|
||||
|
||||
public static void main(String argv[]) {
|
||||
// Get the pointers
|
||||
|
||||
SWIGTYPE_m_Shape__f_void__double area_pt = member_pointer_const.areapt();
|
||||
SWIGTYPE_m_Shape__f_void__double perim_pt = member_pointer_const.perimeterpt();
|
||||
|
||||
// Create some objects
|
||||
|
||||
Square s = new Square(10);
|
||||
|
||||
// Do some calculations
|
||||
|
||||
check( "Square area ", 100.0, member_pointer_const.do_op(s,area_pt) );
|
||||
check( "Square perim", 40.0, member_pointer_const.do_op(s,perim_pt) );
|
||||
|
||||
memberPtr = member_pointer_const.getAreavar();
|
||||
memberPtr = member_pointer_const.getPerimetervar();
|
||||
|
||||
// Try the variables
|
||||
check( "Square area ", 100.0, member_pointer_const.do_op(s,member_pointer_const.getAreavar()) );
|
||||
check( "Square perim", 40.0, member_pointer_const.do_op(s,member_pointer_const.getPerimetervar()) );
|
||||
|
||||
// Modify one of the variables
|
||||
member_pointer_const.setAreavar(perim_pt);
|
||||
|
||||
check( "Square perimeter", 40.0, member_pointer_const.do_op(s,member_pointer_const.getAreavar()) );
|
||||
|
||||
// Try the constants
|
||||
|
||||
memberPtr = member_pointer_const.AREAPT;
|
||||
memberPtr = member_pointer_const.PERIMPT;
|
||||
memberPtr = member_pointer_const.NULLPT;
|
||||
|
||||
check( "Square area ", 100.0, member_pointer_const.do_op(s,member_pointer_const.AREAPT) );
|
||||
check( "Square perim", 40.0, member_pointer_const.do_op(s,member_pointer_const.PERIMPT) );
|
||||
|
||||
// Typedefs
|
||||
check( "Square perim", 40.0, member_pointer_const.do_op_td(s,perim_pt) );
|
||||
}
|
||||
|
||||
private static void check(String what, double expected, double actual) {
|
||||
if (expected != actual)
|
||||
throw new RuntimeException("Failed: " + what + " Expected: " + expected + " Actual: " + actual);
|
||||
}
|
||||
}
|
||||
|
|
@ -49,6 +49,8 @@ public class member_pointer_runme {
|
|||
check( "Square area ", 100.0, member_pointer.do_op(s,member_pointer.AREAPT) );
|
||||
check( "Square perim", 40.0, member_pointer.do_op(s,member_pointer.PERIMPT) );
|
||||
|
||||
// Typedefs
|
||||
check( "Square perim", 40.0, member_pointer.do_op_td(s,perim_pt) );
|
||||
}
|
||||
|
||||
private static void check(String what, double expected, double actual) {
|
||||
|
|
|
|||
42
Examples/test-suite/java/proxycode_runme.java
Normal file
42
Examples/test-suite/java/proxycode_runme.java
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import proxycode.*;
|
||||
|
||||
public class proxycode_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("proxycode");
|
||||
} 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
|
||||
{
|
||||
if (new Proxy1().proxycode1(100) != 101)
|
||||
throw new RuntimeException("Fail");
|
||||
if (new Proxy2().proxycode2a(100) != 102)
|
||||
throw new RuntimeException("Fail");
|
||||
if (new Proxy2().proxycode2b(100) != 102)
|
||||
throw new RuntimeException("Fail");
|
||||
if (new Proxy3().proxycode3(100) != 103)
|
||||
throw new RuntimeException("Fail");
|
||||
|
||||
if (new Proxy4().proxycode4(100) != 104)
|
||||
throw new RuntimeException("Fail");
|
||||
if (new Proxy4.Proxy4Nested().proxycode4nested(100) != 144)
|
||||
throw new RuntimeException("Fail");
|
||||
|
||||
if (new Proxy5a().proxycode5((short)100) != (short)100)
|
||||
throw new RuntimeException("Fail");
|
||||
if (new Proxy5b().proxycode5(100) != 100)
|
||||
throw new RuntimeException("Fail");
|
||||
if (new Proxy5b().proxycode5(100, 100) != 255)
|
||||
throw new RuntimeException("Fail");
|
||||
|
||||
long t1 = 10;
|
||||
long t2 = 100;
|
||||
Proxy6 p = new Proxy6().proxyUseT(t1, t2);
|
||||
p.useT(t1, t2);
|
||||
}
|
||||
}
|
||||
90
Examples/test-suite/java/rename_wildcard_runme.java
Normal file
90
Examples/test-suite/java/rename_wildcard_runme.java
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
|
||||
import rename_wildcard.*;
|
||||
|
||||
public class rename_wildcard_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("rename_wildcard");
|
||||
} 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[]) {
|
||||
// Wildcard check
|
||||
{
|
||||
new GlobalWildStruct().mm1();
|
||||
new GlobalWildTemplateStructInt().mm1();
|
||||
new SpaceWildStruct().mm1();
|
||||
new SpaceWildTemplateStructInt().mm1();
|
||||
}
|
||||
// No declaration
|
||||
{
|
||||
new GlobalWildStruct().mm2a();
|
||||
new GlobalWildTemplateStructInt().mm2b();
|
||||
new SpaceWildStruct().mm2c();
|
||||
new SpaceWildTemplateStructInt().mm2d();
|
||||
|
||||
new GlobalWildTemplateStructInt().tt2b();
|
||||
new SpaceWildTemplateStructInt().tt2d();
|
||||
}
|
||||
// With declaration
|
||||
{
|
||||
new GlobalWildStruct().mm3a();
|
||||
new GlobalWildTemplateStructInt().mm3b();
|
||||
new SpaceWildStruct().mm3c();
|
||||
new SpaceWildTemplateStructInt().mm3d();
|
||||
|
||||
new GlobalWildTemplateStructInt().tt3b();
|
||||
new SpaceWildTemplateStructInt().tt3d();
|
||||
}
|
||||
// Global override too
|
||||
{
|
||||
new GlobalWildStruct().mm4a();
|
||||
new GlobalWildTemplateStructInt().mm4b();
|
||||
new SpaceWildStruct().mm4c();
|
||||
new SpaceWildTemplateStructInt().mm4d();
|
||||
|
||||
new GlobalWildTemplateStructInt().tt4b();
|
||||
new SpaceWildTemplateStructInt().tt4d();
|
||||
}
|
||||
// %extend renames
|
||||
{
|
||||
new GlobalWildStruct().mm5a();
|
||||
new GlobalWildTemplateStructInt().mm5b();
|
||||
new SpaceWildStruct().mm5c();
|
||||
new SpaceWildTemplateStructInt().mm5d();
|
||||
|
||||
new GlobalWildTemplateStructInt().tt5b();
|
||||
new SpaceWildTemplateStructInt().tt5d();
|
||||
}
|
||||
// operators
|
||||
{
|
||||
new GlobalWildStruct().opinta();
|
||||
new GlobalWildTemplateStructInt().opintb();
|
||||
new SpaceWildStruct().opintc();
|
||||
new SpaceWildTemplateStructInt().opintd();
|
||||
|
||||
new GlobalWildTemplateStructInt().opdoubleb();
|
||||
new SpaceWildTemplateStructInt().opdoubled();
|
||||
}
|
||||
// Wildcard renames expected for these
|
||||
{
|
||||
new NoChangeStruct().mm1();
|
||||
new NoChangeStruct().mm2();
|
||||
new NoChangeStruct().mm3();
|
||||
new NoChangeStruct().mm4();
|
||||
new NoChangeStruct().mm5();
|
||||
new NoChangeStruct().opint();
|
||||
new SpaceNoChangeStruct().mm1();
|
||||
new SpaceNoChangeStruct().mm2();
|
||||
new SpaceNoChangeStruct().mm3();
|
||||
new SpaceNoChangeStruct().mm4();
|
||||
new SpaceNoChangeStruct().mm5();
|
||||
new SpaceNoChangeStruct().opint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
Examples/test-suite/java/smart_pointer_ignore_runme.java
Normal file
19
Examples/test-suite/java/smart_pointer_ignore_runme.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import smart_pointer_ignore.*;
|
||||
|
||||
public class smart_pointer_ignore_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("smart_pointer_ignore");
|
||||
} 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[]) {
|
||||
DerivedPtr d = smart_pointer_ignore.makeDerived();
|
||||
d.baseMethod();
|
||||
d.derivedMethod();
|
||||
}
|
||||
}
|
||||
18
Examples/test-suite/java/template_default_cache_runme.java
Normal file
18
Examples/test-suite/java/template_default_cache_runme.java
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import template_default_cache.*;
|
||||
|
||||
public class template_default_cache_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_default_cache");
|
||||
} 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[]) {
|
||||
AModelPtr ap = template_default_cache.get_mp_a();
|
||||
BModelPtr bp = template_default_cache.get_mp_b();
|
||||
}
|
||||
}
|
||||
34
Examples/test-suite/java/typedef_funcptr_runme.java
Normal file
34
Examples/test-suite/java/typedef_funcptr_runme.java
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
import typedef_funcptr.*;
|
||||
|
||||
public class typedef_funcptr_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("typedef_funcptr");
|
||||
} 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[]) {
|
||||
int a = 100;
|
||||
int b = 10;
|
||||
|
||||
if (typedef_funcptr.do_op(a,b,typedef_funcptr.addf) != 110)
|
||||
throw new RuntimeException("addf failed");
|
||||
if (typedef_funcptr.do_op(a,b,typedef_funcptr.subf) != 90)
|
||||
throw new RuntimeException("subf failed");
|
||||
|
||||
if (typedef_funcptr.do_op_typedef_int(a,b,typedef_funcptr.addf) != 110)
|
||||
throw new RuntimeException("addf failed");
|
||||
if (typedef_funcptr.do_op_typedef_int(a,b,typedef_funcptr.subf) != 90)
|
||||
throw new RuntimeException("subf failed");
|
||||
|
||||
if (typedef_funcptr.do_op_typedef_Integer(a,b,typedef_funcptr.addf) != 110)
|
||||
throw new RuntimeException("addf failed");
|
||||
if (typedef_funcptr.do_op_typedef_Integer(a,b,typedef_funcptr.subf) != 90)
|
||||
throw new RuntimeException("subf failed");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue