Merge branch 'master' into doxygen
Fix the usual conflicts in autodoc unit test due to fixing the divergences in autodoc generation between builtin and default cases in this branch.
This commit is contained in:
commit
db65ae5aea
371 changed files with 9815 additions and 3191 deletions
|
|
@ -43,6 +43,7 @@ CPP_TEST_CASES = \
|
|||
java_throws \
|
||||
java_typemaps_proxy \
|
||||
java_typemaps_typewrapper \
|
||||
li_std_list \
|
||||
# li_boost_intrusive_ptr
|
||||
|
||||
CPP11_TEST_CASES = \
|
||||
|
|
|
|||
59
Examples/test-suite/java/class_scope_namespace_runme.java
Normal file
59
Examples/test-suite/java/class_scope_namespace_runme.java
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
|
||||
import class_scope_namespace.*;
|
||||
|
||||
public class class_scope_namespace_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("class_scope_namespace");
|
||||
} 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[])
|
||||
{
|
||||
A a = new A();
|
||||
B b = new B();
|
||||
C c = new C();
|
||||
D d = new D();
|
||||
E e = new E();
|
||||
F f = new F();
|
||||
G g = new G();
|
||||
H.HH h = new H.HH();
|
||||
I.II i = new I.II();
|
||||
J j = new J();
|
||||
K k = new K();
|
||||
L l = new L();
|
||||
M m = new M();
|
||||
|
||||
a.aa(a, a, a);
|
||||
b.bb(b, b);
|
||||
c.cc(c, c);
|
||||
d.dd(d, d, d);
|
||||
e.ee(e, e, e);
|
||||
f.ff(f, f, f, f);
|
||||
g.gg(g, g);
|
||||
h.hh(h);
|
||||
i.ii(i, i);
|
||||
j.jj(j, j, j);
|
||||
k.kk(k, k, k);
|
||||
l.ll(l, l, l);
|
||||
m.mm(m, m, m);
|
||||
|
||||
class_scope_namespace.aaa(a, a, a);
|
||||
class_scope_namespace.bbb(b, b);
|
||||
class_scope_namespace.ccc(c, c);
|
||||
class_scope_namespace.ddd(d, d, d);
|
||||
class_scope_namespace.eee(e, e, e);
|
||||
class_scope_namespace.fff(f, f, f, f);
|
||||
class_scope_namespace.ggg(g, g);
|
||||
class_scope_namespace.hhh(h);
|
||||
class_scope_namespace.iii(i, i);
|
||||
class_scope_namespace.jjj(j, j, j);
|
||||
class_scope_namespace.kkk(k, k, k);
|
||||
class_scope_namespace.lll(l, l, l);
|
||||
class_scope_namespace.mmm(m, m, m);
|
||||
}
|
||||
}
|
||||
56
Examples/test-suite/java/cpp11_ref_qualifiers_runme.java
Normal file
56
Examples/test-suite/java/cpp11_ref_qualifiers_runme.java
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
|
||||
import cpp11_ref_qualifiers.*;
|
||||
|
||||
public class cpp11_ref_qualifiers_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("cpp11_ref_qualifiers");
|
||||
} 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[]) {
|
||||
Host h = new Host();
|
||||
|
||||
// Basic testing
|
||||
h.h1();
|
||||
h.h2();
|
||||
h.h6();
|
||||
h.h7();
|
||||
|
||||
h.h();
|
||||
|
||||
// %feature testing
|
||||
Features f = new Features();
|
||||
if (!f.F1().equals("F1")) throw new RuntimeException("Fail");
|
||||
if (!f.F2().equals("F2")) throw new RuntimeException("Fail");
|
||||
if (!f.F3().equals("F3")) throw new RuntimeException("Fail");
|
||||
|
||||
if (!f.C1(0).equals("C1")) throw new RuntimeException("Fail");
|
||||
if (!f.C2(0).equals("C2")) throw new RuntimeException("Fail");
|
||||
if (!f.C3(0).equals("C3")) throw new RuntimeException("Fail");
|
||||
|
||||
// %rename testing
|
||||
Renames r = new Renames();
|
||||
r.RR1();
|
||||
r.RR2();
|
||||
r.RR3();
|
||||
|
||||
r.SS1(0);
|
||||
r.SS2(0);
|
||||
r.SS3(0);
|
||||
|
||||
// Conversion operators
|
||||
String s = null;
|
||||
ConversionOperators co = new ConversionOperators();
|
||||
s = co.StringConvertCopy();
|
||||
s = co.StringConvertMove();
|
||||
|
||||
ConversionOperators2 co2 = new ConversionOperators2();
|
||||
s = co2.StringConvertMove();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
import cpp11_ref_qualifiers_rvalue_unignore.*;
|
||||
|
||||
public class cpp11_ref_qualifiers_rvalue_unignore_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("cpp11_ref_qualifiers_rvalue_unignore");
|
||||
} 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[]) {
|
||||
new RefQualifier().m1();
|
||||
new RefQualifier().m2();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
import cpp11_ref_qualifiers_typemaps.*;
|
||||
|
||||
public class cpp11_ref_qualifiers_typemaps_runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("cpp11_ref_qualifiers_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[])
|
||||
{
|
||||
{
|
||||
TypemapsNamedParms tm = new TypemapsNamedParms();
|
||||
if (tm.fff(cpp11_ref_qualifiers_typemaps.FF1_MFP) != 2)
|
||||
throw new RuntimeException("failed");
|
||||
if (tm.ccc(cpp11_ref_qualifiers_typemaps.CC4_MFP) != 5)
|
||||
throw new RuntimeException("failed");
|
||||
if (tm.ggg(cpp11_ref_qualifiers_typemaps.GG7_MFP) != 8)
|
||||
throw new RuntimeException("failed");
|
||||
if (tm.hhh(cpp11_ref_qualifiers_typemaps.HH10_MFP) != 11)
|
||||
throw new RuntimeException("failed");
|
||||
}
|
||||
{
|
||||
TypemapsUnnamedParms tm = new TypemapsUnnamedParms();
|
||||
if (tm.fff(cpp11_ref_qualifiers_typemaps.FF1_MFP) != 3)
|
||||
throw new RuntimeException("failed");
|
||||
if (tm.ccc(cpp11_ref_qualifiers_typemaps.CC4_MFP) != 6)
|
||||
throw new RuntimeException("failed");
|
||||
if (tm.ggg(cpp11_ref_qualifiers_typemaps.GG7_MFP) != 9)
|
||||
throw new RuntimeException("failed");
|
||||
if (tm.hhh(cpp11_ref_qualifiers_typemaps.HH10_MFP) != 12)
|
||||
throw new RuntimeException("failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
Examples/test-suite/java/cpp11_template_typedefs_runme.java
Normal file
19
Examples/test-suite/java/cpp11_template_typedefs_runme.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import cpp11_template_typedefs.*;
|
||||
|
||||
public class cpp11_template_typedefs_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("cpp11_template_typedefs");
|
||||
} 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 alloc1 = cpp11_template_typedefs.get_bucket_allocator1();
|
||||
int alloc2 = cpp11_template_typedefs.get_bucket_allocator2();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class java_director_assumeoverride_runme {
|
|||
public static void main(String argv[]) {
|
||||
OverrideMe overrideMe = new MyOverrideMe();
|
||||
|
||||
// MyOverrideMe doesn't actually override func(), but because assumeoverride
|
||||
// MyOverrideMe doesn't actually override funk(), but because assumeoverride
|
||||
// was set to true, the C++ side will believe it was overridden.
|
||||
if (!java_director_assumeoverride.isFuncOverridden(overrideMe)) {
|
||||
throw new RuntimeException ( "isFuncOverridden()" );
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
180
Examples/test-suite/java/li_std_list_runme.java
Normal file
180
Examples/test-suite/java/li_std_list_runme.java
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
import li_std_list.*;
|
||||
|
||||
public class li_std_list_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("li_std_list");
|
||||
} 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
|
||||
{
|
||||
IntList v1 = new IntList();
|
||||
DoubleList v2 = new DoubleList();
|
||||
|
||||
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");
|
||||
|
||||
int sum = 0;
|
||||
for (int n : v1) {
|
||||
if (n != 123) throw new RuntimeException("v1 loop test failed");
|
||||
sum += n;
|
||||
}
|
||||
if (sum != 123) throw new RuntimeException("v1 sum test failed");
|
||||
if (v1.get(0) != 123) throw new RuntimeException("v1 test failed");
|
||||
v1.clear();
|
||||
if (!v1.isEmpty()) throw new RuntimeException("v1 test clear failed");
|
||||
v1.add(123);
|
||||
|
||||
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");
|
||||
|
||||
if (new IntList(3).size() != 3) throw new RuntimeException("constructor initial size test failed");
|
||||
for (int n : new IntList(10, 999))
|
||||
if (n != 999) throw new RuntimeException("constructor initialization with value failed");
|
||||
for (int n : new IntList(new IntList(10, 999)))
|
||||
if (n != 999) throw new RuntimeException("copy constructor initialization with value failed");
|
||||
|
||||
StructList v4 = new StructList();
|
||||
StructPtrList v5 = new StructPtrList();
|
||||
StructConstPtrList v6 = new StructConstPtrList();
|
||||
|
||||
v4.add(new Struct(12));
|
||||
v5.add(new Struct(34));
|
||||
v6.add(new Struct(56));
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
StructList v7 = li_std_list.CopyContainerStruct(new StructList());
|
||||
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");
|
||||
}
|
||||
|
||||
BoolList v8 = new BoolList();
|
||||
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));
|
||||
BoolList bv = new BoolList(java.util.Arrays.asList(true, false, true, false));
|
||||
BoolList bv2 = new BoolList(bl);
|
||||
java.util.ArrayList<Boolean> bl2 = new java.util.ArrayList<Boolean>(bv);
|
||||
boolean bbb1 = bv.get(0);
|
||||
Boolean bbb2 = bv.get(0);
|
||||
|
||||
IntList v9 = new IntList(java.util.Arrays.asList(10, 20, 30, 40));
|
||||
v9.add(50);
|
||||
v9.add(60);
|
||||
v9.add(70);
|
||||
if (v9.size() != 7) throw new RuntimeException("v9 test (1) failed");
|
||||
if (!v9.remove(new Integer(60))) throw new RuntimeException("v9 test (2) failed");
|
||||
if (v9.size() != 6) throw new RuntimeException("v9 test (3) failed");
|
||||
v9.addFirst(-10);
|
||||
v9.addLast(80);
|
||||
if (v9.size() != 8) throw new RuntimeException("v9 test (4) failed");
|
||||
if (v9.get(0) != -10) throw new RuntimeException("v9 test (5) failed");;
|
||||
if (v9.get(v9.size()-1) != 80) throw new RuntimeException("v9 test (6) failed");;
|
||||
v9.removeFirst();
|
||||
if (v9.get(0) != 10) throw new RuntimeException("v9 test (7) failed");;
|
||||
v9.removeLast();
|
||||
if (v9.size() != 6) throw new RuntimeException("v9 test (8) failed");
|
||||
if (v9.get(v9.size()-1) != 70) throw new RuntimeException("v9 test (9) failed");;
|
||||
|
||||
IntList v10 = new IntList(java.util.Arrays.asList(10, 20, 30, 40, 50));
|
||||
v10.subList(1, 4).clear(); // Recommended way to call protected method removeRange(1,3)
|
||||
if (v10.size() != 2) throw new RuntimeException("v10 test (1) failed");
|
||||
if (v10.get(0) != 10) throw new RuntimeException("v10 test (2) failed");
|
||||
if (v10.get(1) != 50) throw new RuntimeException("v10 test (3) failed");
|
||||
v10.addAll(1, java.util.Arrays.asList(22, 33));
|
||||
if (v10.size() != 4) throw new RuntimeException("v10 test (4) failed");
|
||||
if (v10.get(1) != 22) throw new RuntimeException("v10 test (5) failed");
|
||||
if (v10.get(2) != 33) throw new RuntimeException("v10 test (6) failed");
|
||||
|
||||
v10.add(v10.size(), 55);
|
||||
if (v10.size() != 5) throw new RuntimeException("v10 test (7) failed");
|
||||
if (v10.get(4) != 55) throw new RuntimeException("v10 test (8) failed");
|
||||
|
||||
IntList v11 = new IntList(java.util.Arrays.asList(11, 22, 33, 44));
|
||||
v11.listIterator(0);
|
||||
v11.listIterator(v11.size());
|
||||
try {
|
||||
v11.listIterator(v11.size() + 1);
|
||||
throw new RuntimeException("v11 test (1) failed");
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
}
|
||||
try {
|
||||
v11.listIterator(-1);
|
||||
throw new RuntimeException("v11 test (2) failed");
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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,48 @@ 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.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");
|
||||
|
||||
int sum = 0;
|
||||
for (int n : v1) {
|
||||
if (n != 123) throw new RuntimeException("v1 loop test failed");
|
||||
sum += n;
|
||||
}
|
||||
if (sum != 123) throw new RuntimeException("v1 sum test failed");
|
||||
if (v1.get(0) != 123) throw new RuntimeException("v1 test failed");
|
||||
v1.clear();
|
||||
if (!v1.isEmpty()) throw new RuntimeException("v1 test clear failed");
|
||||
v1.add(123);
|
||||
|
||||
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");
|
||||
|
||||
if (new IntVector(3).size() != 3) throw new RuntimeException("constructor initial size test failed");
|
||||
for (int n : new IntVector(10, 999))
|
||||
if (n != 999) throw new RuntimeException("constructor initialization with value failed");
|
||||
for (int n : new IntVector(new IntVector(10, 999)))
|
||||
if (n != 999) throw new RuntimeException("copy constructor initialization with value failed");
|
||||
|
||||
StructVector v4 = li_std_vector.vecstruct(new StructVector());
|
||||
StructPtrVector v5 = li_std_vector.vecstructptr(new StructPtrVector());
|
||||
|
|
@ -28,9 +68,104 @@ 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);
|
||||
|
||||
IntVector v9 = new IntVector(java.util.Arrays.asList(10, 20, 30, 40));
|
||||
v9.add(50);
|
||||
v9.add(60);
|
||||
v9.add(70);
|
||||
if (v9.size() != 7) throw new RuntimeException("v9 test (1) failed");
|
||||
if (!v9.remove(new Integer(60))) throw new RuntimeException("v9 test (2) failed");
|
||||
if (v9.size() != 6) throw new RuntimeException("v9 test (3) failed");
|
||||
|
||||
IntVector v10 = new IntVector(java.util.Arrays.asList(10, 20, 30, 40, 50));
|
||||
v10.subList(1, 4).clear(); // Recommended way to call protected method removeRange(1,3)
|
||||
if (v10.size() != 2) throw new RuntimeException("v10 test (1) failed");
|
||||
if (v10.get(0) != 10) throw new RuntimeException("v10 test (2) failed");
|
||||
if (v10.get(1) != 50) throw new RuntimeException("v10 test (3) failed");
|
||||
v10.addAll(1, java.util.Arrays.asList(22, 33));
|
||||
if (v10.size() != 4) throw new RuntimeException("v10 test (4) failed");
|
||||
if (v10.get(1) != 22) throw new RuntimeException("v10 test (5) failed");
|
||||
if (v10.get(2) != 33) throw new RuntimeException("v10 test (6) failed");
|
||||
|
||||
v10.add(v10.size(), 55);
|
||||
if (v10.size() != 5) throw new RuntimeException("v10 test (7) failed");
|
||||
if (v10.get(4) != 55) throw new RuntimeException("v10 test (8) failed");
|
||||
|
||||
IntVector v11 = new IntVector(java.util.Arrays.asList(11, 22, 33, 44));
|
||||
v11.listIterator(0);
|
||||
v11.listIterator(v11.size());
|
||||
try {
|
||||
v11.listIterator(v11.size() + 1);
|
||||
throw new RuntimeException("v11 test (1) failed");
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
}
|
||||
try {
|
||||
v11.listIterator(-1);
|
||||
throw new RuntimeException("v11 test (2) failed");
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
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) {
|
||||
|
|
|
|||
26
Examples/test-suite/java/namespace_chase_runme.java
Normal file
26
Examples/test-suite/java/namespace_chase_runme.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
import namespace_chase.*;
|
||||
|
||||
public class namespace_chase_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("namespace_chase");
|
||||
} 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[])
|
||||
{
|
||||
Struct1A s1a = new Struct1A();
|
||||
Struct1B s1b = new Struct1B();
|
||||
Struct1C s1c = new Struct1C();
|
||||
|
||||
namespace_chase.sss3a(s1a, s1b, s1c);
|
||||
namespace_chase.sss3b(s1a, s1b, s1c);
|
||||
// needs fixing
|
||||
// namespace_chase.sss3c(s1a, s1b, s1c);
|
||||
}
|
||||
}
|
||||
32
Examples/test-suite/java/namespace_template_runme.java
Normal file
32
Examples/test-suite/java/namespace_template_runme.java
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
import namespace_template.*;
|
||||
|
||||
public class namespace_template_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("namespace_template");
|
||||
} 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[]) {
|
||||
vectorchar vc = new vectorchar();
|
||||
vectorshort vs = new vectorshort();
|
||||
vectorint vi = new vectorint();
|
||||
vectorlong vl = new vectorlong();
|
||||
|
||||
vc.blah((char)10);
|
||||
vs.blah((short)10);
|
||||
vi.blah(10);
|
||||
vl.blah(10);
|
||||
|
||||
vc.vectoruse(vc, vc);
|
||||
vs.vectoruse(vs, vs);
|
||||
vi.vectoruse(vi, vi);
|
||||
vl.vectoruse(vl, vl);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
import template_parameters_global_scope.*;
|
||||
|
||||
public class template_parameters_global_scope_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_parameters_global_scope");
|
||||
} 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 alloc = 0;
|
||||
|
||||
// Check 1
|
||||
alloc = template_parameters_global_scope.Bucket1();
|
||||
alloc = template_parameters_global_scope.Bucket2();
|
||||
alloc = template_parameters_global_scope.Bucket3();
|
||||
alloc = template_parameters_global_scope.Bucket4();
|
||||
alloc = template_parameters_global_scope.Bucket5();
|
||||
alloc = template_parameters_global_scope.Bucket6();
|
||||
|
||||
// Check 2
|
||||
alloc = template_parameters_global_scope.Spade1();
|
||||
alloc = template_parameters_global_scope.Spade2();
|
||||
alloc = template_parameters_global_scope.Spade3();
|
||||
alloc = template_parameters_global_scope.Spade4();
|
||||
alloc = template_parameters_global_scope.Spade5();
|
||||
alloc = template_parameters_global_scope.Spade6();
|
||||
|
||||
// Check 3
|
||||
alloc = template_parameters_global_scope.Ball1();
|
||||
alloc = template_parameters_global_scope.Ball2();
|
||||
alloc = template_parameters_global_scope.Ball3();
|
||||
alloc = template_parameters_global_scope.Ball4();
|
||||
alloc = template_parameters_global_scope.Ball5();
|
||||
alloc = template_parameters_global_scope.Ball6();
|
||||
|
||||
// Check 4
|
||||
alloc = template_parameters_global_scope.Bat1();
|
||||
alloc = template_parameters_global_scope.Bat2();
|
||||
alloc = template_parameters_global_scope.Bat3();
|
||||
alloc = template_parameters_global_scope.Bat4();
|
||||
alloc = template_parameters_global_scope.Bat5();
|
||||
alloc = template_parameters_global_scope.Bat6();
|
||||
|
||||
// Check 5
|
||||
alloc = template_parameters_global_scope.Chair1();
|
||||
alloc = template_parameters_global_scope.Chair2();
|
||||
alloc = template_parameters_global_scope.Chair3();
|
||||
alloc = template_parameters_global_scope.Chair4();
|
||||
alloc = template_parameters_global_scope.Chair5();
|
||||
alloc = template_parameters_global_scope.Chair6();
|
||||
|
||||
// Check 6
|
||||
alloc = template_parameters_global_scope.Table1();
|
||||
alloc = template_parameters_global_scope.Table2();
|
||||
alloc = template_parameters_global_scope.Table3();
|
||||
alloc = template_parameters_global_scope.Table4();
|
||||
alloc = template_parameters_global_scope.Table5();
|
||||
alloc = template_parameters_global_scope.Table6();
|
||||
|
||||
/*
|
||||
alloc = template_parameters_global_scope.rejig1();
|
||||
alloc = template_parameters_global_scope.rejig2();
|
||||
alloc = template_parameters_global_scope.rejig3();
|
||||
alloc = template_parameters_global_scope.rejig4();
|
||||
alloc = template_parameters_global_scope.rejig5();
|
||||
alloc = template_parameters_global_scope.rejig6();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
@ -19,32 +19,32 @@ public class template_using_directive_and_declaration_forward_runme {
|
|||
template_using_directive_and_declaration_forward.useit1b(new Thing1Int());
|
||||
template_using_directive_and_declaration_forward.useit1c(new Thing1Int());
|
||||
|
||||
//BROKEN template_using_directive_and_declaration_forward.useit2(new Thing2Int());
|
||||
template_using_directive_and_declaration_forward.useit2(new Thing2Int());
|
||||
template_using_directive_and_declaration_forward.useit2a(new Thing2Int());
|
||||
template_using_directive_and_declaration_forward.useit2b(new Thing2Int());
|
||||
template_using_directive_and_declaration_forward.useit2c(new Thing2Int());
|
||||
template_using_directive_and_declaration_forward.useit2d(new Thing2Int());
|
||||
|
||||
//BROKEN template_using_directive_and_declaration_forward.useit3(new Thing3Int());
|
||||
template_using_directive_and_declaration_forward.useit3(new Thing3Int());
|
||||
template_using_directive_and_declaration_forward.useit3a(new Thing3Int());
|
||||
template_using_directive_and_declaration_forward.useit3b(new Thing3Int());
|
||||
template_using_directive_and_declaration_forward.useit3c(new Thing3Int());
|
||||
template_using_directive_and_declaration_forward.useit3d(new Thing3Int());
|
||||
|
||||
//BROKEN template_using_directive_and_declaration_forward.useit4(new Thing4Int());
|
||||
template_using_directive_and_declaration_forward.useit4(new Thing4Int());
|
||||
template_using_directive_and_declaration_forward.useit4a(new Thing4Int());
|
||||
template_using_directive_and_declaration_forward.useit4b(new Thing4Int());
|
||||
template_using_directive_and_declaration_forward.useit4c(new Thing4Int());
|
||||
template_using_directive_and_declaration_forward.useit4d(new Thing4Int());
|
||||
|
||||
//BROKEN template_using_directive_and_declaration_forward.useit5(new Thing5Int());
|
||||
template_using_directive_and_declaration_forward.useit5(new Thing5Int());
|
||||
template_using_directive_and_declaration_forward.useit5a(new Thing5Int());
|
||||
template_using_directive_and_declaration_forward.useit5b(new Thing5Int());
|
||||
template_using_directive_and_declaration_forward.useit5c(new Thing5Int());
|
||||
template_using_directive_and_declaration_forward.useit5d(new Thing5Int());
|
||||
|
||||
|
||||
//BROKEN template_using_directive_and_declaration_forward.useit7(new Thing7Int());
|
||||
template_using_directive_and_declaration_forward.useit7(new Thing7Int());
|
||||
template_using_directive_and_declaration_forward.useit7a(new Thing7Int());
|
||||
template_using_directive_and_declaration_forward.useit7b(new Thing7Int());
|
||||
template_using_directive_and_declaration_forward.useit7c(new Thing7Int());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
import template_using_directive_typedef.*;
|
||||
|
||||
public class template_using_directive_typedef_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_using_directive_typedef");
|
||||
} 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[]) {
|
||||
Vector_Obj vo = new Vector_Obj();
|
||||
|
||||
Holder h = new Holder();
|
||||
h.holder_use1(vo, vo, vo);
|
||||
h.holder_use2(vo, vo, vo);
|
||||
h.holder_use3(vo, vo, vo);
|
||||
|
||||
template_using_directive_typedef.tns_holder_use(vo, vo);
|
||||
template_using_directive_typedef.tns_use(vo, vo, vo);
|
||||
template_using_directive_typedef.global_holder_use(vo);
|
||||
template_using_directive_typedef.global_use(vo, vo, vo);
|
||||
template_using_directive_typedef.ns1_holder_use(vo);
|
||||
template_using_directive_typedef.ns2_holder_use(vo, vo, vo, vo);
|
||||
}
|
||||
}
|
||||
|
||||
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