Merge branch 'master' into doxygen
Merge with ~3.0.1 sources from master.
This commit is contained in:
commit
1ebd2334b8
1593 changed files with 51732 additions and 28076 deletions
|
|
@ -3,8 +3,8 @@
|
|||
#######################################################################
|
||||
|
||||
LANGUAGE = java
|
||||
JAVA = java
|
||||
JAVAC = javac
|
||||
JAVA = @JAVA@
|
||||
JAVAC = @JAVAC@
|
||||
JAVAFLAGS = -Xcheck:jni
|
||||
SCRIPTSUFFIX = _runme.java
|
||||
srcdir = @srcdir@
|
||||
|
|
@ -27,10 +27,14 @@ CPP_TEST_CASES = \
|
|||
intermediary_classname \
|
||||
java_constants \
|
||||
java_director \
|
||||
java_director_assumeoverride \
|
||||
java_director_exception_feature \
|
||||
java_director_exception_feature_nspace \
|
||||
java_enums \
|
||||
java_jnitypes \
|
||||
java_lib_arrays_dimensionless \
|
||||
java_lib_various \
|
||||
java_jnitypes \
|
||||
java_nspacewithoutpackage \
|
||||
java_pgcpp \
|
||||
java_pragmas \
|
||||
java_prepost \
|
||||
|
|
@ -43,12 +47,16 @@ include $(srcdir)/../common.mk
|
|||
|
||||
# Overridden variables here
|
||||
JAVA_PACKAGE = $*
|
||||
SWIGOPT += -package $(JAVA_PACKAGE)
|
||||
JAVA_PACKAGEOPT = -package $(JAVA_PACKAGE)
|
||||
SWIGOPT += $(JAVA_PACKAGEOPT)
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
java_nspacewithoutpackage.%: JAVA_PACKAGEOPT =
|
||||
java_director_exception_feature_nspace.%: JAVA_PACKAGE = $*Package
|
||||
nspace.%: JAVA_PACKAGE = $*Package
|
||||
nspace_extend.%: JAVA_PACKAGE = $*Package
|
||||
director_nspace.%: JAVA_PACKAGE = $*Package
|
||||
director_nspace_director_name_collision.%: JAVA_PACKAGE = $*Package
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
|
|
@ -69,9 +77,9 @@ director_nspace.%: JAVA_PACKAGE = $*Package
|
|||
# Makes a directory for the testcase if it does not exist
|
||||
setup = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
fi; \
|
||||
if [ ! -d $(JAVA_PACKAGE) ]; then \
|
||||
mkdir $(JAVA_PACKAGE); \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
See ../README for common README file.
|
||||
|
||||
The Java implementation of the test-suite is a little different to the other languages in that all of SWIGs output goes into a subdirectory named after the individual test case. This is so that all the shadow classes can be compiled as Java classes have to go into separate files. Otherwise the Makefile wouldn't know which .java files would be relevant to the testcase. For this to work the testcase must go into a Java package.
|
||||
The Java implementation of the test-suite is a little different to the other languages in that all of SWIG's output goes into a subdirectory named after the individual test case. This is so that all the shadow classes can be compiled as Java classes which have to go into separate files. Otherwise the Makefile wouldn't know which .java files would be relevant to the testcase. For this to work the testcase must go into a Java package.
|
||||
|
||||
Any testcases which have _runme.java appended after the testcase name will be detected and run.
|
||||
|
||||
|
|
|
|||
33
Examples/test-suite/java/cpp11_constexpr_runme.java
Normal file
33
Examples/test-suite/java/cpp11_constexpr_runme.java
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import cpp11_constexpr.*;
|
||||
|
||||
public class cpp11_constexpr_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("cpp11_constexpr");
|
||||
} 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(int received, int expected) {
|
||||
if (expected != received)
|
||||
throw new RuntimeException("check failed, expected: " + expected + " received: " + received);
|
||||
}
|
||||
|
||||
public static void main(String argv[])
|
||||
{
|
||||
check(cpp11_constexpr.getAAA(), 10);
|
||||
check(cpp11_constexpr.getBBB(), 20);
|
||||
check(cpp11_constexpr.CCC(), 30);
|
||||
check(cpp11_constexpr.DDD(), 40);
|
||||
|
||||
ConstExpressions ce = new ConstExpressions();
|
||||
check(ce.JJJ, 100);
|
||||
check(ce.KKK, 200);
|
||||
check(ce.LLL, 300);
|
||||
check(ce.MMM(), 400);
|
||||
check(ce.NNN(), 500);
|
||||
}
|
||||
}
|
||||
28
Examples/test-suite/java/cpp11_lambda_functions_runme.java
Normal file
28
Examples/test-suite/java/cpp11_lambda_functions_runme.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import cpp11_lambda_functions.*;
|
||||
|
||||
public class cpp11_lambda_functions_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("cpp11_lambda_functions");
|
||||
} 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(int received, int expected) {
|
||||
if (expected != received)
|
||||
throw new RuntimeException("check failed, expected: " + expected + " received: " + received);
|
||||
}
|
||||
|
||||
public static void main(String argv[])
|
||||
{
|
||||
check(cpp11_lambda_functions.runLambda1(), 11);
|
||||
check(cpp11_lambda_functions.runLambda2(), 11);
|
||||
check(cpp11_lambda_functions.runLambda3(), 11);
|
||||
check(cpp11_lambda_functions.runLambda4(), 11);
|
||||
check(cpp11_lambda_functions.runLambda5(), 1);
|
||||
check(cpp11_lambda_functions.runLambda5(), 2);
|
||||
}
|
||||
}
|
||||
24
Examples/test-suite/java/cpp11_result_of_runme.java
Normal file
24
Examples/test-suite/java/cpp11_result_of_runme.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import cpp11_result_of.*;
|
||||
|
||||
public class cpp11_result_of_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("cpp11_result_of");
|
||||
} 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[])
|
||||
{
|
||||
double result = cpp11_result_of.test_result(cpp11_result_ofConstants.SQUARE, 3.0);
|
||||
if (result != 9.0)
|
||||
throw new RuntimeException("test_result(square, 3.0) is not 9.0. Got: " + Double.toString(result));
|
||||
|
||||
result = cpp11_result_of.test_result_alternative1(cpp11_result_ofConstants.SQUARE, 3.0);
|
||||
if (result != 9.0)
|
||||
throw new RuntimeException("test_result_alternative1(square, 3.0) is not 9.0. Got: " + Double.toString(result));
|
||||
}
|
||||
}
|
||||
51
Examples/test-suite/java/cpp11_thread_local_runme.java
Normal file
51
Examples/test-suite/java/cpp11_thread_local_runme.java
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import cpp11_thread_local.*;
|
||||
|
||||
public class cpp11_thread_local_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("cpp11_thread_local");
|
||||
} 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 (ThreadLocals.getStval() != 11)
|
||||
throw new RuntimeException();
|
||||
if (ThreadLocals.getTsval() != 22)
|
||||
throw new RuntimeException();
|
||||
if (ThreadLocals.tscval99 != 99)
|
||||
throw new RuntimeException();
|
||||
|
||||
cpp11_thread_local.setEtval(-11);
|
||||
if (cpp11_thread_local.getEtval() != -11)
|
||||
throw new RuntimeException();
|
||||
|
||||
cpp11_thread_local.setStval(-22);
|
||||
if (cpp11_thread_local.getStval() != -22)
|
||||
throw new RuntimeException();
|
||||
|
||||
cpp11_thread_local.setTsval(-33);
|
||||
if (cpp11_thread_local.getTsval() != -33)
|
||||
throw new RuntimeException();
|
||||
|
||||
cpp11_thread_local.setEtval(-44);
|
||||
if (cpp11_thread_local.getEtval() != -44)
|
||||
throw new RuntimeException();
|
||||
|
||||
cpp11_thread_local.setTeval(-55);
|
||||
if (cpp11_thread_local.getTeval() != -55)
|
||||
throw new RuntimeException();
|
||||
|
||||
cpp11_thread_local.setEctval(-55);
|
||||
if (cpp11_thread_local.getEctval() != -55)
|
||||
throw new RuntimeException();
|
||||
|
||||
cpp11_thread_local.setEcpptval(-66);
|
||||
if (cpp11_thread_local.getEcpptval() != -66)
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
import curiously_recurring_template_pattern.*;
|
||||
|
||||
public class curiously_recurring_template_pattern_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("curiously_recurring_template_pattern");
|
||||
} 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[]) {
|
||||
Derived d = new Derived();
|
||||
d.setBase1Param(1).setDerived1Param(10).setDerived2Param(20).setBase2Param(2);
|
||||
|
||||
if (d.getBase1Param() != 1)
|
||||
throw new RuntimeException("fail");
|
||||
if (d.getDerived1Param() != 10)
|
||||
throw new RuntimeException("fail");
|
||||
if (d.getBase2Param() != 2)
|
||||
throw new RuntimeException("fail");
|
||||
if (d.getDerived2Param() != 20)
|
||||
throw new RuntimeException("fail");
|
||||
}
|
||||
}
|
||||
|
||||
22
Examples/test-suite/java/derived_nested_runme.java
Normal file
22
Examples/test-suite/java/derived_nested_runme.java
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
import derived_nested.*;
|
||||
|
||||
public class derived_nested_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("derived_nested");
|
||||
} 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[]) {
|
||||
BB outer = new BB();
|
||||
BB.DD d = new BB.DD();
|
||||
BB.EE e = new BB.EE();
|
||||
outer.getFf_instance().setZ(outer.getFf_instance().getX());
|
||||
outer.useEE(e);
|
||||
}
|
||||
}
|
||||
|
|
@ -21,6 +21,11 @@ public class director_binary_string_runme {
|
|||
|
||||
if (sum != 9*2*8 + 13*3*5)
|
||||
throw new RuntimeException("Unexpected sum: " + sum);
|
||||
|
||||
new Callback().run(null, null);
|
||||
callback = new DirectorBinaryStringCallback();
|
||||
caller.setCallback(callback);
|
||||
caller.call_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -32,11 +37,13 @@ class DirectorBinaryStringCallback extends Callback {
|
|||
@Override
|
||||
public void run(byte[] dataBufferAA, byte[] dataBufferBB)
|
||||
{
|
||||
for (int i = 0; i < dataBufferAA.length; i++)
|
||||
dataBufferAA[i] = (byte)(dataBufferAA[i] * 2);
|
||||
if (dataBufferAA != null)
|
||||
for (int i = 0; i < dataBufferAA.length; i++)
|
||||
dataBufferAA[i] = (byte)(dataBufferAA[i] * 2);
|
||||
|
||||
for (int i = 0; i < dataBufferBB.length; i++)
|
||||
dataBufferBB[i] = (byte)(dataBufferBB[i] * 3);
|
||||
if (dataBufferBB != null)
|
||||
for (int i = 0; i < dataBufferBB.length; i++)
|
||||
dataBufferBB[i] = (byte)(dataBufferBB[i] * 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class director_nspace_runme {
|
|||
|
||||
}
|
||||
|
||||
class director_nspace_MyBarFoo extends director_nspacePackage.Bar.Foo {
|
||||
class director_nspace_MyBarFoo extends director_nspacePackage.TopLevel.Bar.Foo {
|
||||
|
||||
@Override
|
||||
public String ping() {
|
||||
|
|
@ -32,17 +32,17 @@ class director_nspace_MyBarFoo extends director_nspacePackage.Bar.Foo {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String fooBar(director_nspacePackage.Bar.FooBar fooBar) {
|
||||
public String fooBar(director_nspacePackage.TopLevel.Bar.FooBar fooBar) {
|
||||
return fooBar.FooBarDo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public director_nspacePackage.Bar.Foo makeFoo() {
|
||||
return new director_nspacePackage.Bar.Foo();
|
||||
public director_nspacePackage.TopLevel.Bar.Foo makeFoo() {
|
||||
return new director_nspacePackage.TopLevel.Bar.Foo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public director_nspacePackage.Bar.FooBar makeFooBar() {
|
||||
return new director_nspacePackage.Bar.FooBar();
|
||||
public director_nspacePackage.TopLevel.Bar.FooBar makeFooBar() {
|
||||
return new director_nspacePackage.TopLevel.Bar.FooBar();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
48
Examples/test-suite/java/director_smartptr_runme.java
Normal file
48
Examples/test-suite/java/director_smartptr_runme.java
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
// Make sure that directors are connected and disconnected when used inconjunction with
|
||||
// being a smart pointer
|
||||
|
||||
public class director_smartptr_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("director_smartptr");
|
||||
} 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[]) {
|
||||
director_smartptr_MyBarFoo myBarFoo =
|
||||
new director_smartptr_MyBarFoo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class director_smartptr_MyBarFoo extends director_smartptr.Foo {
|
||||
|
||||
@Override
|
||||
public String ping() {
|
||||
return "director_smartptr_MyBarFoo.ping();";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String pong() {
|
||||
return "director_smartptr_MyBarFoo.pong();" + ping();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String fooBar(director_smartptr.FooBar fooBar) {
|
||||
return fooBar.FooBarDo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public director_smartptr.Foo makeFoo() {
|
||||
return new director_smartptr.Foo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public director_smartptr.FooBar makeFooBar() {
|
||||
return new director_smartptr.FooBar();
|
||||
}
|
||||
}
|
||||
|
|
@ -22,8 +22,7 @@ public class dynamic_cast_runme {
|
|||
// Note it is possible to downcast y with a Java cast.
|
||||
String a = dynamic_cast.do_test((Bar)y);
|
||||
if (!a.equals("Bar::test")) {
|
||||
System.err.println("Failed!");
|
||||
System.exit(1);
|
||||
throw new RuntimeException("Failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
33
Examples/test-suite/java/enum_forward_runme.java
Normal file
33
Examples/test-suite/java/enum_forward_runme.java
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
import enum_forward.*;
|
||||
|
||||
public class enum_forward_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("enum_forward");
|
||||
} 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[])
|
||||
{
|
||||
try {
|
||||
ForwardEnum1 f1 = enum_forward.get_enum1();
|
||||
f1 = enum_forward.test_function1(f1);
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
|
||||
try {
|
||||
ForwardEnum2 f2 = enum_forward.get_enum2();
|
||||
f2 = enum_forward.test_function2(f2);
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
|
||||
ForwardEnum3 f3 = enum_forward.get_enum3();
|
||||
f3 = enum_forward.test_function3(f3);
|
||||
}
|
||||
}
|
||||
|
||||
93
Examples/test-suite/java/enum_macro_runme.java
Normal file
93
Examples/test-suite/java/enum_macro_runme.java
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
|
||||
import enum_macro.*;
|
||||
|
||||
public class enum_macro_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("enum_macro");
|
||||
} 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[])
|
||||
{
|
||||
{
|
||||
Greeks1 a = Greeks1.alpha1;
|
||||
a = Greeks1.beta1;
|
||||
a = Greeks1.theta1;
|
||||
if (a.swigValue() != 3)
|
||||
throw new RuntimeException("Greeks1");
|
||||
}
|
||||
{
|
||||
Greeks2 a = Greeks2.alpha2;
|
||||
a = Greeks2.beta2;
|
||||
a = Greeks2.theta2;
|
||||
if (a.swigValue() != 4)
|
||||
throw new RuntimeException("Greeks2");
|
||||
}
|
||||
{
|
||||
Greeks3 a = Greeks3.alpha3;
|
||||
a = Greeks3.beta3;
|
||||
a = Greeks3.theta3;
|
||||
if (a.swigValue() != 2)
|
||||
throw new RuntimeException("Greeks3");
|
||||
}
|
||||
{
|
||||
Greeks4 a = Greeks4.alpha4;
|
||||
a = Greeks4.beta4;
|
||||
a = Greeks4.theta4;
|
||||
if (a.swigValue() != 6)
|
||||
throw new RuntimeException("Greeks4");
|
||||
}
|
||||
{
|
||||
Greeks5 a = Greeks5.alpha5;
|
||||
a = Greeks5.beta5;
|
||||
if (a.swigValue() != 1)
|
||||
throw new RuntimeException("Greeks5");
|
||||
}
|
||||
{
|
||||
Greeks6 a = Greeks6.alpha6;
|
||||
a = Greeks6.beta6;
|
||||
if (a.swigValue() != 1)
|
||||
throw new RuntimeException("Greeks6");
|
||||
}
|
||||
{
|
||||
Greeks7 a = Greeks7.alpha7;
|
||||
a = Greeks7.beta7;
|
||||
if (a.swigValue() != 1)
|
||||
throw new RuntimeException("Greeks7");
|
||||
}
|
||||
{
|
||||
Greeks8 a = Greeks8.theta8;
|
||||
if (a.swigValue() != 0)
|
||||
throw new RuntimeException("Greeks8");
|
||||
}
|
||||
{
|
||||
Greeks9 a = Greeks9.theta9;
|
||||
if (a.swigValue() != 0)
|
||||
throw new RuntimeException("Greeks9");
|
||||
}
|
||||
{
|
||||
Greeks10 a = Greeks10.theta10;
|
||||
if (a.swigValue() != 0)
|
||||
throw new RuntimeException("Greeks10");
|
||||
}
|
||||
{
|
||||
Greeks11 a = Greeks11.theta11;
|
||||
if (a.swigValue() != 0)
|
||||
throw new RuntimeException("Greeks11");
|
||||
}
|
||||
{
|
||||
Greeks12 a = Greeks12.theta12;
|
||||
if (a.swigValue() != 0)
|
||||
throw new RuntimeException("Greeks12");
|
||||
}
|
||||
{
|
||||
Greeks13 a = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
Examples/test-suite/java/extend_special_variables_runme.java
Normal file
25
Examples/test-suite/java/extend_special_variables_runme.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
import extend_special_variables.*;
|
||||
|
||||
public class extend_special_variables_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("extend_special_variables");
|
||||
} 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[])
|
||||
{
|
||||
ForExtensionNewName f = new ForExtensionNewName();
|
||||
verify(f.extended_renamed(), "name:extended symname:extended_renamed wrapname: overname:__SWIG_0 decl:ForExtension::extended() fulldecl:char const * ForExtension::extended() parentclasssymname:ForExtensionNewName parentclassname:ForExtension");
|
||||
verify(f.extended_renamed(10), "name:extended symname:extended_renamed wrapname: overname:__SWIG_1 decl:ForExtension::extended(int) fulldecl:char const * ForExtension::extended(int) parentclasssymname:ForExtensionNewName parentclassname:ForExtension");
|
||||
}
|
||||
static void verify(String received, String expected) {
|
||||
if (!received.equals(expected))
|
||||
throw new RuntimeException("Incorrect, received: " + received);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,16 +16,16 @@ public class ignore_parameter_runme {
|
|||
{
|
||||
// Compilation will ensure the number of arguments and type are correct.
|
||||
// Then check the return value is the same as the value given to the ignored parameter.
|
||||
if (!ignore_parameter.jaguar(200, 0.0).equals("hello")) { System.err.println("Runtime Error in jaguar()");}
|
||||
if (ignore_parameter.lotus("fast", 0.0) != 101) { System.err.println("Runtime Error in lotus()");}
|
||||
if (ignore_parameter.tvr("fast", 200) != 8.8) { System.err.println("Runtime Error in tvr()");}
|
||||
if (ignore_parameter.ferrari() != 101) { System.err.println("Runtime Error in ferrari()");}
|
||||
if (!ignore_parameter.jaguar(200, 0.0).equals("hello")) { throw new RuntimeException("Runtime Error in jaguar()");}
|
||||
if (ignore_parameter.lotus("fast", 0.0) != 101) { throw new RuntimeException("Runtime Error in lotus()");}
|
||||
if (ignore_parameter.tvr("fast", 200) != 8.8) { throw new RuntimeException("Runtime Error in tvr()");}
|
||||
if (ignore_parameter.ferrari() != 101) { throw new RuntimeException("Runtime Error in ferrari()");}
|
||||
|
||||
SportsCars sc = new SportsCars();
|
||||
if (!sc.daimler(200, 0.0).equals("hello")) { System.err.println("Runtime Error in daimler()");}
|
||||
if (sc.astonmartin("fast", 0.0) != 101) { System.err.println("Runtime Error in astonmartin()");}
|
||||
if (sc.bugatti("fast", 200) != 8.8) { System.err.println("Runtime Error in bugatti()");}
|
||||
if (sc.lamborghini() != 101) { System.err.println("Runtime Error in lamborghini()");}
|
||||
if (!sc.daimler(200, 0.0).equals("hello")) { throw new RuntimeException("Runtime Error in daimler()");}
|
||||
if (sc.astonmartin("fast", 0.0) != 101) { throw new RuntimeException("Runtime Error in astonmartin()");}
|
||||
if (sc.bugatti("fast", 200) != 8.8) { throw new RuntimeException("Runtime Error in bugatti()");}
|
||||
if (sc.lamborghini() != 101) { throw new RuntimeException("Runtime Error in lamborghini()");}
|
||||
|
||||
// Check constructors are also generated correctly
|
||||
MiniCooper mc = new MiniCooper(200, 0.0);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
import java_director_assumeoverride.*;
|
||||
|
||||
public class java_director_assumeoverride_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("java_director_assumeoverride");
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
static class MyOverrideMe extends OverrideMe {
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
OverrideMe overrideMe = new MyOverrideMe();
|
||||
|
||||
// MyOverrideMe doesn't actually override func(), 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,150 @@
|
|||
import java_director_exception_feature_nspacePackage.*;
|
||||
import java_director_exception_feature_nspacePackage.MyNS.*;
|
||||
|
||||
class java_director_exception_feature_nspace_Consts {
|
||||
public static final String PINGEXCP1 = "Ping MyJavaException1"; // should get translated through an int on ping
|
||||
public static final String PINGEXCP2 = "Ping MyJavaException2";
|
||||
|
||||
public static final String PONGEXCP1 = "Pong MyJavaException1";
|
||||
public static final String PONGEXCP2 = "Pong MyJavaException2";
|
||||
public static final String PONGUNEXPECTED = "Pong MyJavaUnexpected";
|
||||
public static final String TRANSLATED_NPE = "Pong Translated NPE";
|
||||
|
||||
public static final String GENERICPONGEXCP1 = "GenericPong Wrapped MyJavaException1";
|
||||
public static final String GENERICPONGEXCP2 = "GenericPong New Checked Exception";
|
||||
public static final String GENERICPONGEXCP3 = "GenericPong New Unchecked Exception";
|
||||
public static final String GENERICPONGEXCP4 = "GenericPong New Exception Without String ctor";
|
||||
}
|
||||
|
||||
// an exception not mentioned or wrapped by the swig interface,
|
||||
// to reconstruct using generic DirectorException handling
|
||||
class java_director_exception_feature_nspace_NewCheckedException extends Exception {
|
||||
public java_director_exception_feature_nspace_NewCheckedException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
||||
// an exception not mentioned or wrapped by the swig interface,
|
||||
// to reconstruct using generic DirectorException handling
|
||||
class java_director_exception_feature_nspace_NewUncheckedException extends RuntimeException {
|
||||
public java_director_exception_feature_nspace_NewUncheckedException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
||||
// an exception not constructible from a string,
|
||||
// to test DirectorException fallback reconstruction
|
||||
class java_director_exception_feature_nspace_UnconstructibleException extends Exception {
|
||||
private int extrastate;
|
||||
public java_director_exception_feature_nspace_UnconstructibleException(int a, String s) {
|
||||
super(s);
|
||||
extrastate = a;
|
||||
}
|
||||
}
|
||||
|
||||
class java_director_exception_feature_nspace_MyFooDirectorImpl extends Foo {
|
||||
|
||||
public java_director_exception_feature_nspace_MyFooDirectorImpl() { };
|
||||
|
||||
@Override
|
||||
public String ping(int excp) throws MyJavaException1, MyJavaException2 {
|
||||
if (excp == 1) throw new MyJavaException1(java_director_exception_feature_nspace_Consts.PINGEXCP1);
|
||||
if (excp == 2) throw new MyJavaException2(java_director_exception_feature_nspace_Consts.PINGEXCP2);
|
||||
return "Ping director returned";
|
||||
}
|
||||
@Override
|
||||
public String pong(int excp) throws MyJavaException1, MyJavaException2, MyJavaUnexpected {
|
||||
if (excp == 1) throw new MyJavaException1(java_director_exception_feature_nspace_Consts.PONGEXCP1);
|
||||
if (excp == 2) throw new MyJavaException2(java_director_exception_feature_nspace_Consts.PONGEXCP2);
|
||||
if (excp == 3) throw new MyJavaUnexpected(java_director_exception_feature_nspace_Consts.PONGUNEXPECTED);
|
||||
if (excp == 4) throw new java.lang.NullPointerException(java_director_exception_feature_nspace_Consts.TRANSLATED_NPE); // should be translated to ::Unexpected
|
||||
return "Pong director returned";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String genericpong(int excp) throws MyJavaException1, java_director_exception_feature_nspace_NewCheckedException, java_director_exception_feature_nspace_UnconstructibleException {
|
||||
if (excp == 1)
|
||||
throw new MyJavaException1(java_director_exception_feature_nspace_Consts.GENERICPONGEXCP1);
|
||||
if (excp == 2)
|
||||
throw new java_director_exception_feature_nspace_NewCheckedException(java_director_exception_feature_nspace_Consts.GENERICPONGEXCP2);
|
||||
if (excp == 3)
|
||||
throw new java_director_exception_feature_nspace_NewUncheckedException(java_director_exception_feature_nspace_Consts.GENERICPONGEXCP3);
|
||||
if (excp == 4)
|
||||
throw new java_director_exception_feature_nspace_UnconstructibleException(1, java_director_exception_feature_nspace_Consts.GENERICPONGEXCP4);
|
||||
return "GenericPong director returned";
|
||||
}
|
||||
}
|
||||
|
||||
public class java_director_exception_feature_nspace_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("java_director_exception_feature_nspace");
|
||||
} 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 fail(String msg) {
|
||||
System.err.println(msg); System.exit(1);
|
||||
}
|
||||
public static void failif(boolean cond, String msg) {
|
||||
if (cond) fail(msg);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String argv[]) {
|
||||
|
||||
Bar b = new Bar(new java_director_exception_feature_nspace_MyFooDirectorImpl());
|
||||
try {
|
||||
|
||||
try { b.ping(0); } catch (Exception e)
|
||||
{ fail("Exception should not have been thrown: " + e + " from ping(0)"); }
|
||||
try { b.ping(1); fail("No exception thrown in ping(1)"); } catch (MyJavaException1 e)
|
||||
// Should say "Threw some integer", see java_director_exception_feature.i Foo::ping throws a "1"
|
||||
{ failif( ! "Threw some integer".equals(e.getMessage()), "Ping exception not translated through int: '" + e.getMessage() + "'"); }
|
||||
try { b.ping(2); fail("No exception thrown in ping(2)"); } catch (MyJavaException2 e)
|
||||
{ failif( ! java_director_exception_feature_nspace_Consts.PINGEXCP2.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'"); }
|
||||
|
||||
try { b.pong(0); } catch (Exception e)
|
||||
{ fail("Exception should not have been thrown: " + e + " from pong(0)"); }
|
||||
try { b.pong(1); fail("No exception thrown in pong(1)"); } catch (MyJavaException1 e)
|
||||
{ failif( ! java_director_exception_feature_nspace_Consts.PONGEXCP1.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'"); }
|
||||
try { b.pong(2); fail("No exception thrown in pong(2)");} catch (MyJavaException2 e)
|
||||
{ failif( ! java_director_exception_feature_nspace_Consts.PONGEXCP2.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'"); }
|
||||
try { b.pong(3); fail("No exception thrown in pong(3)");} catch (MyJavaUnexpected e)
|
||||
{ failif( ! java_director_exception_feature_nspace_Consts.PONGUNEXPECTED.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'"); }
|
||||
try { b.pong(4); fail("No exception thrown in pong(4)"); } catch (MyJavaUnexpected e)
|
||||
{ failif( ! java_director_exception_feature_nspace_Consts.TRANSLATED_NPE.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'"); }
|
||||
|
||||
|
||||
try { b.genericpong(0); }
|
||||
catch (Exception e) {
|
||||
fail("Exception should not have been thrown: " + e + " from genericpong(0)");
|
||||
}
|
||||
try { b.genericpong(1); fail("No exception thrown in genericpong(1)"); }
|
||||
catch (MyJavaException1 e) {
|
||||
failif( ! java_director_exception_feature_nspace_Consts.GENERICPONGEXCP1.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
|
||||
}
|
||||
try { b.genericpong(2); fail("No exception thrown in genericpong(2)");}
|
||||
catch (java_director_exception_feature_nspace_NewCheckedException e) {
|
||||
failif( ! java_director_exception_feature_nspace_Consts.GENERICPONGEXCP2.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
|
||||
}
|
||||
try { b.genericpong(3); fail("No exception thrown in genericpong(3)");}
|
||||
catch (java_director_exception_feature_nspace_NewUncheckedException e) {
|
||||
failif( ! java_director_exception_feature_nspace_Consts.GENERICPONGEXCP3.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
|
||||
}
|
||||
try { b.genericpong(4); fail("No exception thrown in genericpong(4)");}
|
||||
catch (RuntimeException e) {
|
||||
failif ( e.getClass() != RuntimeException.class, "Exception " + e + " is not exactly RumtimeException");
|
||||
failif( ! java_director_exception_feature_nspace_Consts.GENERICPONGEXCP4.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail("Unexpected exception thrown or exception not mapped properly");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
|
||||
import java_director_exception_feature.*;
|
||||
|
||||
class java_director_exception_feature_Consts {
|
||||
public static final String PINGEXCP1 = "Ping MyJavaException1"; // should get translated through an int on ping
|
||||
public static final String PINGEXCP2 = "Ping MyJavaException2";
|
||||
|
||||
public static final String PONGEXCP1 = "Pong MyJavaException1";
|
||||
public static final String PONGEXCP2 = "Pong MyJavaException2";
|
||||
public static final String PONGUNEXPECTED = "Pong MyJavaUnexpected";
|
||||
public static final String TRANSLATED_NPE = "Pong Translated NPE";
|
||||
|
||||
public static final String GENERICPONGEXCP1 = "GenericPong Wrapped MyJavaException1";
|
||||
public static final String GENERICPONGEXCP2 = "GenericPong New Checked Exception";
|
||||
public static final String GENERICPONGEXCP3 = "GenericPong New Unchecked Exception";
|
||||
public static final String GENERICPONGEXCP4 = "GenericPong New Exception Without String ctor";
|
||||
|
||||
}
|
||||
|
||||
// an exception not mentioned or wrapped by the swig interface,
|
||||
// to reconstruct using generic DirectorException handling
|
||||
class NewCheckedException extends Exception {
|
||||
public NewCheckedException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
||||
// an exception not mentioned or wrapped by the swig interface,
|
||||
// to reconstruct using generic DirectorException handling
|
||||
class NewUncheckedException extends RuntimeException {
|
||||
public NewUncheckedException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
||||
// an exception not constructable from a string,
|
||||
// to test DirectorException fallback reconstruction
|
||||
class UnconstructableException extends Exception {
|
||||
private int extrastate;
|
||||
public UnconstructableException(int a, String s) {
|
||||
super(s);
|
||||
extrastate = a;
|
||||
}
|
||||
}
|
||||
|
||||
class java_director_exception_feature_MyFooDirectorImpl extends Foo {
|
||||
|
||||
public java_director_exception_feature_MyFooDirectorImpl() { };
|
||||
|
||||
@Override
|
||||
public String ping(int excp) throws MyJavaException1, MyJavaException2 {
|
||||
if (excp == 1) throw new MyJavaException1(java_director_exception_feature_Consts.PINGEXCP1);
|
||||
if (excp == 2) throw new MyJavaException2(java_director_exception_feature_Consts.PINGEXCP2);
|
||||
return "Ping director returned";
|
||||
}
|
||||
@Override
|
||||
public String pong(int excp) throws MyJavaException1, MyJavaException2, MyJavaUnexpected {
|
||||
if (excp == 1) throw new MyJavaException1(java_director_exception_feature_Consts.PONGEXCP1);
|
||||
if (excp == 2) throw new MyJavaException2(java_director_exception_feature_Consts.PONGEXCP2);
|
||||
if (excp == 3) throw new MyJavaUnexpected(java_director_exception_feature_Consts.PONGUNEXPECTED);
|
||||
if (excp == 4) throw new java.lang.NullPointerException(java_director_exception_feature_Consts.TRANSLATED_NPE); // should be translated to ::Unexpected
|
||||
return "Pong director returned";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String genericpong(int excp) throws MyJavaException1, NewCheckedException, UnconstructableException {
|
||||
if (excp == 1)
|
||||
throw new MyJavaException1(java_director_exception_feature_Consts.GENERICPONGEXCP1);
|
||||
if (excp == 2)
|
||||
throw new NewCheckedException(java_director_exception_feature_Consts.GENERICPONGEXCP2);
|
||||
if (excp == 3)
|
||||
throw new NewUncheckedException(java_director_exception_feature_Consts.GENERICPONGEXCP3);
|
||||
if (excp == 4)
|
||||
throw new UnconstructableException(1, java_director_exception_feature_Consts.GENERICPONGEXCP4);
|
||||
return "GenericPong director returned";
|
||||
}
|
||||
}
|
||||
|
||||
public class java_director_exception_feature_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("java_director_exception_feature");
|
||||
} 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 fail(String msg) {
|
||||
System.err.println(msg); System.exit(1);
|
||||
}
|
||||
public static void failif(boolean cond, String msg) {
|
||||
if (cond) fail(msg);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String argv[]) {
|
||||
|
||||
Bar b = new Bar(new java_director_exception_feature_MyFooDirectorImpl());
|
||||
try {
|
||||
|
||||
try { b.ping(0); } catch (Exception e)
|
||||
{ fail("Exception should not have been thrown: " + e + " from ping(0)"); }
|
||||
try { b.ping(1); fail("No exception thrown in ping(1)"); } catch (MyJavaException1 e)
|
||||
// Should say "Threw some integer", see java_director_exception_feature.i Foo::ping throws a "1"
|
||||
{ failif( ! "Threw some integer".equals(e.getMessage()), "Ping exception not translated through int: '" + e.getMessage() + "'"); }
|
||||
try { b.ping(2); fail("No exception thrown in ping(2)"); } catch (MyJavaException2 e)
|
||||
{ failif( ! java_director_exception_feature_Consts.PINGEXCP2.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'"); }
|
||||
|
||||
try { b.pong(0); } catch (Exception e)
|
||||
{ fail("Exception should not have been thrown: " + e + " from pong(0)"); }
|
||||
try { b.pong(1); fail("No exception thrown in pong(1)"); } catch (MyJavaException1 e)
|
||||
{ failif( ! java_director_exception_feature_Consts.PONGEXCP1.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'"); }
|
||||
try { b.pong(2); fail("No exception thrown in pong(2)");} catch (MyJavaException2 e)
|
||||
{ failif( ! java_director_exception_feature_Consts.PONGEXCP2.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'"); }
|
||||
try { b.pong(3); fail("No exception thrown in pong(3)");} catch (MyJavaUnexpected e)
|
||||
{ failif( ! java_director_exception_feature_Consts.PONGUNEXPECTED.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'"); }
|
||||
try { b.pong(4); fail("No exception thrown in pong(4)"); } catch (MyJavaUnexpected e)
|
||||
{ failif( ! java_director_exception_feature_Consts.TRANSLATED_NPE.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'"); }
|
||||
|
||||
|
||||
try { b.genericpong(0); }
|
||||
catch (Exception e) {
|
||||
fail("Exception should not have been thrown: " + e + " from genericpong(0)");
|
||||
}
|
||||
try { b.genericpong(1); fail("No exception thrown in genericpong(1)"); }
|
||||
catch (MyJavaException1 e) {
|
||||
failif( ! java_director_exception_feature_Consts.GENERICPONGEXCP1.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
|
||||
}
|
||||
try { b.genericpong(2); fail("No exception thrown in genericpong(2)");}
|
||||
catch (NewCheckedException e) {
|
||||
failif( ! java_director_exception_feature_Consts.GENERICPONGEXCP2.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
|
||||
}
|
||||
try { b.genericpong(3); fail("No exception thrown in genericpong(3)");}
|
||||
catch (NewUncheckedException e) {
|
||||
failif( ! java_director_exception_feature_Consts.GENERICPONGEXCP3.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
|
||||
}
|
||||
try { b.genericpong(4); fail("No exception thrown in genericpong(4)");}
|
||||
catch (RuntimeException e) {
|
||||
failif ( e.getClass() != RuntimeException.class, "Exception " + e + " is not exactly RumtimeException");
|
||||
failif( ! java_director_exception_feature_Consts.GENERICPONGEXCP4.equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail("Unexpected exception thrown or exception not mapped properly");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,16 @@ public class java_director_runme {
|
|||
}
|
||||
}
|
||||
|
||||
private static void WaitForGC()
|
||||
{
|
||||
System.gc();
|
||||
System.runFinalization();
|
||||
try {
|
||||
java.lang.Thread.sleep(10);
|
||||
} catch (java.lang.InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
QuuxContainer qc = createContainer();
|
||||
|
||||
|
|
@ -31,24 +41,21 @@ public class java_director_runme {
|
|||
qc = null;
|
||||
/* Watch qc get reaped, which causes the C++ object to delete
|
||||
objects from the internal vector */
|
||||
System.gc();
|
||||
System.runFinalization();
|
||||
|
||||
// Give the finalizers a chance to run
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
} catch (InterruptedException e) {
|
||||
{
|
||||
int countdown = 500;
|
||||
int expectedCount = 0;
|
||||
while (true) {
|
||||
WaitForGC();
|
||||
if (--countdown == 0)
|
||||
break;
|
||||
if (Quux.instances() == expectedCount)
|
||||
break;
|
||||
};
|
||||
int actualCount = Quux.instances();
|
||||
if (actualCount != expectedCount)
|
||||
throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
|
||||
}
|
||||
|
||||
/* Watch the Quux objects formerly in the QuuxContainer object
|
||||
get reaped */
|
||||
System.gc();
|
||||
System.runFinalization();
|
||||
|
||||
instances = Quux.instances();
|
||||
if (instances != 0)
|
||||
throw new RuntimeException("Quux instances should be 0, actually " + instances);
|
||||
|
||||
/* Test Quux1's director disconnect method rename */
|
||||
Quux1 quux1 = new Quux1("quux1");
|
||||
if (quux1.disconnectMethodCalled)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ public class java_jnitypes_runme {
|
|||
}
|
||||
|
||||
public static void testFailed(String str) {
|
||||
System.err.println(str + " test failed");
|
||||
System.exit(1);
|
||||
throw new RuntimeException(str + " test failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class java_prepost_runme {
|
|||
{
|
||||
// ensure checked exception is generated
|
||||
try {
|
||||
PrePostThrows ppt = new PrePostThrows(null);
|
||||
PrePostThrows ppt = new PrePostThrows(null, true);
|
||||
} catch (InstantiationException e) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,38 @@
|
|||
import li_boost_shared_ptr_attribute.*;
|
||||
|
||||
public class li_boost_shared_ptr_attribute_runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("li_boost_shared_ptr_attribute");
|
||||
} 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 check(GetSetMe g, int expected) {
|
||||
int got = g.getN();
|
||||
if (got != expected)
|
||||
throw new RuntimeException("GetSetMe value is " + got + " but should be " + expected);
|
||||
}
|
||||
|
||||
public static void check(GetMe g, int expected) {
|
||||
int got = g.getN();
|
||||
if (got != expected)
|
||||
throw new RuntimeException("GetMe value is " + got + " but should be " + expected);
|
||||
}
|
||||
|
||||
public static void main(String argv[])
|
||||
{
|
||||
GetterSetter gs = new GetterSetter(5);
|
||||
check(gs.getMyval(), 25);
|
||||
check(gs.getAddedAttrib(), 25);
|
||||
gs.setAddedAttrib(new GetSetMe(6));
|
||||
check(gs.getMyval(), 6);
|
||||
check(gs.getAddedAttrib(), 6);
|
||||
|
||||
GetterOnly g = new GetterOnly(4);
|
||||
check(g.getMyval(), 16);
|
||||
check(g.getAddedAttrib(), 16);
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,16 @@ public class li_boost_shared_ptr_runme {
|
|||
// Debugging flag
|
||||
public final static boolean debug = false;
|
||||
|
||||
private static void WaitForGC()
|
||||
{
|
||||
System.gc();
|
||||
System.runFinalization();
|
||||
try {
|
||||
java.lang.Thread.sleep(10);
|
||||
} catch (java.lang.InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[])
|
||||
{
|
||||
if (debug)
|
||||
|
|
@ -37,21 +47,20 @@ public class li_boost_shared_ptr_runme {
|
|||
if (debug)
|
||||
System.out.println("Nearly finished");
|
||||
|
||||
int countdown = 100;
|
||||
while (true) {
|
||||
System.gc();
|
||||
System.runFinalization();
|
||||
try {
|
||||
java.lang.Thread.sleep(10);
|
||||
} catch (java.lang.InterruptedException e) {
|
||||
{
|
||||
int countdown = 500;
|
||||
int expectedCount = 1;
|
||||
while (true) {
|
||||
WaitForGC();
|
||||
if (--countdown == 0)
|
||||
break;
|
||||
if (Klass.getTotal_count() == expectedCount) // Expect the one global variable (GlobalValue)
|
||||
break;
|
||||
}
|
||||
if (--countdown == 0)
|
||||
break;
|
||||
if (Klass.getTotal_count() == 1) // Expect 1 instance - the one global variable (GlobalValue)
|
||||
break;
|
||||
};
|
||||
if (Klass.getTotal_count() != 1)
|
||||
throw new RuntimeException("Klass.total_count=" + Klass.getTotal_count());
|
||||
int actualCount = Klass.getTotal_count();
|
||||
if (actualCount != expectedCount)
|
||||
throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
|
||||
}
|
||||
|
||||
int wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count();
|
||||
if (wrapper_count != li_boost_shared_ptr.getNOT_COUNTING())
|
||||
|
|
|
|||
24
Examples/test-suite/java/li_cdata_runme.java
Normal file
24
Examples/test-suite/java/li_cdata_runme.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import li_cdata.*;
|
||||
|
||||
public class li_cdata_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("li_cdata");
|
||||
} 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
|
||||
{
|
||||
byte[] s = "ABC abc".getBytes();
|
||||
SWIGTYPE_p_void m = li_cdata.malloc(256);
|
||||
li_cdata.memmove(m, s);
|
||||
byte[] ss = li_cdata.cdata(m, 7);
|
||||
String ss_string = new String(ss);
|
||||
if (!ss_string.equals("ABC abc"))
|
||||
throw new RuntimeException("failed got: " + ss_string);
|
||||
}
|
||||
}
|
||||
68
Examples/test-suite/java/li_std_auto_ptr_runme.java
Normal file
68
Examples/test-suite/java/li_std_auto_ptr_runme.java
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
import li_std_auto_ptr.*;
|
||||
|
||||
public class li_std_auto_ptr_runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("li_std_auto_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 WaitForGC()
|
||||
{
|
||||
System.gc();
|
||||
System.runFinalization();
|
||||
try {
|
||||
java.lang.Thread.sleep(10);
|
||||
} catch (java.lang.InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) throws Throwable
|
||||
{
|
||||
Klass k1 = li_std_auto_ptr.makeKlassAutoPtr("first");
|
||||
if (!k1.getLabel().equals("first"))
|
||||
throw new RuntimeException("wrong object label");
|
||||
|
||||
Klass k2 = li_std_auto_ptr.makeKlassAutoPtr("second");
|
||||
if (Klass.getTotal_count() != 2)
|
||||
throw new RuntimeException("number of objects should be 2");
|
||||
|
||||
k1 = null;
|
||||
{
|
||||
int countdown = 500;
|
||||
int expectedCount = 1;
|
||||
while (true) {
|
||||
WaitForGC();
|
||||
if (--countdown == 0)
|
||||
break;
|
||||
if (Klass.getTotal_count() == expectedCount)
|
||||
break;
|
||||
}
|
||||
int actualCount = Klass.getTotal_count();
|
||||
if (actualCount != expectedCount)
|
||||
throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
|
||||
}
|
||||
|
||||
if (!k2.getLabel().equals("second"))
|
||||
throw new RuntimeException("wrong object label");
|
||||
|
||||
k2 = null;
|
||||
{
|
||||
int countdown = 500;
|
||||
int expectedCount = 0;
|
||||
while (true) {
|
||||
WaitForGC();
|
||||
if (--countdown == 0)
|
||||
break;
|
||||
if (Klass.getTotal_count() == expectedCount)
|
||||
break;
|
||||
};
|
||||
int actualCount = Klass.getTotal_count();
|
||||
if (actualCount != expectedCount)
|
||||
throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -66,8 +66,7 @@ public class long_long_runme {
|
|||
long_long.setLl(ll);
|
||||
long ll_check = long_long.getLl();
|
||||
if (ll != ll_check) {
|
||||
System.err.println("Runtime test using long long failed. ll=" + ll + " ll_check=" + ll_check);
|
||||
System.exit(1);
|
||||
throw new RuntimeException("Runtime test using long long failed. ll=" + ll + " ll_check=" + ll_check);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -75,8 +74,7 @@ public class long_long_runme {
|
|||
long_long.setUll(ull);
|
||||
BigInteger ull_check = long_long.getUll();
|
||||
if (ull.compareTo(ull_check) != 0) {
|
||||
System.err.println("Runtime test using unsigned long long failed. ull=" + ull.toString() + " ull_check=" + ull_check.toString());
|
||||
System.exit(1);
|
||||
throw new RuntimeException("Runtime test using unsigned long long failed. ull=" + ull.toString() + " ull_check=" + ull_check.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
import namespace_forward_declaration.*;
|
||||
|
||||
public class namespace_forward_declaration_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("namespace_forward_declaration");
|
||||
} 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[]) {
|
||||
XXX xxx = new XXX();
|
||||
namespace_forward_declaration.testXXX1(xxx);
|
||||
namespace_forward_declaration.testXXX2(xxx);
|
||||
namespace_forward_declaration.testXXX3(xxx);
|
||||
YYY yyy = new YYY();
|
||||
namespace_forward_declaration.testYYY1(yyy);
|
||||
namespace_forward_declaration.testYYY2(yyy);
|
||||
namespace_forward_declaration.testYYY3(yyy);
|
||||
}
|
||||
}
|
||||
|
||||
23
Examples/test-suite/java/naturalvar_more_runme.java
Normal file
23
Examples/test-suite/java/naturalvar_more_runme.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
import naturalvar_more.*;
|
||||
|
||||
public class naturalvar_more_runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("naturalvar_more");
|
||||
} 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[])
|
||||
{
|
||||
S s = new S();
|
||||
if (!s.getConst_string_member().equals("initial string value"))
|
||||
throw new RuntimeException("Test 1 fail");
|
||||
s.setString_member("some member value");
|
||||
if (!s.getString_member().equals("some member value"))
|
||||
throw new RuntimeException("Test 2 fail");
|
||||
}
|
||||
}
|
||||
37
Examples/test-suite/java/naturalvar_onoff_runme.java
Normal file
37
Examples/test-suite/java/naturalvar_onoff_runme.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
import naturalvar_onoff.*;
|
||||
|
||||
public class naturalvar_onoff_runme {
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("naturalvar_onoff");
|
||||
} 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[])
|
||||
{
|
||||
boolean fail = true;
|
||||
Vars vars = new Vars();
|
||||
|
||||
fail = true; try {
|
||||
vars.setMember1On(null);
|
||||
} catch(NullPointerException e) {fail = false;} if (fail) throw new RuntimeException("Failed");
|
||||
|
||||
vars.setMember2Off(null);
|
||||
|
||||
vars.setMember3Off(null);
|
||||
|
||||
fail = true; try {
|
||||
vars.setMember3On(null);
|
||||
} catch(NullPointerException e) {fail = false;} if (fail) throw new RuntimeException("Failed");
|
||||
|
||||
vars.setMember4Off(null);
|
||||
|
||||
fail = true; try {
|
||||
vars.setMember4On(null);
|
||||
} catch(NullPointerException e) {fail = false;} if (fail) throw new RuntimeException("Failed");
|
||||
}
|
||||
}
|
||||
|
|
@ -14,59 +14,59 @@ public class nested_class_runme {
|
|||
|
||||
public static void main(String argv[]) {
|
||||
Outer outer = new Outer();
|
||||
SWIGTYPE_p_Outer__InnerStruct1 is1 = outer.makeInnerStruct1();
|
||||
SWIGTYPE_p_Outer__InnerClass1 ic1 = outer.makeInnerClass1();
|
||||
SWIGTYPE_p_Outer__InnerUnion1 iu1 = outer.makeInnerUnion1();
|
||||
Outer.InnerStruct1 is1 = outer.makeInnerStruct1();
|
||||
Outer.InnerClass1 ic1 = outer.makeInnerClass1();
|
||||
Outer.InnerUnion1 iu1 = outer.makeInnerUnion1();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerStruct2 is2 = outer.makeInnerStruct2();
|
||||
SWIGTYPE_p_Outer__InnerClass2 ic2 = outer.makeInnerClass2();
|
||||
SWIGTYPE_p_Outer__InnerUnion2 iu2 = outer.makeInnerUnion2();
|
||||
Outer.InnerStruct2 is2 = outer.makeInnerStruct2();
|
||||
Outer.InnerClass2 ic2 = outer.makeInnerClass2();
|
||||
Outer.InnerUnion2 iu2 = outer.makeInnerUnion2();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerClass4Typedef ic4 = outer.makeInnerClass4Typedef();
|
||||
SWIGTYPE_p_Outer__InnerStruct4Typedef is4 = outer.makeInnerStruct4Typedef();
|
||||
SWIGTYPE_p_Outer__InnerUnion4Typedef iu4 = outer.makeInnerUnion4Typedef();
|
||||
Outer.InnerClass4Typedef ic4 = outer.makeInnerClass4Typedef();
|
||||
Outer.InnerStruct4Typedef is4 = outer.makeInnerStruct4Typedef();
|
||||
Outer.InnerUnion4Typedef iu4 = outer.makeInnerUnion4Typedef();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerClass5 ic5 = outer.makeInnerClass5();
|
||||
SWIGTYPE_p_Outer__InnerStruct5 is5 = outer.makeInnerStruct5();
|
||||
SWIGTYPE_p_Outer__InnerUnion5 iu5 = outer.makeInnerUnion5();
|
||||
Outer.InnerClass5Typedef ic5 = outer.makeInnerClass5();
|
||||
Outer.InnerStruct5Typedef is5 = outer.makeInnerStruct5();
|
||||
Outer.InnerUnion5Typedef iu5 = outer.makeInnerUnion5();
|
||||
|
||||
ic5 = outer.makeInnerClass5Typedef();
|
||||
is5 = outer.makeInnerStruct5Typedef();
|
||||
iu5 = outer.makeInnerUnion5Typedef();
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultiple im1 = outer.getMultipleInstance1();
|
||||
SWIGTYPE_p_Outer__InnerMultiple im2 = outer.getMultipleInstance2();
|
||||
SWIGTYPE_p_Outer__InnerMultiple im3 = outer.getMultipleInstance3();
|
||||
SWIGTYPE_p_Outer__InnerMultiple im4 = outer.getMultipleInstance4();
|
||||
Outer.InnerMultiple im1 = outer.getMultipleInstance1();
|
||||
Outer.InnerMultiple im2 = outer.getMultipleInstance2();
|
||||
Outer.InnerMultiple im3 = outer.getMultipleInstance3();
|
||||
Outer.InnerMultiple im4 = outer.getMultipleInstance4();
|
||||
}
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
|
||||
Outer.InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
||||
Outer.InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
||||
Outer.InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
||||
Outer.InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
|
||||
}
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
|
||||
Outer.InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
||||
Outer.InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
||||
Outer.InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
||||
Outer.InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
|
||||
}
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef1 mat1 = outer.makeInnerMultipleAnonTypedef1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef2 mat2 = outer.makeInnerMultipleAnonTypedef2();
|
||||
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef3 mat3 = outer.makeInnerMultipleAnonTypedef3();
|
||||
Outer.InnerMultipleAnonTypedef1 mat1 = outer.makeInnerMultipleAnonTypedef1();
|
||||
Outer.InnerMultipleAnonTypedef1 mat2 = outer.makeInnerMultipleAnonTypedef2();
|
||||
SWIGTYPE_p_p_Outer__InnerMultipleAnonTypedef1 mat3 = outer.makeInnerMultipleAnonTypedef3();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt = outer.makeInnerMultipleNamedTypedef();
|
||||
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt1 = outer.makeInnerMultipleNamedTypedef1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt2 = outer.makeInnerMultipleNamedTypedef2();
|
||||
Outer.InnerMultipleNamedTypedef1 mnt = outer.makeInnerMultipleNamedTypedef();
|
||||
Outer.InnerMultipleNamedTypedef1 mnt1 = outer.makeInnerMultipleNamedTypedef1();
|
||||
Outer.InnerMultipleNamedTypedef1 mnt2 = outer.makeInnerMultipleNamedTypedef2();
|
||||
SWIGTYPE_p_p_Outer__InnerMultipleNamedTypedef mnt3 = outer.makeInnerMultipleNamedTypedef3();
|
||||
}
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerSameName isn = outer.makeInnerSameName();
|
||||
Outer.InnerSameName isn = outer.makeInnerSameName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,21 +17,28 @@ public class nested_structs_runme {
|
|||
nested_structs.setValues(outer, 10);
|
||||
|
||||
Outer_inner1 inner1 = outer.getInner1();
|
||||
Outer_inner2 inner2 = outer.getInner2();
|
||||
Outer_inner3 inner3 = outer.getInner3();
|
||||
Outer_inner4 inner4 = outer.getInner4();
|
||||
Outer_inner1 inner2 = outer.getInner2();
|
||||
Outer_inner1 inner3 = outer.getInner3();
|
||||
Outer_inner1 inner4 = outer.getInner4();
|
||||
if (inner1.getVal() != 10) throw new RuntimeException("failed inner1");
|
||||
if (inner2.getVal() != 20) throw new RuntimeException("failed inner2");
|
||||
if (inner3.getVal() != 20) throw new RuntimeException("failed inner3");
|
||||
if (inner4.getVal() != 40) throw new RuntimeException("failed inner4");
|
||||
|
||||
Outer_inside1 inside1 = outer.getInside1();
|
||||
Outer_inside2 inside2 = outer.getInside2();
|
||||
Outer_inside3 inside3 = outer.getInside3();
|
||||
Outer_inside4 inside4 = outer.getInside4();
|
||||
Named inside1 = outer.getInside1();
|
||||
Named inside2 = outer.getInside2();
|
||||
Named inside3 = outer.getInside3();
|
||||
Named inside4 = outer.getInside4();
|
||||
if (inside1.getVal() != 100) throw new RuntimeException("failed inside1");
|
||||
if (inside2.getVal() != 200) throw new RuntimeException("failed inside2");
|
||||
if (inside3.getVal() != 200) throw new RuntimeException("failed inside3");
|
||||
if (inside4.getVal() != 400) throw new RuntimeException("failed inside4");
|
||||
|
||||
outer.getInner1().setVal(11);
|
||||
if (inner1.getVal() != 11) throw new RuntimeException("failed inner1 assignment");
|
||||
Named named = new Named();
|
||||
named.setVal(22);
|
||||
outer.setInside2(named);
|
||||
if (outer.getInside2().getVal() != 22) throw new RuntimeException("failed inside2 assignment");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,17 @@ public class preproc_line_file_runme {
|
|||
}
|
||||
}
|
||||
|
||||
public static String FILENAME_WINDOWS = "..\\..\\..\\..\\Examples\\test-suite\\preproc_line_file.i";
|
||||
public static String FILENAME_UNIX = "../../../../Examples/test-suite/preproc_line_file.i";
|
||||
private static void test_file(String file, String suffix) throws Throwable
|
||||
{
|
||||
String FILENAME_WINDOWS = "Examples\\test-suite\\preproc_line_file.i";
|
||||
String FILENAME_UNIX = "Examples/test-suite/preproc_line_file.i";
|
||||
|
||||
// We don't test for exact equality here because the file names are relative to the build directory, which can be different from the source directory,
|
||||
// under Unix. But they do need to end with the same path components.
|
||||
if (!file.endsWith(FILENAME_UNIX + suffix) && !file.endsWith(FILENAME_WINDOWS + suffix))
|
||||
throw new RuntimeException("file \"" + file + "\" doesn't end with " + FILENAME_UNIX + suffix);
|
||||
}
|
||||
|
||||
public static void main(String argv[]) throws Throwable
|
||||
{
|
||||
int myline = preproc_line_file.MYLINE;
|
||||
|
|
@ -22,13 +31,8 @@ public class preproc_line_file_runme {
|
|||
if (myline + 100 + 1 != myline_adjusted)
|
||||
throw new RuntimeException("preproc failure");
|
||||
|
||||
String myfile = preproc_line_file.MYFILE;
|
||||
String myfile_adjusted = preproc_line_file.MYFILE_ADJUSTED;
|
||||
if (!(myfile.equals(FILENAME_UNIX) || myfile.equals(FILENAME_WINDOWS)))
|
||||
throw new RuntimeException("preproc failure");
|
||||
|
||||
if (!(myfile_adjusted.equals(FILENAME_UNIX + ".bak") || myfile_adjusted.equals(FILENAME_WINDOWS + ".bak")))
|
||||
throw new RuntimeException("preproc failure");
|
||||
test_file(preproc_line_file.MYFILE, "");
|
||||
test_file(preproc_line_file.MYFILE_ADJUSTED, ".bak");
|
||||
|
||||
if (!preproc_line_file.MY_STRINGNUM_A.equals("my15"))
|
||||
throw new RuntimeException("preproc failed MY_STRINGNUM_A");
|
||||
|
|
@ -57,9 +61,7 @@ public class preproc_line_file_runme {
|
|||
if (preproc_line_file.INLINE_LINE != 87)
|
||||
throw new RuntimeException("preproc failure");
|
||||
|
||||
String inlineFile = preproc_line_file.INLINE_FILE;
|
||||
if (!(inlineFile.equals(FILENAME_UNIX) || inlineFile.equals(FILENAME_WINDOWS)))
|
||||
throw new RuntimeException("preproc failure");
|
||||
test_file(preproc_line_file.INLINE_FILE, "");
|
||||
|
||||
if (Slash.LINE_NUM != 93)
|
||||
throw new RuntimeException("preproc failure");
|
||||
|
|
|
|||
|
|
@ -18,47 +18,47 @@ public class primitive_ref_runme {
|
|||
public static void main(String argv[]) {
|
||||
|
||||
if (primitive_ref.ref_int(3) != 3) {
|
||||
System.err.println( "ref_int failed!" );
|
||||
throw new RuntimeException( "ref_int failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_uint(3) != 3) {
|
||||
System.err.println( "ref_uint failed!" );
|
||||
throw new RuntimeException( "ref_uint failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_short((short)3) != 3) {
|
||||
System.err.println( "ref_short failed!" );
|
||||
throw new RuntimeException( "ref_short failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_ushort(3) != 3) {
|
||||
System.err.println( "ref_ushort failed!" );
|
||||
throw new RuntimeException( "ref_ushort failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_long(3) != 3) {
|
||||
System.err.println( "ref_long failed!" );
|
||||
throw new RuntimeException( "ref_long failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_ulong(3) != 3) {
|
||||
System.err.println( "ref_ulong failed!" );
|
||||
throw new RuntimeException( "ref_ulong failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_schar((byte)3) != 3) {
|
||||
System.err.println( "ref_schar failed!" );
|
||||
throw new RuntimeException( "ref_schar failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_uchar((short)3) != 3) {
|
||||
System.err.println( "ref_uchar failed!" );
|
||||
throw new RuntimeException( "ref_uchar failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_bool(true) != true) {
|
||||
System.err.println( "ref_bool failed!" );
|
||||
throw new RuntimeException( "ref_bool failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_float((float)3.5) != 3.5) {
|
||||
System.err.println( "ref_float failed!" );
|
||||
throw new RuntimeException( "ref_float failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_double(3.5) != 3.5) {
|
||||
System.err.println( "ref_double failed!" );
|
||||
throw new RuntimeException( "ref_double failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_char('x') != 'x') {
|
||||
System.err.println( "ref_char failed!" );
|
||||
throw new RuntimeException( "ref_char failed!" );
|
||||
}
|
||||
if (primitive_ref.ref_longlong(0x123456789ABCDEF0L) != 0x123456789ABCDEF0L) {
|
||||
System.err.println( "ref_longlong failed!" );
|
||||
throw new RuntimeException( "ref_longlong failed!" );
|
||||
}
|
||||
BigInteger bi = new BigInteger("18446744073709551615"); //0xFFFFFFFFFFFFFFFFL
|
||||
if (bi.compareTo(primitive_ref.ref_ulonglong(bi)) != 0) {
|
||||
System.err.println( "ref_ulonglong failed!" );
|
||||
throw new RuntimeException( "ref_ulonglong failed!" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@ public class rename_pcre_encoder_runme {
|
|||
public static void main(String argv[])
|
||||
{
|
||||
SomeWidget w = new SomeWidget();
|
||||
w.putBorderWidth(17);
|
||||
if ( w.getBorderWidth() != 17 )
|
||||
w.put_borderWidth(17);
|
||||
if ( w.get_borderWidth() != 17 )
|
||||
throw new RuntimeException(String.format("Border with should be 17, not %d",
|
||||
w.getBorderWidth()));
|
||||
w.get_borderWidth()));
|
||||
if ( rename_pcre_encoder.StartINSAneAndUNSAvoryTraNSAtlanticRaNSAck() != 42 )
|
||||
throw new RuntimeException("Unexpected result of renamed function call");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ public class special_variable_macros_runme {
|
|||
throw new RuntimeException("test failed");
|
||||
if (!special_variable_macros.testMary(name).equals("SWIGTYPE_p_NameWrap"))
|
||||
throw new RuntimeException("test failed");
|
||||
if (!special_variable_macros.testJames(name).equals("SWIGTYPE_Name"))
|
||||
throw new RuntimeException("test failed");
|
||||
if (!special_variable_macros.testJim(name).equals("multiname num"))
|
||||
throw new RuntimeException("test failed");
|
||||
if (special_variable_macros.testJohn(new PairIntBool(10, false)) != 123)
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ public class special_variables_runme {
|
|||
public static void main(String argv[])
|
||||
{
|
||||
verify(special_variables.ExceptionVars(1.0, 2.0),
|
||||
"result = Space::exceptionvars(arg1,arg2); Space::exceptionvars ExceptionVars Java_special_1variables_special_1variablesJNI_ExceptionVars");
|
||||
"result = Space::exceptionvars(arg1,arg2); Space::exceptionvars ExceptionVars Java_special_1variables_special_1variablesJNI_ExceptionVars ");
|
||||
|
||||
verify(special_variables.overloadedmethod(),
|
||||
"result = Space::overloadedmethod(); Space::overloadedmethod overloadedmethod __SWIG_1 Java_special_1variables_special_1variablesJNI_overloadedmethod_1_1SWIG_11");
|
||||
"result = Space::overloadedmethod(); Space::overloadedmethod overloadedmethod __SWIG_1 Java_special_1variables_special_1variablesJNI_overloadedmethod_1_1SWIG_11 ");
|
||||
|
||||
verify(special_variables.overloadedmethod(10.0),
|
||||
"result = Space::overloadedmethod(arg1); Space::overloadedmethod overloadedmethod __SWIG_0 Java_special_1variables_special_1variablesJNI_overloadedmethod_1_1SWIG_10");
|
||||
"result = Space::overloadedmethod(arg1); Space::overloadedmethod overloadedmethod __SWIG_0 Java_special_1variables_special_1variablesJNI_overloadedmethod_1_1SWIG_10 ");
|
||||
|
||||
ABC a = new ABC(0, 0.0);
|
||||
verify(special_variables.getDeclaration(), "SpaceNamespace::ABC::ABC(int,double) SpaceNamespace::ABC::ABC(int,double)");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
import template_namespace_forward_declaration.*;
|
||||
|
||||
public class template_namespace_forward_declaration_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_namespace_forward_declaration");
|
||||
} 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[]) {
|
||||
XXXInt xxx = new XXXInt();
|
||||
template_namespace_forward_declaration.testXXX1(xxx);
|
||||
template_namespace_forward_declaration.testXXX2(xxx);
|
||||
template_namespace_forward_declaration.testXXX3(xxx);
|
||||
YYYInt yyy = new YYYInt();
|
||||
template_namespace_forward_declaration.testYYY1(yyy);
|
||||
template_namespace_forward_declaration.testYYY2(yyy);
|
||||
template_namespace_forward_declaration.testYYY3(yyy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -25,6 +25,11 @@ public class template_nested_runme {
|
|||
T_NestedOuterTemplateDouble tn = new T_NestedOuterTemplateDouble();
|
||||
if (tn.hohum(-12.3) != -12.3)
|
||||
throw new RuntimeException("it failed");
|
||||
OuterClass.T_OuterClassInner1Int inner1 = new OuterClass().useInner1(new OuterClass.T_OuterClassInner1Int());
|
||||
OuterClass.T_OuterClassInner2NormalClass inner2 = new OuterClass.T_OuterClassInner2NormalClass();
|
||||
inner2.setEmbeddedVar(2);
|
||||
OuterClass.T_OuterClassInner2NormalClass inner22 = new OuterClass().useInner2Again(inner2);
|
||||
OuterClass.T_OuterClassInner1Double inner3 = new OuterClass.T_OuterClassInner1Double();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
26
Examples/test-suite/java/template_typedef_typedef_runme.java
Normal file
26
Examples/test-suite/java/template_typedef_typedef_runme.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import template_typedef_typedef.*;
|
||||
|
||||
public class template_typedef_typedef_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_typedef_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[]) {
|
||||
ObjectBase ob1 = new ObjectBase();
|
||||
ob1.getBlabla1(new ObjectBase());
|
||||
Object2Base ob2 = new Object2Base();
|
||||
ob2.getBlabla2(new Object2Base());
|
||||
|
||||
Factory factory = new Factory();
|
||||
factory.getBlabla3(new ObjectBase());
|
||||
factory.getBlabla4(new Object2Base());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
import template_using_directive_and_declaration_forward.*;
|
||||
|
||||
public class template_using_directive_and_declaration_forward_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_using_directive_and_declaration_forward");
|
||||
} 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[])
|
||||
{
|
||||
template_using_directive_and_declaration_forward.useit1(new Thing1Int());
|
||||
template_using_directive_and_declaration_forward.useit1a(new Thing1Int());
|
||||
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.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.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.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.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.useit7a(new Thing7Int());
|
||||
template_using_directive_and_declaration_forward.useit7b(new Thing7Int());
|
||||
template_using_directive_and_declaration_forward.useit7c(new Thing7Int());
|
||||
template_using_directive_and_declaration_forward.useit7d(new Thing7Int());
|
||||
}
|
||||
}
|
||||
|
|
@ -34,14 +34,12 @@ public class unions_runme {
|
|||
eut.getUni().setSmall(small);
|
||||
short Jill1 = eut.getUni().getSmall().getJill();
|
||||
if (Jill1 != 200) {
|
||||
System.err.println("Runtime test1 failed. eut.uni.small.jill=" + Jill1);
|
||||
System.exit(1);
|
||||
throw new RuntimeException("Runtime test1 failed. eut.uni.small.jill=" + Jill1);
|
||||
}
|
||||
|
||||
int Num1 = eut.getNumber();
|
||||
if (Num1 != 1) {
|
||||
System.err.println("Runtime test2 failed. eut.number=" + Num1);
|
||||
System.exit(1);
|
||||
throw new RuntimeException("Runtime test2 failed. eut.number=" + Num1);
|
||||
}
|
||||
|
||||
// Secondly check the BigStruct in EmbeddedUnionTest
|
||||
|
|
@ -49,20 +47,17 @@ public class unions_runme {
|
|||
eut.getUni().setBig(big);
|
||||
int Jack1 = eut.getUni().getBig().getJack();
|
||||
if (Jack1 != 300) {
|
||||
System.err.println("Runtime test3 failed. eut.uni.big.jack=" + Jack1);
|
||||
System.exit(1);
|
||||
throw new RuntimeException("Runtime test3 failed. eut.uni.big.jack=" + Jack1);
|
||||
}
|
||||
|
||||
short Jill2 = eut.getUni().getBig().getSmallstruct().getJill();
|
||||
if (Jill2 != 200) {
|
||||
System.err.println("Runtime test4 failed. eut.uni.big.smallstruct.jill=" + Jill2);
|
||||
System.exit(1);
|
||||
throw new RuntimeException("Runtime test4 failed. eut.uni.big.smallstruct.jill=" + Jill2);
|
||||
}
|
||||
|
||||
int Num2 = eut.getNumber();
|
||||
if (Num2 != 2) {
|
||||
System.err.println("Runtime test5 failed. eut.number=" + Num2);
|
||||
System.exit(1);
|
||||
throw new RuntimeException("Runtime test5 failed. eut.number=" + Num2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
import using_directive_and_declaration_forward.*;
|
||||
|
||||
public class using_directive_and_declaration_forward_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("using_directive_and_declaration_forward");
|
||||
} 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[])
|
||||
{
|
||||
using_directive_and_declaration_forward.useit1(new Thing1());
|
||||
using_directive_and_declaration_forward.useit1a(new Thing1());
|
||||
using_directive_and_declaration_forward.useit1b(new Thing1());
|
||||
using_directive_and_declaration_forward.useit1c(new Thing1());
|
||||
|
||||
using_directive_and_declaration_forward.useit2(new Thing2());
|
||||
using_directive_and_declaration_forward.useit2a(new Thing2());
|
||||
using_directive_and_declaration_forward.useit2b(new Thing2());
|
||||
using_directive_and_declaration_forward.useit2c(new Thing2());
|
||||
using_directive_and_declaration_forward.useit2d(new Thing2());
|
||||
|
||||
using_directive_and_declaration_forward.useit3(new Thing3());
|
||||
using_directive_and_declaration_forward.useit3a(new Thing3());
|
||||
using_directive_and_declaration_forward.useit3b(new Thing3());
|
||||
using_directive_and_declaration_forward.useit3c(new Thing3());
|
||||
using_directive_and_declaration_forward.useit3d(new Thing3());
|
||||
|
||||
using_directive_and_declaration_forward.useit4(new Thing4());
|
||||
using_directive_and_declaration_forward.useit4a(new Thing4());
|
||||
using_directive_and_declaration_forward.useit4b(new Thing4());
|
||||
using_directive_and_declaration_forward.useit4c(new Thing4());
|
||||
using_directive_and_declaration_forward.useit4d(new Thing4());
|
||||
|
||||
using_directive_and_declaration_forward.useit5(new Thing5());
|
||||
using_directive_and_declaration_forward.useit5a(new Thing5());
|
||||
using_directive_and_declaration_forward.useit5b(new Thing5());
|
||||
using_directive_and_declaration_forward.useit5c(new Thing5());
|
||||
using_directive_and_declaration_forward.useit5d(new Thing5());
|
||||
|
||||
|
||||
using_directive_and_declaration_forward.useit7(new Thing7());
|
||||
using_directive_and_declaration_forward.useit7a(new Thing7());
|
||||
using_directive_and_declaration_forward.useit7b(new Thing7());
|
||||
using_directive_and_declaration_forward.useit7c(new Thing7());
|
||||
using_directive_and_declaration_forward.useit7d(new Thing7());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
import using_directive_and_declaration.*;
|
||||
|
||||
public class using_directive_and_declaration_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("using_directive_and_declaration");
|
||||
} 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[])
|
||||
{
|
||||
using_directive_and_declaration.useit1(new Thing1());
|
||||
using_directive_and_declaration.useit2(new Thing2());
|
||||
using_directive_and_declaration.useit3(new Thing3());
|
||||
using_directive_and_declaration.useit4(new Thing4());
|
||||
using_directive_and_declaration.useit5(new Thing5());
|
||||
Thing6a t6a = new Thing6a();
|
||||
t6a.a();
|
||||
Thing6 t6b = new Thing6();
|
||||
t6b.b();
|
||||
using_directive_and_declaration.useit6(t6a, t6b);
|
||||
using_directive_and_declaration.useit7(new Thing7());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue