update swig on windows

This commit is contained in:
Bassem Girgis
2019-08-04 21:38:19 -05:00
parent 8414b7136b
commit 76ad52be58
5943 changed files with 91790 additions and 71892 deletions

View File

@@ -0,0 +1,172 @@
import com.sun.javadoc.*;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Map;
import java.util.Set;
import java.util.Iterator;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.FileOutputStream;
import java.io.IOException;
public class CommentParser {
private static Map<String, String> m_parsedComments = new HashMap<String, String>();
public static boolean start(RootDoc root) {
/*
* This method is called by 'javadoc' and gets the whole parsed java
* file, we get comments and store them
*/
for (ClassDoc classDoc : root.classes()) {
if (classDoc.getRawCommentText().length() > 0)
m_parsedComments.put(classDoc.qualifiedName(), classDoc.getRawCommentText());
for (FieldDoc f : classDoc.enumConstants()) {
if (f.getRawCommentText().length() > 0)
m_parsedComments.put(f.qualifiedName(), f.getRawCommentText());
}
for (FieldDoc f : classDoc.fields()) {
if (f.getRawCommentText().length() > 0)
m_parsedComments.put(f.qualifiedName(), f.getRawCommentText());
}
for (ConstructorDoc c : classDoc.constructors()) {
if (c.getRawCommentText().length() > 0)
m_parsedComments.put(c.toString(), c.getRawCommentText());
}
for (MethodDoc m : classDoc.methods()) {
if (m.getRawCommentText().length() > 0)
m_parsedComments.put(m.toString(), m.getRawCommentText());
}
}
return true;
}
public int check(Map<String, String> wantedComments) {
int errorCount=0;
Iterator<Entry<String, String>> it = m_parsedComments.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> e = (Entry<String, String>) it.next();
String actualStr = e.getValue();
String wantedStr = wantedComments.get(e.getKey());
// this may be weird, but I don't know any more effective solution
actualStr = actualStr.replace(" ", "");
actualStr = actualStr.replaceAll("\t", "");
actualStr = actualStr.replace("\n", "");
// Removing of <br> is temporary solution, since adding of
// <br> tag requires changes in all tests. However, <br>
// tag should be added more selectively and when this is
// implemented, tests should be updated.
actualStr = actualStr.replace("<br>", "");
if (wantedStr != null) {
wantedStr = wantedStr.replace(" ", "");
wantedStr = wantedStr.replace("\t", "");
wantedStr = wantedStr.replace("\n", "");
wantedStr = wantedStr.replace("<br>", "");
}
/* The following lines replace multiple whitespaces with a single one.
Although this would be more exact testing, it would also require
more work on test maintenance.
actualStr = actualStr.replace('\t', ' ');
actualStr = actualStr.replaceAll(" +", " ");
// actualStr = actualStr.replace("\n", "");
if (wantedStr != null) {
wantedStr = wantedStr.replace('\t', ' ');
wantedStr = wantedStr.replaceAll(" +", " ");
// wantedStr = wantedStr.replace("\n", "");
} */
if (!actualStr.equals(wantedStr)) {
System.out.println("\n\n////////////////////////////////////////////////////////////////////////");
System.out.println("Documentation comments for '" + e.getKey() + "' do not match!");
String expectedFileName = "expected.txt";
String gotFileName = "got.txt";
System.out.println("Output is also saved to files '" + expectedFileName +
"' and '" + gotFileName + "'");
// here we print original strings, for nicer output
System.out.println("\n\n---\nexpected:\n" + wantedComments.get(e.getKey()));
System.out.println("\n\n---\ngot:\n" + e.getValue());
try {
// write expected string to file
BufferedWriter expectedFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(expectedFileName)));
expectedFile.write(wantedComments.get(e.getKey()));
expectedFile.close();
// write translated string to file
BufferedWriter gotFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(gotFileName)));
gotFile.write(e.getValue().replace("<br>", ""));
gotFile.close();
} catch (IOException ex) {
System.out.println("Error when writing output to file: " + ex);
}
errorCount++;
}
}
if (m_parsedComments.size() != wantedComments.size()) {
System.out.println("Mismatch in the number of comments!\n Expected: " +
wantedComments.size() + "\n Parsed: " +
m_parsedComments.size());
System.out.println("Expected keys: ");
printKeys(wantedComments);
System.out.println("Parsed keys: ");
printKeys(m_parsedComments);
errorCount++;
}
return errorCount > 0 ? 1 : 0;
}
private void printKeys(Map<String, String> map) {
Set<String> keys = map.keySet();
for (String key : keys) {
System.out.println(" " + key);
}
}
public static void printCommentListForJavaSource() {
Iterator< Entry<String, String> > it = m_parsedComments.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> e = (Entry<String, String>) it.next();
String commentText = e.getValue();
commentText = commentText.replace("\\", "\\\\");
commentText = commentText.replace("\"", "\\\"");
commentText = commentText.replace("\n", "\\n\" +\n\t\t\"");
System.out.format("wantedComments.put(\"%s\",\n\t\t\"%s\");\n", e.getKey(), commentText);
}
}
public static void main(String argv[]) {
if (argv.length<1) {
System.out.format("Usage:\n\tCommentParser <package to parse>\n");
System.exit(1);
}
com.sun.tools.javadoc.Main.execute("The comment parser program",
"CommentParser", new String[]{"-quiet", argv[0]});
// if we are run as standalone app, print the list of found comments as it would appear in java source
printCommentListForJavaSource();
}
}

View File

@@ -0,0 +1,137 @@
#######################################################################
# Makefile for java test-suite
#######################################################################
LANGUAGE = java
JAVA = @JAVA@
JAVAC = @JAVAC@
JAVAFLAGS = @JAVAFLAGS@
JAVA_CLASSPATH_SEP = @JAVA_CLASSPATH_SEP@
JAVA_TOOLS_JAR = @JAVA_TOOLS_JAR@
SCRIPTSUFFIX = _runme.java
srcdir = @srcdir@
top_srcdir = ../@top_srcdir@
top_builddir = ../@top_builddir@
C_TEST_CASES = \
java_lib_arrays \
java_lib_various
CPP_TEST_CASES = \
enum_thorough_proper \
enum_thorough_simple \
enum_thorough_typeunsafe \
exception_partial_info \
intermediary_classname \
java_constants \
java_director \
java_director_assumeoverride \
java_director_exception_feature \
java_director_exception_feature_nspace \
java_director_ptrclass \
java_director_typemaps \
java_director_typemaps_ptr \
java_enums \
java_jnitypes \
java_lib_arrays_dimensionless \
java_lib_various \
java_nspacewithoutpackage \
java_pgcpp \
java_pragmas \
java_prepost \
java_throws \
java_typemaps_proxy \
java_typemaps_typewrapper \
li_std_list \
li_std_map \
li_std_set \
# li_boost_intrusive_ptr
CPP11_TEST_CASES = \
cpp11_shared_ptr_const \
cpp11_shared_ptr_nullptr_in_containers \
cpp11_shared_ptr_overload \
cpp11_shared_ptr_upcast \
cpp11_std_unordered_map \
cpp11_std_unordered_set \
cpp11_strongly_typed_enumerations_simple \
DOXYGEN_TEST_CASES := \
doxygen_parsing_enums_simple \
doxygen_parsing_enums_proper \
doxygen_parsing_enums_typesafe \
doxygen_parsing_enums_typeunsafe \
include $(srcdir)/../common.mk
# Overridden variables here
SRCDIR = ../$(srcdir)/
JAVA_PACKAGE = $*
JAVA_PACKAGEOPT = -package $(JAVA_PACKAGE)
SWIGOPT += $(JAVA_PACKAGEOPT)
# Custom tests - tests with additional commandline options
cpp17_nspace_nested_namespaces.%: JAVA_PACKAGE = $*Package
director_nspace.%: JAVA_PACKAGE = $*Package
director_nspace_director_name_collision.%: JAVA_PACKAGE = $*Package
java_director_exception_feature_nspace.%: JAVA_PACKAGE = $*Package
java_nspacewithoutpackage.%: JAVA_PACKAGEOPT =
multiple_inheritance_nspace.%: JAVA_PACKAGE = $*Package
nspace.%: JAVA_PACKAGE = $*Package
nspace_extend.%: JAVA_PACKAGE = $*Package
# Rules for the different types of tests
%.cpptest:
$(setup)
+(cd $(JAVA_PACKAGE) && $(swig_and_compile_cpp))
$(run_testcase)
%.ctest:
$(setup)
+(cd $(JAVA_PACKAGE) && $(swig_and_compile_c))
$(run_testcase)
%.multicpptest:
$(setup)
+(cd $(JAVA_PACKAGE) && $(swig_and_compile_multi_cpp))
$(run_testcase)
# Makes a directory for the testcase if it does not exist
setup = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
fi; \
if [ ! -d $(JAVA_PACKAGE) ]; then \
mkdir $(JAVA_PACKAGE); \
fi
# Doxygen test cases need to be compiled together with the CommentParser class
# which depends on com.sun.javadoc package which is located in this JAR.
CommentParser.class:
$(COMPILETOOL) $(JAVAC) -classpath $(JAVA_CLASSPATH) -d . $(srcdir)/CommentParser.java
JAVA_CLASSPATH := .
$(DOXYGEN_TEST_CASES:=.cpptest): JAVA_CLASSPATH := "$(JAVA_TOOLS_JAR)$(JAVA_CLASSPATH_SEP)."
$(DOXYGEN_TEST_CASES:=.cpptest): CommentParser.class
# Compiles java files then runs the testcase. A testcase is only run if
# a file is found which has _runme.java appended after the testcase name.
# Note Java uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows, SHLIB_PATH on HPUX and DYLD_LIBRARY_PATH on Mac OS X.
run_testcase = \
cd $(JAVA_PACKAGE) && $(COMPILETOOL) $(JAVAC) -classpath . `find . -name "*.java"` && cd .. && \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(COMPILETOOL) $(JAVAC) -classpath $(JAVA_CLASSPATH) -d . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
env LD_LIBRARY_PATH="$(JAVA_PACKAGE):$$LD_LIBRARY_PATH" PATH="$(JAVA_PACKAGE):$$PATH" SHLIB_PATH="$(JAVA_PACKAGE):$$SHLIB_PATH" DYLD_LIBRARY_PATH="$(JAVA_PACKAGE):$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) $(JAVAFLAGS) -classpath $(JAVA_CLASSPATH) $*_runme; \
fi
# Clean: remove testcase directories
%.clean:
@if [ -d $(JAVA_PACKAGE) ]; then \
rm -rf $(JAVA_PACKAGE); \
fi
clean:
@rm -f *.class hs_err*.log

View File

@@ -0,0 +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 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.

View File

@@ -0,0 +1,39 @@
import aggregate.*;
public class aggregate_runme {
static {
try {
System.loadLibrary("aggregate");
} 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[]) {
// Confirm that move() returns correct results under normal use
int result = aggregate.move(aggregate.UP);
if (result != aggregate.UP) throw new RuntimeException("UP failed");
result = aggregate.move(aggregate.DOWN);
if (result != aggregate.DOWN) throw new RuntimeException("DOWN failed");
result = aggregate.move(aggregate.LEFT);
if (result != aggregate.LEFT) throw new RuntimeException("LEFT failed");
result = aggregate.move(aggregate.RIGHT);
if (result != aggregate.RIGHT) throw new RuntimeException("RIGHT failed");
// Confirm that move() raises an exception when the contract is violated
try {
aggregate.move(0);
throw new RuntimeException("0 test failed");
}
catch (IllegalArgumentException e) {
}
}
}

View File

@@ -0,0 +1,74 @@
import allprotected.*;
public class allprotected_runme {
static {
try {
System.loadLibrary("allprotected");
} 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[])
{
MyProtectedBase mpb = new MyProtectedBase("MyProtectedBase");
mpb.accessProtected();
}
}
class MyProtectedBase extends ProtectedBase
{
MyProtectedBase(String name) {
super(name);
}
void accessProtected() {
String s = virtualMethod();
if (!s.equals("ProtectedBase"))
throw new RuntimeException("Failed");
Klass k = instanceMethod(new Klass("xyz"));
if (!k.getName().equals("xyz"))
throw new RuntimeException("Failed");
k = instanceOverloaded(new Klass("xyz"));
if (!k.getName().equals("xyz"))
throw new RuntimeException("Failed");
k = instanceOverloaded(new Klass("xyz"), "abc");
if (!k.getName().equals("abc"))
throw new RuntimeException("Failed");
k = ProtectedBase.staticMethod(new Klass("abc"));
if (!k.getName().equals("abc"))
throw new RuntimeException("Failed");
k = ProtectedBase.staticOverloaded(new Klass("xyz"));
if (!k.getName().equals("xyz"))
throw new RuntimeException("Failed");
k = ProtectedBase.staticOverloaded(new Klass("xyz"), "abc");
if (!k.getName().equals("abc"))
throw new RuntimeException("Failed");
setInstanceMemberVariable(30);
int i = getInstanceMemberVariable();
if (i != 30)
throw new RuntimeException("Failed");
setStaticMemberVariable(40);
i = getStaticMemberVariable();
if (i != 40)
throw new RuntimeException("Failed");
i = staticConstMemberVariable;
if (i != 20)
throw new RuntimeException("Failed");
setAnEnum(ProtectedBase.AnEnum.EnumVal1);
ProtectedBase.AnEnum ae = getAnEnum();
if (ae != ProtectedBase.AnEnum.EnumVal1)
throw new RuntimeException("Failed");
}
}

View File

@@ -0,0 +1,36 @@
import apply_signed_char.*;
public class apply_signed_char_runme {
static {
try {
System.loadLibrary("apply_signed_char");
} 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[]) {
byte smallnum = -127;
if (apply_signed_char.CharValFunction(smallnum) != smallnum) throw new RuntimeException("failed");
if (apply_signed_char.CCharValFunction(smallnum) != smallnum) throw new RuntimeException("failed");
if (apply_signed_char.CCharRefFunction(smallnum) != smallnum) throw new RuntimeException("failed");
apply_signed_char.setGlobalchar(smallnum);
if (apply_signed_char.getGlobalchar() != smallnum) throw new RuntimeException("failed");
if (apply_signed_char.getGlobalconstchar() != -110) throw new RuntimeException("failed");
DirectorTest d = new DirectorTest();
if (d.CharValFunction(smallnum) != smallnum) throw new RuntimeException("failed");
if (d.CCharValFunction(smallnum) != smallnum) throw new RuntimeException("failed");
if (d.CCharRefFunction(smallnum) != smallnum) throw new RuntimeException("failed");
d.setMemberchar(smallnum);
if (d.getMemberchar() != smallnum) throw new RuntimeException("failed");
if (d.getMemberconstchar() != -112) throw new RuntimeException("failed");
}
}

View File

@@ -0,0 +1,24 @@
import apply_strings.*;
public class apply_strings_runme {
static {
try {
System.loadLibrary("apply_strings");
} 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 String TEST_MESSAGE = "A message from target language to the C++ world and back again.";
public static void main(String argv[]) {
if (!apply_strings.UCharFunction(TEST_MESSAGE).equals(TEST_MESSAGE)) throw new RuntimeException("UCharFunction failed");
if (!apply_strings.SCharFunction(TEST_MESSAGE).equals(TEST_MESSAGE)) throw new RuntimeException("SCharFunction failed");
SWIGTYPE_p_char pChar = apply_strings.CharFunction(null);
if (pChar != null) throw new RuntimeException("CharFunction failed");
}
}

View File

@@ -0,0 +1,35 @@
import array_member.*;
public class array_member_runme {
static {
try {
System.loadLibrary("array_member");
} 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[])
{
Foo f = new Foo();
f.setData(array_member.getGlobal_data());
for (int i=0; i<8; i++) {
if (array_member.get_value(f.getData(),i) != array_member.get_value(array_member.getGlobal_data(),i))
throw new RuntimeException("Bad array assignment");
}
for (int i=0; i<8; i++) {
array_member.set_value(f.getData(),i,-i);
}
array_member.setGlobal_data(f.getData());
for (int i=0; i<8; i++) {
if (array_member.get_value(f.getData(),i) != array_member.get_value(array_member.getGlobal_data(),i))
throw new RuntimeException("Bad array assignment");
}
}
}

View File

@@ -0,0 +1,33 @@
// Two dimension arrays test
import arrays_global_twodim.*;
public class arrays_global_twodim_runme {
static {
try {
System.loadLibrary("arrays_global_twodim");
} 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[])
{
SWIGTYPE_p_a_4__int constintarray2d = arrays_global_twodim.getArray_const_i();
SWIGTYPE_p_a_4__int intarray2d = arrays_global_twodim.getArray_i();
// Set all the non const int array members from the const int array members and check
arrays_global_twodim.setArray_i(constintarray2d);
int count = 10;
for (int x=0; x<arrays_global_twodim.ARRAY_LEN_X; x++) {
for (int y=0; y<arrays_global_twodim.ARRAY_LEN_Y; y++) {
if ( arrays_global_twodim.get_2d_array(intarray2d, x, y) != count++) {
System.out.println("Value incorrect array_i[" + x + "][" + y + "]");
System.exit(1);
}
}
}
}
}

View File

@@ -0,0 +1,30 @@
import char_binary.*;
public class char_binary_runme {
static {
try {
System.loadLibrary("char_binary");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
Test t = new Test();
byte[] hile = "hile".getBytes();
byte[] hil0 = "hil\0".getBytes();
if (t.strlen(hile) != 4)
throw new RuntimeException("bad multi-arg typemap");
if (t.strlen(hil0) != 4)
throw new RuntimeException("bad multi-arg typemap");
if (t.ustrlen(hile) != 4)
throw new RuntimeException("bad multi-arg typemap");
if (t.ustrlen(hil0) != 4)
throw new RuntimeException("bad multi-arg typemap");
}
}

View File

@@ -0,0 +1,163 @@
import char_strings.*;
public class char_strings_runme {
static {
try {
System.loadLibrary("char_strings");
} 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 String CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible.";
private static String OTHERLAND_MSG = "Little message from the safe world.";
public static void main(String argv[]) {
long count = 10000;
long i = 0;
// get functions
for (i=0; i<count; i++) {
String str = char_strings.GetCharHeapString();
if (!str.equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test char get 1 failed, iteration " + i);
char_strings.DeleteCharHeapString();
}
for (i=0; i<count; i++) {
String str = char_strings.GetConstCharProgramCodeString();
if (!str.equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test char get 2 failed, iteration " + i);
char_strings.DeleteCharHeapString();
}
for (i=0; i<count; i++) {
String str = char_strings.GetCharStaticString();
if (!str.equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test char get 3 failed, iteration " + i);
}
for (i=0; i<count; i++) {
String str = char_strings.GetCharStaticStringFixed();
if (!str.equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test char get 4 failed, iteration " + i);
}
for (i=0; i<count; i++) {
String str = char_strings.GetConstCharStaticStringFixed();
if (!str.equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test char get 5 failed, iteration " + i);
}
// set functions
for (i=0; i<count; i++) {
if (!char_strings.SetCharHeapString(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test char set 1 failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetCharStaticString(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test char set 2 failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetCharArrayStaticString(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test char set 3 failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetConstCharHeapString(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test char set 4 failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetConstCharStaticString(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test char set 5 failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetConstCharArrayStaticString(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test char set 6 failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetCharConstStaticString(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test char set 7 failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetConstCharConstStaticString(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test char set 8 failed, iteration " + i);
}
// get set function
for (i=0; i<count; i++) {
String ping = OTHERLAND_MSG + i;
String pong = char_strings.CharPingPong(ping);
if (!ping.equals(pong))
throw new RuntimeException("Test PingPong 1 failed.\nExpected:" + ping + "\nReceived:" + pong);
}
// variables
for (i=0; i<count; i++) {
char_strings.setGlobal_char(OTHERLAND_MSG + i);
if (!char_strings.getGlobal_char().equals(OTHERLAND_MSG + i))
throw new RuntimeException("Test variables 1 failed, iteration " + i);
}
for (i=0; i<count; i++) {
char_strings.setGlobal_char_array1(OTHERLAND_MSG + i);
if (!char_strings.getGlobal_char_array1().equals(OTHERLAND_MSG + i))
throw new RuntimeException("Test variables 2 failed, iteration " + i);
}
for (i=0; i<count; i++) {
char_strings.setGlobal_char_array2(OTHERLAND_MSG + i);
if (!char_strings.getGlobal_char_array2().equals(OTHERLAND_MSG + i))
throw new RuntimeException("Test variables 3 failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.getGlobal_const_char().equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test variables 4 failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.getGlobal_const_char_array1().equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test variables 5 failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.getGlobal_const_char_array2().equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test variables 6 failed, iteration " + i);
}
// char *& tests
for (i=0; i<count; i++) {
String str = char_strings.GetCharPointerRef();
if (!str.equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test char pointer ref get failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetCharPointerRef(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test char pointer ref set failed, iteration " + i);
}
for (i=0; i<count; i++) {
String str = char_strings.GetConstCharPointerRef();
if (!str.equals(CPLUSPLUS_MSG))
throw new RuntimeException("Test const char pointer ref get failed, iteration " + i);
}
for (i=0; i<count; i++) {
if (!char_strings.SetConstCharPointerRef(OTHERLAND_MSG + i, i))
throw new RuntimeException("Test const char pointer ref set failed, iteration " + i);
}
}
}

View 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);
}
}

View File

@@ -0,0 +1,26 @@
import constant_directive.*;
public class constant_directive_runme {
static {
try {
System.loadLibrary("constant_directive");
} 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 (constant_directive.TYPE1_CONSTANT1.getVal() != 1)
throw new RuntimeException("fail");
if (constant_directive.TYPE1_CONSTANT2.getVal() != 2)
throw new RuntimeException("fail");
if (constant_directive.TYPE1_CONSTANT3.getVal() != 3)
throw new RuntimeException("fail");
if (constant_directive.TYPE1CONST_CONSTANT1.getVal() != 1)
throw new RuntimeException("fail");
if (constant_directive.TYPE1CPTR_CONSTANT1.getVal() != 1)
throw new RuntimeException("fail");
}
}

View File

@@ -0,0 +1,32 @@
import cpp11_alias_nested_template_scoping.*;
public class cpp11_alias_nested_template_scoping_runme {
static {
try {
System.loadLibrary("cpp11_alias_nested_template_scoping");
} 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[]) {
Yshort ys = new Yshort();
short val = 0;
val = ys.create1();
val = ys.create2();
val = ys.create3();
val = ys.create4();
val = ys.create5();
val = ys.create6();
val = ys.create7();
val = ys.create13();
val = ys.create15();
val = ys.create16();
val = ys.create17();
}
}

View 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(0);
check(ce.JJJ, 100);
check(ce.KKK, 200);
check(ce.LLL, 300);
check(ce.MMM(), 400);
check(ce.NNN(), 500);
}
}

View 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);
}
}

View File

@@ -0,0 +1,67 @@
import cpp11_raw_string_literals.*;
public class cpp11_raw_string_literals_runme {
static {
try {
System.loadLibrary("cpp11_raw_string_literals");
} 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 (cpp11_raw_string_literals.getL() != 100)
throw new RuntimeException("failed!");
if (cpp11_raw_string_literals.getU8() != 100)
throw new RuntimeException("failed!");
if (cpp11_raw_string_literals.getU() != 100)
throw new RuntimeException("failed!");
if (UStruct.U != 100)
throw new RuntimeException("failed!");
if (cpp11_raw_string_literals.getR() != 100)
throw new RuntimeException("failed!");
if (cpp11_raw_string_literals.getLR() != 100)
throw new RuntimeException("failed!");
if (cpp11_raw_string_literals.getU8R() != 100)
throw new RuntimeException("failed!");
if (cpp11_raw_string_literals.getUR() != 100)
throw new RuntimeException("failed!");
if (URStruct.UR != 100)
throw new RuntimeException("failed!");
if (!cpp11_raw_string_literals.getAa().equals("Wide string"))
throw new RuntimeException("failed!");
if (!cpp11_raw_string_literals.getBb().equals("UTF-8 string"))
throw new RuntimeException("failed!");
if (!cpp11_raw_string_literals.getXx().equals(")I'm an \"ascii\" \\ string."))
throw new RuntimeException("failed!");
if (!cpp11_raw_string_literals.getEe().equals(")I'm an \"ascii\" \\ string."))
throw new RuntimeException("failed!");
if (!cpp11_raw_string_literals.getFf().equals("I'm a \"raw wide\" \\ string."))
throw new RuntimeException("failed!");
if (!cpp11_raw_string_literals.getGg().equals("I'm a \"raw UTF-8\" \\ string."))
throw new RuntimeException("failed!");
if (!cpp11_raw_string_literalsConstants.mm.equals(")I'm an \"ascii\" \\ string constant with multiple\n\nlines."))
throw new RuntimeException("failed!");
}
}

View 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();
}
}

View File

@@ -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();
}
}

View File

@@ -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");
}
}
}

View 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));
}
}

View File

@@ -0,0 +1,60 @@
import cpp11_shared_ptr_overload.*;
public class cpp11_shared_ptr_overload_runme {
static {
try {
System.loadLibrary("cpp11_shared_ptr_overload");
} 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[])
{
String ret = null;
// ref
ret = cpp11_shared_ptr_overload.UseA(new MyType("123"));
if (!ret.equals("123 ref")) throw new RuntimeException("UseA fail:" + ret);
ret = cpp11_shared_ptr_overload.UseB(0, new MyType("123"));
if (!ret.equals("123 ref")) throw new RuntimeException("UseB fail:" + ret);
ret = cpp11_shared_ptr_overload.UseC(0, new MyType("123"), new MyType("456"));
if (!ret.equals("123 ref")) throw new RuntimeException("UseC fail:" + ret);
// sharedptr
ret = cpp11_shared_ptr_overload.UseX(new MyType("123"));
if (!ret.equals("123 sharedptr")) throw new RuntimeException("UseX fail:" + ret);
ret = cpp11_shared_ptr_overload.UseY(0, new MyType("123"));
if (!ret.equals("123 sharedptr")) throw new RuntimeException("UseY fail:" + ret);
ret = cpp11_shared_ptr_overload.UseZ(0, new MyType("123"), new MyType("456"));
if (!ret.equals("123 sharedptr")) throw new RuntimeException("UseZ fail:" + ret);
// Combo1-4
ret = cpp11_shared_ptr_overload.Combo1(new MyType("XXX"));
if (!ret.equals("XXXCombo1")) throw new RuntimeException("Combo1 fail:" + ret);
ret = cpp11_shared_ptr_overload.Combo2(new MyType("XXX"));
if (!ret.equals("XXXCombo2")) throw new RuntimeException("Combo2 fail:" + ret);
ret = cpp11_shared_ptr_overload.Combo3(new MyType("XXX"));
if (!ret.equals("XXXCombo3")) throw new RuntimeException("Combo3 fail:" + ret);
ret = cpp11_shared_ptr_overload.Combo4(new MyType("XXX"));
if (!ret.equals("XXXCombo4")) throw new RuntimeException("Combo4 fail:" + ret);
// Combo5-7
ret = cpp11_shared_ptr_overload.Combo5(new MyType("XXX"));
if (!ret.equals("XXXCombo5")) throw new RuntimeException("Combo5 fail:" + ret);
ret = cpp11_shared_ptr_overload.Combo6(new MyType("XXX"));
if (!ret.equals("XXXCombo6")) throw new RuntimeException("Combo6 fail:" + ret);
ret = cpp11_shared_ptr_overload.Combo7(new MyType("XXX"));
if (!ret.equals("XXXCombo7")) throw new RuntimeException("Combo7 fail:" + ret);
}
}

View File

@@ -0,0 +1,82 @@
import cpp11_std_array.*;
public class cpp11_std_array_runme {
static {
try {
System.loadLibrary("cpp11_std_array");
} 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 ArrayInt6 ToArray6(int [] a) {
ArrayInt6 ai = new ArrayInt6();
if (a.length != 6)
throw new RuntimeException("a is incorrect size");
for (int i=0; i<6; ++i)
ai.set(i, a[i]);
return ai;
}
private static void compareContainers(ArrayInt6 actual, int[] expected) {
if (actual.size() != expected.length)
throw new RuntimeException("Sizes are different: " + actual.size() + " " + expected.length);
for (int i=0; i<actual.size(); ++i) {
int actualValue = actual.get(i);
int expectedValue = expected[i];
if (actualValue != expectedValue)
throw new RuntimeException("Value is wrong for element " + i + ". Expected " + expectedValue + " got: " + actualValue);
}
if (actual.isEmpty())
throw new RuntimeException("ai should not be empty");
}
public static void main(String argv[]) {
ArrayInt6 ai = new ArrayInt6();
compareContainers(ai, new int[] {0, 0, 0, 0, 0, 0});
int[] vals = {10, 20, 30, 40, 50, 60};
for (int i=0; i<ai.size(); ++i)
ai.set(i, vals[i]);
compareContainers(ai, vals);
// Check return
compareContainers(cpp11_std_array.arrayOutVal(), new int[] {-2, -1, 0, 0, 1, 2});
compareContainers(cpp11_std_array.arrayOutConstRef(), new int[] {-2, -1, 0, 0, 1, 2});
compareContainers(cpp11_std_array.arrayOutRef(), new int[] {-2, -1, 0, 0, 1, 2});
compareContainers(cpp11_std_array.arrayOutPtr(), new int[] {-2, -1, 0, 0, 1, 2});
// Check passing arguments
ai = cpp11_std_array.arrayInVal(ToArray6(new int[] {9, 8, 7, 6, 5, 4}));
compareContainers(ai, new int[] {90, 80, 70, 60, 50, 40});
ai = cpp11_std_array.arrayInConstRef(ToArray6(new int[] {9, 8, 7, 6, 5, 4}));
compareContainers(ai, new int[] {90, 80, 70, 60, 50, 40});
ai = new ArrayInt6(ToArray6(new int[] {9, 8, 7, 6, 5, 4}));
cpp11_std_array.arrayInRef(ai);
compareContainers(ai, new int[] {90, 80, 70, 60, 50, 40});
ai = new ArrayInt6(ToArray6(new int[] {9, 8, 7, 6, 5, 4}));
cpp11_std_array.arrayInPtr(ai);
compareContainers(ai, new int[] {90, 80, 70, 60, 50, 40});
// fill
ai.fill(111);
compareContainers(ai, new int[] {111, 111, 111, 111, 111, 111});
// out of range errors
try {
ai.set((int)ai.size(), 0);
throw new RuntimeException("Out of range exception not caught");
} catch(IndexOutOfBoundsException e) {
}
try {
ai.set(-1, 0);
throw new RuntimeException("Out of range exception not caught");
} catch(IndexOutOfBoundsException e) {
}
}
}

View File

@@ -0,0 +1,122 @@
import cpp11_std_unordered_map.*;
public class cpp11_std_unordered_map_runme {
static {
try {
System.loadLibrary("cpp11_std_unordered_map");
} 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 checkThat(boolean mustBeTrue) throws Throwable {
if (!mustBeTrue) {
// Index [2], since this function is one hop away from main, and [1] is the current method.
throw new RuntimeException("Test failed at line number " + Thread.currentThread().getStackTrace()[2].getLineNumber());
}
}
public static void main(String argv[]) throws Throwable
{
java.util.AbstractMap<String, Integer> sim = new UnorderedMapStringInt();
java.util.AbstractMap<Integer, Integer> iim = new UnorderedMapIntInt();
checkThat(sim.isEmpty());
checkThat(iim.isEmpty());
checkThat(sim.size() == 0);
checkThat(iim.size() == 0);
checkThat(sim.get("key") == null);
checkThat(iim.get(1) == null);
checkThat(!sim.containsKey("key"));
checkThat(!iim.containsKey(1));
checkThat(sim.put("key", 2) == null);
checkThat(iim.put(1, 2) == null);
checkThat(sim.size() == 1);
checkThat(iim.size() == 1);
checkThat(!sim.isEmpty());
checkThat(!iim.isEmpty());
checkThat(sim.get("key") == 2);
checkThat(iim.get(1) == 2);
checkThat(sim.remove("key") == 2);
checkThat(iim.remove(1) == 2);
checkThat(sim.isEmpty());
checkThat(iim.isEmpty());
checkThat(sim.size() == 0);
checkThat(iim.size() == 0);
checkThat(sim.get("key") == null);
checkThat(iim.get(1) == null);
checkThat(sim.remove("key") == null);
checkThat(iim.remove(1) == null);
checkThat(sim.put("key", 2) == null);
checkThat(iim.put(1, 2) == null);
sim.clear();
iim.clear();
checkThat(sim.isEmpty());
checkThat(iim.isEmpty());
checkThat(sim.put("key1", 1) == null);
checkThat(iim.put(1, 1) == null);
checkThat(sim.put("key2", 2) == null);
checkThat(iim.put(2, 2) == null);
checkThat(sim.size() == 2);
checkThat(iim.size() == 2);
checkThat(sim.get("key1") == 1);
checkThat(iim.get(1) == 1);
checkThat(sim.get("key2") == 2);
checkThat(iim.get(2) == 2);
checkThat(sim.put("key1", 3) == 1);
checkThat(iim.put(1, 3) == 1);
checkThat(sim.size() == 2);
checkThat(iim.size() == 2);
checkThat(sim.get("key1") == 3);
checkThat(iim.get(1) == 3);
java.util.Set<java.util.Map.Entry<String, Integer>> sim_es = sim.entrySet();
java.util.Map<String, Integer> sim_default = new java.util.HashMap<String, Integer>();
sim_default.put("key1", 3);
sim_default.put("key2", 2);
java.util.Set<java.util.Map.Entry<String, Integer>> sim_es_default = sim_default.entrySet();
checkThat(sim_es.size() == sim_es_default.size());
for (java.util.Map.Entry<String, Integer> entry : sim_es) {
checkThat(sim_es_default.contains(entry));
checkThat(sim_default.containsKey(entry.getKey()));
checkThat(sim_default.containsValue(entry.getValue()));
Integer oldValue = entry.getValue();
entry.setValue(oldValue + 1);
checkThat(sim.get(entry.getKey()) == (oldValue + 1));
}
java.util.Set<java.util.Map.Entry<Integer, Integer>> iim_es = iim.entrySet();
java.util.Map<Integer, Integer> iim_default = new java.util.HashMap<Integer, Integer>();
iim_default.put(1, 3);
iim_default.put(2, 2);
java.util.Set<java.util.Map.Entry<Integer, Integer>> iim_es_default = iim_default.entrySet();
checkThat(iim_es.size() == iim_es_default.size());
for (java.util.Map.Entry<Integer, Integer> entry : iim_es) {
checkThat(iim_es_default.contains(entry));
checkThat(iim_default.containsKey(entry.getKey()));
checkThat(iim_default.containsValue(entry.getValue()));
Integer oldValue = entry.getValue();
entry.setValue(oldValue + 1);
checkThat(iim.get(entry.getKey()) == (oldValue + 1));
}
}
}

View File

@@ -0,0 +1,75 @@
import cpp11_std_unordered_set.*;
public class cpp11_std_unordered_set_runme {
static {
try {
System.loadLibrary("cpp11_std_unordered_set");
} 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 checkThat(boolean mustBeTrue) throws Throwable {
if (!mustBeTrue) {
// Index [2], since this function is one hop away from main, and [1] is the current method.
throw new RuntimeException("Test failed at line number " + Thread.currentThread().getStackTrace()[2].getLineNumber());
}
}
public static void main(String argv[]) throws Throwable
{
java.util.AbstractSet<String> ss = new UnorderedSetString();
checkThat(ss.isEmpty());
checkThat(!ss.contains("key"));
checkThat(!ss.remove("key"));
checkThat(ss.add("key"));
checkThat(!ss.add("key"));
checkThat(ss.contains("key"));
checkThat(ss.remove("key"));
checkThat(ss.isEmpty());
checkThat(ss.size() == 0);
checkThat(ss.add("key1"));
checkThat(ss.add("key2"));
checkThat(ss.add("key3"));
checkThat(ss.size() == 3);
ss.clear();
checkThat(ss.isEmpty());
checkThat(ss.size() == 0);
checkThat(ss.addAll(java.util.Arrays.asList("one", "two", "three")));
checkThat(ss.size() == 3);
checkThat(ss.contains("one"));
checkThat(!ss.contains("four"));
checkThat(ss.containsAll(java.util.Arrays.asList("one", "two", "three")));
checkThat(ss.containsAll(java.util.Arrays.asList("one", "two")));
checkThat(!ss.containsAll(java.util.Arrays.asList("one", "two", "four")));
checkThat(!ss.containsAll(java.util.Arrays.asList("one", "two", "three", "four")));
checkThat(!ss.addAll(java.util.Arrays.asList("one", "two", "three")));
java.util.Set<String> found = new java.util.HashSet<String>();
java.util.Iterator<String> itr = ss.iterator();
while (itr.hasNext()) {
found.add(itr.next());
}
checkThat(ss.containsAll(found));
checkThat(found.containsAll(ss));
java.util.AbstractSet<String> ss2 = new UnorderedSetString(ss);
checkThat(ss2.containsAll(ss));
checkThat(ss.containsAll(ss2));
checkThat(!ss.removeAll(java.util.Arrays.asList("five", "four")));
checkThat(ss.removeAll(found));
checkThat(ss.isEmpty());
checkThat(ss.size() == 0);
}
}

View File

@@ -0,0 +1,176 @@
import cpp11_strongly_typed_enumerations.*;
public class cpp11_strongly_typed_enumerations_runme {
static {
try {
System.loadLibrary("cpp11_strongly_typed_enumerations");
} 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 int enumCheck(int actual, int expected) {
if (actual != expected)
throw new RuntimeException("Enum value mismatch. Expected " + expected + " Actual: " + actual);
return expected + 1;
}
public static void main(String argv[]) {
int val = 0;
val = enumCheck(Enum1.Val1.swigValue(), val);
val = enumCheck(Enum1.Val2.swigValue(), val);
val = enumCheck(Enum1.Val3.swigValue(), 13);
val = enumCheck(Enum1.Val4.swigValue(), val);
val = enumCheck(Enum1.Val5a.swigValue(), 13);
val = enumCheck(Enum1.Val6a.swigValue(), val);
val = 0;
val = enumCheck(Enum2.Val1.swigValue(), val);
val = enumCheck(Enum2.Val2.swigValue(), val);
val = enumCheck(Enum2.Val3.swigValue(), 23);
val = enumCheck(Enum2.Val4.swigValue(), val);
val = enumCheck(Enum2.Val5b.swigValue(), 23);
val = enumCheck(Enum2.Val6b.swigValue(), val);
val = 0;
val = enumCheck(Enum4.Val1.swigValue(), val);
val = enumCheck(Enum4.Val2.swigValue(), val);
val = enumCheck(Enum4.Val3.swigValue(), 43);
val = enumCheck(Enum4.Val4.swigValue(), val);
val = 0;
val = enumCheck(Enum5.Val1.swigValue(), val);
val = enumCheck(Enum5.Val2.swigValue(), val);
val = enumCheck(Enum5.Val3.swigValue(), 53);
val = enumCheck(Enum5.Val4.swigValue(), val);
val = 0;
val = enumCheck(Enum6.Val1.swigValue(), val);
val = enumCheck(Enum6.Val2.swigValue(), val);
val = enumCheck(Enum6.Val3.swigValue(), 63);
val = enumCheck(Enum6.Val4.swigValue(), val);
val = 0;
val = enumCheck(Enum7td.Val1.swigValue(), val);
val = enumCheck(Enum7td.Val2.swigValue(), val);
val = enumCheck(Enum7td.Val3.swigValue(), 73);
val = enumCheck(Enum7td.Val4.swigValue(), val);
val = 0;
val = enumCheck(Enum8.Val1.swigValue(), val);
val = enumCheck(Enum8.Val2.swigValue(), val);
val = enumCheck(Enum8.Val3.swigValue(), 83);
val = enumCheck(Enum8.Val4.swigValue(), val);
val = 0;
val = enumCheck(Enum10.Val1.swigValue(), val);
val = enumCheck(Enum10.Val2.swigValue(), val);
val = enumCheck(Enum10.Val3.swigValue(), 103);
val = enumCheck(Enum10.Val4.swigValue(), val);
val = 0;
val = enumCheck(Class1.Enum12.Val1.swigValue(), 1121);
val = enumCheck(Class1.Enum12.Val2.swigValue(), 1122);
val = enumCheck(Class1.Enum12.Val3.swigValue(), val);
val = enumCheck(Class1.Enum12.Val4.swigValue(), val);
val = enumCheck(Class1.Enum12.Val5c.swigValue(), 1121);
val = enumCheck(Class1.Enum12.Val6c.swigValue(), val);
val = 0;
val = enumCheck(Class1.Enum13.Val1.swigValue(), 1131);
val = enumCheck(Class1.Enum13.Val2.swigValue(), 1132);
val = enumCheck(Class1.Enum13.Val3.swigValue(), val);
val = enumCheck(Class1.Enum13.Val4.swigValue(), val);
val = enumCheck(Class1.Enum13.Val5d.swigValue(), 1131);
val = enumCheck(Class1.Enum13.Val6d.swigValue(), val);
val = 0;
val = enumCheck(Class1.Enum14.Val1.swigValue(), 1141);
val = enumCheck(Class1.Enum14.Val2.swigValue(), 1142);
val = enumCheck(Class1.Enum14.Val3.swigValue(), val);
val = enumCheck(Class1.Enum14.Val4.swigValue(), val);
val = enumCheck(Class1.Enum14.Val5e.swigValue(), 1141);
val = enumCheck(Class1.Enum14.Val6e.swigValue(), val);
val = 0;
val = enumCheck(Class1.Struct1.Enum12.Val1.swigValue(), 3121);
val = enumCheck(Class1.Struct1.Enum12.Val2.swigValue(), 3122);
val = enumCheck(Class1.Struct1.Enum12.Val3.swigValue(), val);
val = enumCheck(Class1.Struct1.Enum12.Val4.swigValue(), val);
val = enumCheck(Class1.Struct1.Enum12.Val5f.swigValue(), 3121);
val = enumCheck(Class1.Struct1.Enum12.Val6f.swigValue(), val);
val = 0;
val = enumCheck(Class1.Struct1.Enum13.Val1.swigValue(), 3131);
val = enumCheck(Class1.Struct1.Enum13.Val2.swigValue(), 3132);
val = enumCheck(Class1.Struct1.Enum13.Val3.swigValue(), val);
val = enumCheck(Class1.Struct1.Enum13.Val4.swigValue(), val);
val = 0;
val = enumCheck(Class1.Struct1.Enum14.Val1.swigValue(), 3141);
val = enumCheck(Class1.Struct1.Enum14.Val2.swigValue(), 3142);
val = enumCheck(Class1.Struct1.Enum14.Val3.swigValue(), val);
val = enumCheck(Class1.Struct1.Enum14.Val4.swigValue(), val);
val = enumCheck(Class1.Struct1.Enum14.Val5g.swigValue(), 3141);
val = enumCheck(Class1.Struct1.Enum14.Val6g.swigValue(), val);
val = 0;
val = enumCheck(Class2.Enum12.Val1.swigValue(), 2121);
val = enumCheck(Class2.Enum12.Val2.swigValue(), 2122);
val = enumCheck(Class2.Enum12.Val3.swigValue(), val);
val = enumCheck(Class2.Enum12.Val4.swigValue(), val);
val = enumCheck(Class2.Enum12.Val5h.swigValue(), 2121);
val = enumCheck(Class2.Enum12.Val6h.swigValue(), val);
val = 0;
val = enumCheck(Class2.Enum13.Val1.swigValue(), 2131);
val = enumCheck(Class2.Enum13.Val2.swigValue(), 2132);
val = enumCheck(Class2.Enum13.Val3.swigValue(), val);
val = enumCheck(Class2.Enum13.Val4.swigValue(), val);
val = enumCheck(Class2.Enum13.Val5i.swigValue(), 2131);
val = enumCheck(Class2.Enum13.Val6i.swigValue(), val);
val = 0;
val = enumCheck(Class2.Enum14.Val1.swigValue(), 2141);
val = enumCheck(Class2.Enum14.Val2.swigValue(), 2142);
val = enumCheck(Class2.Enum14.Val3.swigValue(), val);
val = enumCheck(Class2.Enum14.Val4.swigValue(), val);
val = enumCheck(Class2.Enum14.Val5j.swigValue(), 2141);
val = enumCheck(Class2.Enum14.Val6j.swigValue(), val);
val = 0;
val = enumCheck(Class2.Struct1.Enum12.Val1.swigValue(), 4121);
val = enumCheck(Class2.Struct1.Enum12.Val2.swigValue(), 4122);
val = enumCheck(Class2.Struct1.Enum12.Val3.swigValue(), val);
val = enumCheck(Class2.Struct1.Enum12.Val4.swigValue(), val);
val = enumCheck(Class2.Struct1.Enum12.Val5k.swigValue(), 4121);
val = enumCheck(Class2.Struct1.Enum12.Val6k.swigValue(), val);
val = 0;
val = enumCheck(Class2.Struct1.Enum13.Val1.swigValue(), 4131);
val = enumCheck(Class2.Struct1.Enum13.Val2.swigValue(), 4132);
val = enumCheck(Class2.Struct1.Enum13.Val3.swigValue(), val);
val = enumCheck(Class2.Struct1.Enum13.Val4.swigValue(), val);
val = enumCheck(Class2.Struct1.Enum13.Val5l.swigValue(), 4131);
val = enumCheck(Class2.Struct1.Enum13.Val6l.swigValue(), val);
val = 0;
val = enumCheck(Class2.Struct1.Enum14.Val1.swigValue(), 4141);
val = enumCheck(Class2.Struct1.Enum14.Val2.swigValue(), 4142);
val = enumCheck(Class2.Struct1.Enum14.Val3.swigValue(), val);
val = enumCheck(Class2.Struct1.Enum14.Val4.swigValue(), val);
val = enumCheck(Class2.Struct1.Enum14.Val5m.swigValue(), 4141);
val = enumCheck(Class2.Struct1.Enum14.Val6m.swigValue(), val);
Class1 class1 = new Class1();
enumCheck(class1.class1Test1(Enum1.Val5a).swigValue(), 13);
enumCheck(class1.class1Test2(Class1.Enum12.Val5c).swigValue(), 1121);
enumCheck(class1.class1Test3(Class1.Struct1.Enum12.Val5f).swigValue(), 3121);
enumCheck(cpp11_strongly_typed_enumerations.globalTest1(Enum1.Val5a).swigValue(), 13);
enumCheck(cpp11_strongly_typed_enumerations.globalTest2(Class1.Enum12.Val5c).swigValue(), 1121);
enumCheck(cpp11_strongly_typed_enumerations.globalTest3(Class1.Struct1.Enum12.Val5f).swigValue(), 3121);
}
}

View File

@@ -0,0 +1,176 @@
import cpp11_strongly_typed_enumerations_simple.*;
public class cpp11_strongly_typed_enumerations_simple_runme {
static {
try {
System.loadLibrary("cpp11_strongly_typed_enumerations_simple");
} 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 int enumCheck(int actual, int expected) {
if (actual != expected)
throw new RuntimeException("Enum value mismatch. Expected " + expected + " Actual: " + actual);
return expected + 1;
}
public static void main(String argv[]) {
int val = 0;
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val1, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val2, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val3, 13);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val4, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val5a, 13);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val6a, val);
val = 0;
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val1, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val2, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val3, 23);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val4, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val5b, 23);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val6b, val);
val = 0;
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val1, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val2, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val3, 43);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val4, val);
val = 0;
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val1, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val2, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val3, 53);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val4, val);
val = 0;
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val1, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val2, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val3, 63);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val4, val);
val = 0;
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val1, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val2, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val3, 73);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val4, val);
val = 0;
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val1, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val2, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val3, 83);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val4, val);
val = 0;
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val1, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val2, val);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val3, 103);
val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val4, val);
val = 0;
val = enumCheck(Class1.Enum12_Val1, 1121);
val = enumCheck(Class1.Enum12_Val2, 1122);
val = enumCheck(Class1.Enum12_Val3, val);
val = enumCheck(Class1.Enum12_Val4, val);
val = enumCheck(Class1.Enum12_Val5c, 1121);
val = enumCheck(Class1.Enum12_Val6c, val);
val = 0;
val = enumCheck(Class1.Val1, 1131);
val = enumCheck(Class1.Val2, 1132);
val = enumCheck(Class1.Val3, val);
val = enumCheck(Class1.Val4, val);
val = enumCheck(Class1.Val5d, 1131);
val = enumCheck(Class1.Val6d, val);
val = 0;
val = enumCheck(Class1.Enum14_Val1, 1141);
val = enumCheck(Class1.Enum14_Val2, 1142);
val = enumCheck(Class1.Enum14_Val3, val);
val = enumCheck(Class1.Enum14_Val4, val);
val = enumCheck(Class1.Enum14_Val5e, 1141);
val = enumCheck(Class1.Enum14_Val6e, val);
val = 0;
val = enumCheck(Class1.Struct1.Enum12_Val1, 3121);
val = enumCheck(Class1.Struct1.Enum12_Val2, 3122);
val = enumCheck(Class1.Struct1.Enum12_Val3, val);
val = enumCheck(Class1.Struct1.Enum12_Val4, val);
val = enumCheck(Class1.Struct1.Enum12_Val5f, 3121);
val = enumCheck(Class1.Struct1.Enum12_Val6f, val);
val = 0;
val = enumCheck(Class1.Struct1.Val1, 3131);
val = enumCheck(Class1.Struct1.Val2, 3132);
val = enumCheck(Class1.Struct1.Val3, val);
val = enumCheck(Class1.Struct1.Val4, val);
val = 0;
val = enumCheck(Class1.Struct1.Enum14_Val1, 3141);
val = enumCheck(Class1.Struct1.Enum14_Val2, 3142);
val = enumCheck(Class1.Struct1.Enum14_Val3, val);
val = enumCheck(Class1.Struct1.Enum14_Val4, val);
val = enumCheck(Class1.Struct1.Enum14_Val5g, 3141);
val = enumCheck(Class1.Struct1.Enum14_Val6g, val);
val = 0;
val = enumCheck(Class2.Enum12_Val1, 2121);
val = enumCheck(Class2.Enum12_Val2, 2122);
val = enumCheck(Class2.Enum12_Val3, val);
val = enumCheck(Class2.Enum12_Val4, val);
val = enumCheck(Class2.Enum12_Val5h, 2121);
val = enumCheck(Class2.Enum12_Val6h, val);
val = 0;
val = enumCheck(Class2.Val1, 2131);
val = enumCheck(Class2.Val2, 2132);
val = enumCheck(Class2.Val3, val);
val = enumCheck(Class2.Val4, val);
val = enumCheck(Class2.Val5i, 2131);
val = enumCheck(Class2.Val6i, val);
val = 0;
val = enumCheck(Class2.Enum14_Val1, 2141);
val = enumCheck(Class2.Enum14_Val2, 2142);
val = enumCheck(Class2.Enum14_Val3, val);
val = enumCheck(Class2.Enum14_Val4, val);
val = enumCheck(Class2.Enum14_Val5j, 2141);
val = enumCheck(Class2.Enum14_Val6j, val);
val = 0;
val = enumCheck(Class2.Struct1.Enum12_Val1, 4121);
val = enumCheck(Class2.Struct1.Enum12_Val2, 4122);
val = enumCheck(Class2.Struct1.Enum12_Val3, val);
val = enumCheck(Class2.Struct1.Enum12_Val4, val);
val = enumCheck(Class2.Struct1.Enum12_Val5k, 4121);
val = enumCheck(Class2.Struct1.Enum12_Val6k, val);
val = 0;
val = enumCheck(Class2.Struct1.Val1, 4131);
val = enumCheck(Class2.Struct1.Val2, 4132);
val = enumCheck(Class2.Struct1.Val3, val);
val = enumCheck(Class2.Struct1.Val4, val);
val = enumCheck(Class2.Struct1.Val5l, 4131);
val = enumCheck(Class2.Struct1.Val6l, val);
val = 0;
val = enumCheck(Class2.Struct1.Enum14_Val1, 4141);
val = enumCheck(Class2.Struct1.Enum14_Val2, 4142);
val = enumCheck(Class2.Struct1.Enum14_Val3, val);
val = enumCheck(Class2.Struct1.Enum14_Val4, val);
val = enumCheck(Class2.Struct1.Enum14_Val5m, 4141);
val = enumCheck(Class2.Struct1.Enum14_Val6m, val);
Class1 class1 = new Class1();
enumCheck(class1.class1Test1(cpp11_strongly_typed_enumerations_simple.Enum1_Val5a), 13);
enumCheck(class1.class1Test2(Class1.Enum12_Val5c), 1121);
enumCheck(class1.class1Test3(Class1.Struct1.Enum12_Val5f), 3121);
enumCheck(cpp11_strongly_typed_enumerations_simple.globalTest1(cpp11_strongly_typed_enumerations_simple.Enum1_Val5a), 13);
enumCheck(cpp11_strongly_typed_enumerations_simple.globalTest2(Class1.Enum12_Val5c), 1121);
enumCheck(cpp11_strongly_typed_enumerations_simple.globalTest3(Class1.Struct1.Enum12_Val5f), 3121);
}
}

View 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();
}
}

View 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();
}
}

View File

@@ -0,0 +1,20 @@
import cpp11_type_aliasing.*;
public class cpp11_type_aliasing_runme {
static {
try {
System.loadLibrary("cpp11_type_aliasing");
} 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[]) {
Halide_Target ht = new GeneratorBase().getTarget();
Target x = ht.getValue();
if (x.getBits() != 32)
throw new RuntimeException("Incorrect bits");
}
}

View File

@@ -0,0 +1,32 @@
import cpp17_nested_namespaces.*;
public class cpp17_nested_namespaces_runme {
static {
try {
System.loadLibrary("cpp17_nested_namespaces");
} 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 A1Struct().A1Method();
new B1Struct().B1Method();
new C1Struct().C1Method();
cpp17_nested_namespaces.createA1Struct().A1Method();
cpp17_nested_namespaces.createB1Struct().B1Method();
cpp17_nested_namespaces.createC1Struct().C1Method();
new B2Struct().B2Method();
new C2Struct().C2Method();
cpp17_nested_namespaces.createB2Struct().B2Method();
cpp17_nested_namespaces.createC2Struct().C2Method();
new B3Struct().B3Method();
new C3Struct().C3Method();
cpp17_nested_namespaces.createB3Struct().B3Method();
cpp17_nested_namespaces.createC3Struct().C3Method();
}
}

View File

@@ -0,0 +1,30 @@
public class cpp17_nspace_nested_namespaces_runme {
static {
try {
System.loadLibrary("cpp17_nspace_nested_namespaces");
} 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 cpp17_nspace_nested_namespacesPackage.A1.A1Struct().A1Method();
new cpp17_nspace_nested_namespacesPackage.A1.B1.B1Struct().B1Method();
new cpp17_nspace_nested_namespacesPackage.A1.B1.C1.C1Struct().C1Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createA1Struct().A1Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB1Struct().B1Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC1Struct().C1Method();
new cpp17_nspace_nested_namespacesPackage.A2.B2.B2Struct().B2Method();
new cpp17_nspace_nested_namespacesPackage.A2.B2.C2.C2Struct().C2Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB2Struct().B2Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC2Struct().C2Method();
new cpp17_nspace_nested_namespacesPackage.A3.B3.B3Struct().B3Method();
new cpp17_nspace_nested_namespacesPackage.A3.B3.C3.C3Struct().C3Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB3Struct().B3Method();
cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC3Struct().C3Method();
}
}

View File

@@ -0,0 +1,34 @@
// This is the cpp_typedef runtime testcase. It checks that proxy classes are
// generated for typedef'd types.
import cpp_typedef.*;
public class cpp_typedef_runme {
static {
try {
System.loadLibrary("cpp_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[]) {
Foo f = new Foo();
SWIGTYPE_p_Bar pbar = f.bar();
pbar = Foo.sbar();
Test test = new Test();
UnnamedStruct unnamed = new UnnamedStruct();
TypedefNamedStruct named = new TypedefNamedStruct();
UnnamedStruct unnamed2 = test.test1(unnamed);
TypedefNamedStruct named2 = test.test2(named);
TypedefNamedStruct named3 = test.test3(named);
TypedefNamedStruct named4 = test.test4(named);
}
}

View File

@@ -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");
}
}

View File

@@ -0,0 +1,150 @@
import default_args.*;
public class default_args_runme {
static {
try {
System.loadLibrary("default_args");
} 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 (default_args.anonymous() != 7771)
throw new RuntimeException("anonymous (1) failed");
if (default_args.anonymous(1234) != 1234)
throw new RuntimeException("anonymous (2) failed");
if (default_args.booltest() != true)
throw new RuntimeException("booltest (1) failed");
if (default_args.booltest(true) != true)
throw new RuntimeException("booltest (2) failed");
if (default_args.booltest(false) != false)
throw new RuntimeException("booltest (3) failed");
EnumClass ec = new EnumClass();
if (ec.blah() != true)
throw new RuntimeException("EnumClass failed");
if (default_args.casts1() != null)
throw new RuntimeException("casts1 failed");
if (!default_args.casts2().equals("Hello"))
throw new RuntimeException("casts2 failed");
if (!default_args.casts1("Ciao").equals("Ciao"))
throw new RuntimeException("casts1 not default failed");
if (default_args.chartest1() != 'x')
throw new RuntimeException("chartest1 failed");
if (default_args.chartest2() != '\0')
throw new RuntimeException("chartest2 failed");
if (default_args.chartest1('y') != 'y')
throw new RuntimeException("chartest1 not default failed");
if (default_args.chartest1('y') != 'y')
throw new RuntimeException("chartest1 not default failed");
if (default_args.reftest1() != 42)
throw new RuntimeException("reftest1 failed");
if (default_args.reftest1(400) != 400)
throw new RuntimeException("reftest1 not default failed");
if (!default_args.reftest2().equals("hello"))
throw new RuntimeException("reftest2 failed");
// rename
Foo foo = new Foo();
foo.newname();
foo.newname(10);
foo.renamed3arg(10, 10.0);
foo.renamed2arg(10);
foo.renamed1arg();
// exception specifications
try {
default_args.exceptionspec();
throw new RuntimeException("exceptionspec 1 failed");
} catch (RuntimeException e) {
}
try {
default_args.exceptionspec(-1);
throw new RuntimeException("exceptionspec 2 failed");
} catch (RuntimeException e) {
}
try {
default_args.exceptionspec(100);
throw new RuntimeException("exceptionspec 3 failed");
} catch (RuntimeException e) {
}
Except ex = new Except(false);
try {
ex.exspec();
throw new RuntimeException("exspec 1 failed");
} catch (RuntimeException e) {
}
try {
ex.exspec(-1);
throw new RuntimeException("exspec 2 failed");
} catch (RuntimeException e) {
}
try {
ex.exspec(100);
throw new RuntimeException("exspec 3 failed");
} catch (RuntimeException e) {
}
try {
ex = new Except(true);
throw new RuntimeException("Except constructor 1 failed");
} catch (RuntimeException e) {
}
try {
ex = new Except(true, -2);
throw new RuntimeException("Except constructor 2 failed");
} catch (RuntimeException e) {
}
// Default parameters in static class methods
if (Statics.staticmethod() != 10+20+30)
throw new RuntimeException("staticmethod 1 failed");
if (Statics.staticmethod(100) != 100+20+30)
throw new RuntimeException("staticmethod 2 failed");
if (Statics.staticmethod(100,200,300) != 100+200+300)
throw new RuntimeException("staticmethod 3 failed");
Tricky tricky = new Tricky();
if (tricky.privatedefault() != 200)
throw new RuntimeException("privatedefault failed");
if (tricky.protectedint() != 2000)
throw new RuntimeException("protectedint failed");
if (tricky.protecteddouble() != 987.654)
throw new RuntimeException("protecteddouble failed");
if (tricky.functiondefault() != 500)
throw new RuntimeException("functiondefault failed");
if (tricky.contrived() != 'X')
throw new RuntimeException("contrived failed");
if (default_args.constructorcall().getVal() != -1)
throw new RuntimeException("constructorcall test 1 failed");
if (default_args.constructorcall(new Klass(2222)).getVal() != 2222)
throw new RuntimeException("constructorcall test 2 failed");
if (default_args.constructorcall(new Klass()).getVal() != -1)
throw new RuntimeException("constructorcall test 3 failed");
// const methods
ConstMethods cm = new ConstMethods();
if (cm.coo() != 20)
throw new RuntimeException("coo test 1 failed");
if (cm.coo(1.0) != 20)
throw new RuntimeException("coo test 2 failed");
}
}

View File

@@ -0,0 +1,24 @@
import default_constructor.*;
public class default_constructor_runme {
static {
try {
System.loadLibrary("default_constructor");
} 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[])
{
// calling protected destructor test
try {
G g = new G();
g.delete();
throw new RuntimeException("Protected destructor exception should have been thrown");
} catch (UnsupportedOperationException e) {
}
}
}

View 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);
}
}

View File

@@ -0,0 +1,46 @@
import director_abstract.*;
public class director_abstract_runme {
static {
try {
System.loadLibrary("director_abstract");
} 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_abstract_MyFoo a = new director_abstract_MyFoo();
if (!a.ping().equals("director_abstract_MyFoo::ping()")) {
throw new RuntimeException ( "a.ping()" );
}
if (!a.pong().equals("Foo::pong();director_abstract_MyFoo::ping()")) {
throw new RuntimeException ( "a.pong()" );
}
director_abstract_BadFoo b = new director_abstract_BadFoo();
try {
b.ping();
System.out.println( "Test failed. An attempt to call a pure virtual method should throw an exception" );
System.exit(1);
}
catch (RuntimeException e) {
}
}
}
class director_abstract_MyFoo extends Foo {
public String ping() {
return "director_abstract_MyFoo::ping()";
}
}
class director_abstract_BadFoo extends Foo {
}

View File

@@ -0,0 +1,72 @@
import director_basic.*;
public class director_basic_runme {
static {
try {
System.loadLibrary("director_basic");
} 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_basic_MyFoo a = new director_basic_MyFoo();
if (!a.ping().equals("director_basic_MyFoo::ping()")) {
throw new RuntimeException ( "a.ping()" );
}
if (!a.pong().equals("Foo::pong();director_basic_MyFoo::ping()")) {
throw new RuntimeException ( "a.pong()" );
}
Foo b = new Foo();
if (!b.ping().equals("Foo::ping()")) {
throw new RuntimeException ( "b.ping()" );
}
if (!b.pong().equals("Foo::pong();Foo::ping()")) {
throw new RuntimeException ( "b.pong()" );
}
A1 a1 = new A1(1, false);
a1.delete();
{
MyOverriddenClass my = new MyOverriddenClass();
my.expectNull = true;
if (MyClass.call_pmethod(my, null) != null)
throw new RuntimeException("null pointer marshalling problem");
Bar myBar = new Bar();
my.expectNull = false;
Bar myNewBar = MyClass.call_pmethod(my, myBar);
if (myNewBar == null)
throw new RuntimeException("non-null pointer marshalling problem");
myNewBar.setX(10);
}
}
}
class director_basic_MyFoo extends Foo {
public String ping() {
return "director_basic_MyFoo::ping()";
}
}
class MyOverriddenClass extends MyClass {
public boolean expectNull = false;
public boolean nonNullReceived = false;
public Bar pmethod(Bar b) {
if ( expectNull && (b != null) )
throw new RuntimeException("null not received as expected");
return b;
}
}

View File

@@ -0,0 +1,61 @@
import director_binary_string.*;
public class director_binary_string_runme {
static {
try {
System.loadLibrary("director_binary_string");
} 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[]) {
Caller caller = new Caller();
Callback callback = new DirectorBinaryStringCallback();
caller.setCallback(callback);
int sum = caller.call();
int sumData = caller.callWriteData();
caller.delCallback();
if (sum != 9*2*8 + 13*3*5)
throw new RuntimeException("Unexpected sum: " + sum);
if (sumData != 9*2*8)
throw new RuntimeException("Unexpected sum: " + sum);
new Callback().run(null, null);
callback = new DirectorBinaryStringCallback();
caller.setCallback(callback);
caller.call_null();
}
}
class DirectorBinaryStringCallback extends Callback {
public DirectorBinaryStringCallback() {
super();
}
@Override
public void run(byte[] dataBufferAA, byte[] dataBufferBB)
{
if (dataBufferAA != null)
for (int i = 0; i < dataBufferAA.length; i++)
dataBufferAA[i] = (byte)(dataBufferAA[i] * 2);
if (dataBufferBB != null)
for (int i = 0; i < dataBufferBB.length; i++)
dataBufferBB[i] = (byte)(dataBufferBB[i] * 3);
}
@Override
public void writeData(byte[] dataBufferAA)
{
if (dataBufferAA != null)
for (int i = 0; i < dataBufferAA.length; i++)
dataBufferAA[i] = (byte)(dataBufferAA[i] * 2);
}
}

View File

@@ -0,0 +1,216 @@
/*
This test demonstrates director classes when the types are classes.
Shown are virtual function calls which use classes passed by:
- Value
- Reference
- Pointer
as both parameters and return values.
The test also demonstrates directors used with:
- method overloading
- default parameters
Note: Methods with default parameters that call up from C++ cannot call
the overloaded Java methods, see DefaultParms method.
Expected output if PrintDebug enabled:
------------ Start ------------
Base - Val(444.555)
Base - Ref(444.555)
Base - Ptr(444.555)
Base - ConstPtrRef(444.555)
Base - FullyOverloaded(int 10)
Base - FullyOverloaded(bool 1)
Base - SemiOverloaded(int -678)
Base - SemiOverloaded(bool 1)
Base - DefaultParms(10, 2.2)
Base - DefaultParms(10, 1.1)
--------------------------------
Derived - Val(444.555)
Derived - Ref(444.555)
Derived - Ptr(444.555)
Derived - ConstPtrRef(444.555)
Derived - FullyOverloaded(int 10)
Derived - FullyOverloaded(bool 1)
Derived - SemiOverloaded(int -678)
Base - SemiOverloaded(bool 1)
Derived - DefaultParms(10, 2.2)
Derived - DefaultParms(10, 1.1)
--------------------------------
JavaDerived - Val(444.555)
JavaDerived - Ref(444.555)
JavaDerived - Ptr(444.555)
JavaDerived - ConstPtrRef(444.555)
JavaDerived - FullyOverloaded(int 10)
JavaDerived - FullyOverloaded(bool True)
JavaDerived - SemiOverloaded(-678)
Base - SemiOverloaded(bool 1)
JavaDerived - DefaultParms(10, 2.2)
JavaDerived - DefaultParms(10, 1.1)
------------ Finish ------------
*/
import director_classes.*;
public class director_classes_runme {
static {
try {
System.loadLibrary("director_classes");
} 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
{
director_classes_runme r = new director_classes_runme();
r.run();
}
void run()
{
if (director_classes.getPrintDebug()) System.out.println("------------ Start ------------");
Caller myCaller = new Caller();
// test C++ base class
{
Base myBase = new Base(100.0);
makeCalls(myCaller, myBase);
myBase.delete();
}
if (director_classes.getPrintDebug()) System.out.println("--------------------------------");
// test vanilla C++ wrapped derived class
{
Base myBase = new Derived(200.0);
makeCalls(myCaller, myBase);
myBase.delete();
}
if (director_classes.getPrintDebug()) System.out.println("--------------------------------");
// test director / Java derived class
{
Base myBase = new JavaDerived(300.0);
makeCalls(myCaller, myBase);
myBase.delete();
}
if (director_classes.getPrintDebug()) System.out.println("------------ Finish ------------");
}
void makeCalls(Caller myCaller, Base myBase)
{
String baseSimpleName = getSimpleName(myBase.getClass());
myCaller.set(myBase);
DoubleHolder dh = new DoubleHolder(444.555);
// Class pointer, reference and pass by value tests
if (myCaller.ValCall(dh).getVal() != dh.getVal()) throw new RuntimeException("failed");
if (myCaller.RefCall(dh).getVal() != dh.getVal()) throw new RuntimeException("failed");
if (myCaller.PtrCall(dh).getVal() != dh.getVal()) throw new RuntimeException("failed");
if (myCaller.ConstPtrRefCall(dh).getVal() != dh.getVal()) throw new RuntimeException("failed");
// Fully overloaded method test (all methods in base class are overloaded)
if (!myCaller.FullyOverloadedCall(10).equals(baseSimpleName + "::FullyOverloaded(int)")) {
System.out.println(myCaller.FullyOverloadedCall(10) + "----" + (baseSimpleName + "::FullyOverloaded(int)"));
throw new RuntimeException("failed");
}
if (!myCaller.FullyOverloadedCall(true).equals(baseSimpleName + "::FullyOverloaded(bool)")) throw new RuntimeException("failed");
// Semi overloaded method test (some methods in base class are overloaded)
if (!myCaller.SemiOverloadedCall(-678).equals(baseSimpleName + "::SemiOverloaded(int)")) throw new RuntimeException("failed");
if (!myCaller.SemiOverloadedCall(true).equals("Base" + "::SemiOverloaded(bool)")) throw new RuntimeException("failed");
// Default parameters methods test
if (!(myCaller.DefaultParmsCall(10, 2.2)).equals(baseSimpleName + "::DefaultParms(int, double)")) throw new RuntimeException("failed");
if (myBase instanceof JavaDerived) { // special handling for Java derived classes, there is no way to do this any other way
if (!myCaller.DefaultParmsCall(10).equals(baseSimpleName + "::DefaultParms(int, double)")) throw new RuntimeException("failed");
} else {
if (!myCaller.DefaultParmsCall(10).equals(baseSimpleName + "::DefaultParms(int)")) throw new RuntimeException("failed");
}
myCaller.reset();
}
// Same as Class.getSimpleName() which is not present in all jdks
static String getSimpleName(Class klass) {
String fullName = klass.getName();
Package packag = klass.getPackage();
String simpleName = null;
if (packag != null)
simpleName = fullName.replaceAll(packag.getName() + "\\.", "");
else
simpleName = fullName;
return simpleName;
}
}
class JavaDerived extends Base
{
public JavaDerived(double dd)
{
super(dd);
}
public DoubleHolder Val(DoubleHolder x)
{
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - Val(" + x.getVal() + ")");
return x;
}
public DoubleHolder Ref(DoubleHolder x)
{
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - Ref(" + x.getVal() + ")");
return x;
}
public DoubleHolder Ptr(DoubleHolder x)
{
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - Ptr(" + x.getVal() + ")");
return x;
}
public DoubleHolder ConstPtrRef(DoubleHolder x)
{
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - ConstPtrRef(" + x.getVal() + ")");
return x;
}
public String FullyOverloaded(int x)
{
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - FullyOverloaded(int " + x + ")");
return "JavaDerived::FullyOverloaded(int)";
}
public String FullyOverloaded(boolean x)
{
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - FullyOverloaded(bool " + x + ")");
return "JavaDerived::FullyOverloaded(bool)";
}
// Note no SemiOverloaded(bool x) method
public String SemiOverloaded(int x)
{
String ret = "JavaDerived::SemiOverloaded(int)";
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - SemiOverloaded(" + x + ")");
return ret;
}
public String DefaultParms(int x, double y)
{
String ret = "JavaDerived::DefaultParms(int, double)";
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - DefaultParms(" + x + ", " + y + ")");
return ret;
}
// Note the following method can never be called from unmanaged code.
// It is here only for code that calls it directly from managed code.
// But should always be defined to ensure behaviour is consistent
// independent of where DefaultParsms is called from (managed or unmanaged code).
// Note this method can never be called from unmanaged code
public String DefaultParms(int x)
{
if (director_classes.getPrintDebug()) System.out.println("JavaDerived - DefaultParms(" + x + ")");
return DefaultParms(x, 1.1/*use C++ default here*/);
}
}

View File

@@ -0,0 +1,318 @@
import director_classic.*;
public class director_classic_runme {
static {
try {
System.loadLibrary("director_classic");
} 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[])
{
{
Person person = new Person();
check(person, "Person");
person.delete();
}
{
Person person = new Child();
check(person, "Child");
person.delete();
}
{
Person person = new GrandChild();
check(person, "GrandChild");
person.delete();
}
{
Person person = new TargetLangPerson();
check(person, "TargetLangPerson");
person.delete();
}
{
Person person = new TargetLangChild();
check(person, "TargetLangChild");
person.delete();
}
{
Person person = new TargetLangGrandChild();
check(person, "TargetLangGrandChild");
person.delete();
}
// Semis - don't override id() in target language
{
Person person = new TargetLangSemiPerson();
check(person, "Person");
person.delete();
}
{
Person person = new TargetLangSemiChild();
check(person, "Child");
person.delete();
}
{
Person person = new TargetLangSemiGrandChild();
check(person, "GrandChild");
person.delete();
}
// Orphans - don't override id() in C++
{
Person person = new OrphanPerson();
check(person, "Person");
person.delete();
}
{
Person person = new OrphanChild();
check(person, "Child");
person.delete();
}
{
Person person = new TargetLangOrphanPerson();
check(person, "TargetLangOrphanPerson");
person.delete();
}
{
Person person = new TargetLangOrphanChild();
check(person, "TargetLangOrphanChild");
person.delete();
}
// Duals - id() makes an upcall to the base id()
{
Person person = new TargetLangDualPerson();
check(person, "TargetLangDualPerson + Person");
person.delete();
}
{
Person person = new TargetLangDualChild();
check(person, "TargetLangDualChild + Child");
person.delete();
}
{
Person person = new TargetLangDualGrandChild();
check(person, "TargetLangDualGrandChild + GrandChild");
person.delete();
}
// Mix Orphans and Duals
{
Person person = new TargetLangDualOrphanPerson();
check(person, "TargetLangDualOrphanPerson + Person");
person.delete();
}
{
Person person = new TargetLangDualOrphanChild();
check(person, "TargetLangDualOrphanChild + Child");
person.delete();
}
}
static void check(Person person, String expected) {
String ret;
// Normal target language polymorphic call
ret = person.id();
if (debug)
System.out.println(ret);
if (!ret.equals(expected))
throw new RuntimeException("Failed. Received: " + ret + " Expected: " + expected);
// Polymorphic call from C++
Caller caller = new Caller();
caller.setCallback(person);
ret = caller.call();
if (debug)
System.out.println(ret);
if (!ret.equals(expected))
throw new RuntimeException("Failed. Received: " + ret + " Expected: " + expected);
// Polymorphic call of object created in target language and passed to C++ and back again
Person baseclass = caller.baseClass();
ret = baseclass.id();
if (debug)
System.out.println(ret);
if (!ret.equals(expected))
throw new RuntimeException("Failed. Received: " + ret + " Expected: " + expected);
caller.resetCallback();
if (debug)
System.out.println("----------------------------------------");
}
static boolean debug = false;
}
class TargetLangPerson extends Person
{
public TargetLangPerson()
{
super();
}
public String id()
{
String identifier = "TargetLangPerson";
return identifier;
}
}
class TargetLangChild extends Child
{
public TargetLangChild()
{
super();
}
public String id()
{
String identifier = "TargetLangChild";
return identifier;
}
}
class TargetLangGrandChild extends GrandChild
{
public TargetLangGrandChild()
{
super();
}
public String id()
{
String identifier = "TargetLangGrandChild";
return identifier;
}
}
// Semis - don't override id() in target language
class TargetLangSemiPerson extends Person
{
public TargetLangSemiPerson()
{
super();
}
// No id() override
}
class TargetLangSemiChild extends Child
{
public TargetLangSemiChild()
{
super();
}
// No id() override
}
class TargetLangSemiGrandChild extends GrandChild
{
public TargetLangSemiGrandChild()
{
super();
}
// No id() override
}
// Orphans - don't override id() in C++
class TargetLangOrphanPerson extends OrphanPerson
{
public TargetLangOrphanPerson()
{
super();
}
public String id()
{
String identifier = "TargetLangOrphanPerson";
return identifier;
}
}
class TargetLangOrphanChild extends OrphanChild
{
public TargetLangOrphanChild()
{
super();
}
public String id()
{
String identifier = "TargetLangOrphanChild";
return identifier;
}
}
// Duals - id() makes an upcall to the base id()
class TargetLangDualPerson extends Person
{
public TargetLangDualPerson()
{
super();
}
public String id()
{
String identifier = "TargetLangDualPerson + " + super.id();
return identifier;
}
}
class TargetLangDualChild extends Child
{
public TargetLangDualChild()
{
super();
}
public String id()
{
String identifier = "TargetLangDualChild + " + super.id();
return identifier;
}
}
class TargetLangDualGrandChild extends GrandChild
{
public TargetLangDualGrandChild()
{
super();
}
public String id()
{
String identifier = "TargetLangDualGrandChild + " + super.id();
return identifier;
}
}
// Mix Orphans and Duals
class TargetLangDualOrphanPerson extends OrphanPerson
{
public TargetLangDualOrphanPerson()
{
super();
}
public String id()
{
String identifier = "TargetLangDualOrphanPerson + " + super.id();
return identifier;
}
}
class TargetLangDualOrphanChild extends OrphanChild
{
public TargetLangDualOrphanChild()
{
super();
}
public String id()
{
String identifier = "TargetLangDualOrphanChild + " + super.id();
return identifier;
}
}

View File

@@ -0,0 +1,51 @@
import director_default.*;
public class director_default_runme {
static {
try {
System.loadLibrary("director_default");
} 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_default_MyFoo a = new director_default_MyFoo();
a = new director_default_MyFoo(10);
}
director_default_MyFoo a = new director_default_MyFoo();
if (!a.GetMsg().equals("director_default_MyFoo-default")) {
throw new RuntimeException ( "Test 1 failed" );
}
if (!a.GetMsg("boo").equals("director_default_MyFoo-boo")) {
throw new RuntimeException ( "Test 2 failed" );
}
Foo b = new Foo();
if (!b.GetMsg().equals("Foo-default")) {
throw new RuntimeException ( "Test 1 failed" );
}
if (!b.GetMsg("boo").equals("Foo-boo")) {
throw new RuntimeException ( "Test 2 failed" );
}
}
}
class director_default_MyFoo extends Foo {
public director_default_MyFoo() {
super();
}
public director_default_MyFoo(int i) {
super(i);
}
public String Msg(String msg) {
return "director_default_MyFoo-" + msg;
}
}

View File

@@ -0,0 +1,54 @@
import director_enum.*;
public class director_enum_runme {
static {
try {
System.loadLibrary("director_enum");
} 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_enum_MyFoo a = new director_enum_MyFoo();
if (a.ping(Hallo.awright) != Hallo.yo) {
throw new RuntimeException ( "a.ping()" );
}
if (a.ping_ref(Hallo.awright) != Hallo.hello) {
throw new RuntimeException ( "a.ping_ref()" );
}
if (a.ping_member_enum(Foo.Bye.adios) != Foo.Bye.aufwiedersehen) {
throw new RuntimeException ( "a.ping_member_enum()" );
}
Foo b = new Foo();
if (b.ping(Hallo.awright) != Hallo.awright) {
throw new RuntimeException ( "b.ping()" );
}
if (b.ping_ref(Hallo.awright) != Hallo.awright) {
throw new RuntimeException ( "b.ping_ref()" );
}
if (b.ping_member_enum(Foo.Bye.adios) != Foo.Bye.adios) {
throw new RuntimeException ( "b.ping_member_enum()" );
}
}
}
class director_enum_MyFoo extends Foo {
public Hallo say_hi(Hallo h) {
return Hallo.yo;
}
public Hallo say_hi_ref(Hallo h) {
return Hallo.hello;
}
public Foo.Bye say_bye(Foo.Bye b) {
return Foo.Bye.aufwiedersehen;
}
}

View File

@@ -0,0 +1,35 @@
import director_exception_catches.*;
public class director_exception_catches_runme {
static {
try {
System.loadLibrary("director_exception_catches");
} 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[]) {
BaseClass b = new director_exception_catches_MyClass();
try {
String s = BaseClass.call_description(b);
throw new RuntimeException("Failed to catch exception");
} catch (NullPointerException e) {
if (!e.getMessage().startsWith("Testing exception thrown in BaseClass.description"))
throw new RuntimeException("Unexpected exception message: " + e.getMessage());
}
}
}
class director_exception_catches_MyClass extends BaseClass {
@Override
public String description() {
throw new NullPointerException("Testing exception thrown in BaseClass.description");
}
}

View File

@@ -0,0 +1,34 @@
import director_exception.*;
public class director_exception_runme {
static {
try {
System.loadLibrary("director_exception");
} 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_exception_MyFoo a = new director_exception_MyFoo();
Foo b = director_exception.launder(a);
try {
a.pong();
throw new RuntimeException ( "Failed to catch exception" );
}
catch (UnsupportedOperationException e) {
}
}
}
class director_exception_MyFoo extends Foo {
public String ping() {
throw new UnsupportedOperationException("Foo::ping not implemented");
}
}

View File

@@ -0,0 +1,39 @@
import director_frob.*;
import java.lang.reflect.*;
public class director_frob_runme
{
static {
try {
System.loadLibrary("director_frob");
} 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 args[])
{
Bravo foo = new Bravo();
String s = foo.abs_method();
if (!s.equals("Bravo::abs_method()"))
throw new RuntimeException( "error" );
Prims prims = new PrimsDerived();
java.math.BigInteger bi = prims.callull(200, 50);
java.math.BigInteger biCheck = new java.math.BigInteger("150");
if (bi.compareTo(biCheck) != 0)
throw new RuntimeException( "failed got:" + bi);
}
}
class PrimsDerived extends Prims {
PrimsDerived() {
super();
}
public java.math.BigInteger ull(java.math.BigInteger i, java.math.BigInteger j) {
return i.subtract(j);
}
}

View File

@@ -0,0 +1,40 @@
import director_ignore.*;
public class director_ignore_runme {
static {
try {
System.loadLibrary("director_ignore");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
// Just check the classes can be instantiated and other methods work as expected
DIgnoresDerived a = new DIgnoresDerived();
if (a.Triple(5) != 15)
throw new RuntimeException("Triple failed");
DAbstractIgnoresDerived b = new DAbstractIgnoresDerived();
if (b.Quadruple(5) != 20)
throw new RuntimeException("Quadruple failed");
}
}
class DIgnoresDerived extends DIgnores
{
public DIgnoresDerived()
{
super();
}
}
class DAbstractIgnoresDerived extends DAbstractIgnores
{
public DAbstractIgnoresDerived()
{
super();
}
}

View File

@@ -0,0 +1,41 @@
import director_nested_class.*;
public class director_nested_class_runme {
static {
try {
System.loadLibrary("director_nested_class");
} 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_nested_class_Derived d = new director_nested_class_Derived();
if (DirectorOuter.callMethod(d, 999) != 9990) {
throw new RuntimeException("callMethod(999) failed");
}
director_nested_class_DerivedInnerInner dinner = new director_nested_class_DerivedInnerInner();
if (DirectorOuter.callInnerInnerMethod(dinner, 999) != 999000) {
throw new RuntimeException("callMethod(999) failed");
}
}
}
class director_nested_class_Derived extends DirectorOuter.DirectorInner {
public int vmethod(int input) {
return input * 10;
}
}
class director_nested_class_DerivedInnerInner extends DirectorOuter.DirectorInner.DirectorInnerInner {
public int innervmethod(int input) {
return input * 1000;
}
}

View File

@@ -0,0 +1,48 @@
// Make sure that directors are connected and disconnected when used inconjunction with
// the %nspace feature
public class director_nspace_runme {
static {
try {
System.loadLibrary("director_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 main(String argv[]) {
director_nspace_MyBarFoo myBarFoo =
new director_nspace_MyBarFoo();
}
}
class director_nspace_MyBarFoo extends director_nspacePackage.TopLevel.Bar.Foo {
@Override
public String ping() {
return "director_nspace_MyBarFoo.ping();";
}
@Override
public String pong() {
return "director_nspace_MyBarFoo.pong();" + ping();
}
@Override
public String fooBar(director_nspacePackage.TopLevel.Bar.FooBar fooBar) {
return fooBar.FooBarDo();
}
@Override
public director_nspacePackage.TopLevel.Bar.Foo makeFoo() {
return new director_nspacePackage.TopLevel.Bar.Foo();
}
@Override
public director_nspacePackage.TopLevel.Bar.FooBar makeFooBar() {
return new director_nspacePackage.TopLevel.Bar.FooBar();
}
}

View File

@@ -0,0 +1,42 @@
import director_ownership.*;
public class director_ownership_runme {
static {
try {
System.loadLibrary("director_ownership");
} 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 set_content_and_release(Container container, ContentBase content) {
content.swigReleaseOwnership();
container.set_content(content);
}
public static void main(String argv[]) {
Container container = new Container();
// make a content in java (cMemoryOwn true)
ContentBase content_java = new ContentDerived();
// make a content in c++ (cMemoryOwn true)
ContentBase content_cpp = director_ownership.make_content();
set_content_and_release(container, content_java);
if (!container.get_content().get_name().equals("ContentDerived"))
throw new RuntimeException("did not get ContentDerived");
// when swigReleaseOwnership() is called on content_cpp, swig tries a static_cast to director and calls the method
// director->swig_java_change_ownership. The content created in c++ native library is not a director, therefore a
// segfault may occur.
// With a check done using dynamic_cast this issue could be avoided.
set_content_and_release(container, content_cpp);
if (!container.get_content().get_name().equals("ContentDerived"))
throw new RuntimeException("did not get ContentDerived");
}
}

View File

@@ -0,0 +1,48 @@
import director_pass_by_value.*;
public class director_pass_by_value_runme {
static {
try {
System.loadLibrary("director_pass_by_value");
} 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[]) {
Caller caller = new Caller();
caller.call_virtualMethod(new director_pass_by_value_Derived());
{
int countdown = 5;
while (true) {
WaitForGC();
if (--countdown == 0)
break;
};
}
// bug was the passByVal 'global' object was destroyed after the call to virtualMethod had finished.
int ret = director_pass_by_value_runme.passByVal.getVal();
if (ret != 0x12345678)
throw new RuntimeException("Bad return value, got " + Integer.toHexString(ret));
}
static PassedByValue passByVal;
}
class director_pass_by_value_Derived extends DirectorPassByValueAbstractBase {
public void virtualMethod(PassedByValue pbv) {
director_pass_by_value_runme.passByVal = pbv;
}
}

View File

@@ -0,0 +1,138 @@
/*
This test program shows a C# class JavaDerived inheriting from Base. Three types of classes are created
and the virtual methods called to demonstrate:
1) Wide variety of primitive types
2) Calling methods with zero, one or more parameters
3) Director methods that are not overridden in C#
4) Director classes that are not overridden at all in C#, ie non-director behaviour is as expected for director classes
5) Inheritance hierarchy using director methods
6) Return types working as well as parameters
The Caller class is a tester class, which calls the virtual functions from C++.
*/
import director_primitives.*;
public class director_primitives_runme {
static {
try {
System.loadLibrary("director_primitives");
} 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
{
director_primitives_runme r = new director_primitives_runme();
r.run();
}
void run()
{
if (director_primitives.getPrintDebug()) System.out.println("------------ Start ------------ ");
Caller myCaller = new Caller();
// test C++ base class
{
Base myBase = new Base(100.0);
makeCalls(myCaller, myBase);
myBase.delete();
}
if (director_primitives.getPrintDebug()) System.out.println("--------------------------------");
// test vanilla C++ wrapped derived class
{
Base myBase = new Derived(200.0);
makeCalls(myCaller, myBase);
myBase.delete();
}
if (director_primitives.getPrintDebug()) System.out.println("--------------------------------");
// test director / C# derived class
{
Base myBase = new JavaDerived(300.0);
makeCalls(myCaller, myBase);
myBase.delete();
}
if (director_primitives.getPrintDebug()) System.out.println("------------ Finish ------------ ");
}
void makeCalls(Caller myCaller, Base myBase)
{
myCaller.set(myBase);
myCaller.NoParmsMethodCall();
if (myCaller.BoolMethodCall(true) != true) throw new RuntimeException("failed");
if (myCaller.BoolMethodCall(false) != false) throw new RuntimeException("failed");
if (myCaller.IntMethodCall(-123) != -123) throw new RuntimeException("failed");
if (myCaller.UIntMethodCall(123) != 123) throw new RuntimeException("failed");
if (myCaller.FloatMethodCall((float)-123.456) != (float)-123.456) throw new RuntimeException("failed");
if (!myCaller.CharPtrMethodCall("test string").equals("test string")) throw new RuntimeException("failed");
if (!myCaller.ConstCharPtrMethodCall("another string").equals("another string")) throw new RuntimeException("failed");
if (myCaller.EnumMethodCall(HShadowMode.HShadowHard) != HShadowMode.HShadowHard) throw new RuntimeException("failed");
myCaller.ManyParmsMethodCall(true, -123, 123, (float)123.456, "test string", "another string", HShadowMode.HShadowHard);
myCaller.NotOverriddenMethodCall();
myCaller.reset();
}
}
class JavaDerived extends Base
{
public JavaDerived(double dd)
{
super(dd);
}
public void NoParmsMethod()
{
if (director_primitives.getPrintDebug()) System.out.println("JavaDerived - NoParmsMethod()");
}
public boolean BoolMethod(boolean x)
{
if (director_primitives.getPrintDebug()) System.out.println("JavaDerived - BoolMethod(" + x + ")");
return x;
}
public int IntMethod(int x)
{
if (director_primitives.getPrintDebug()) System.out.println("JavaDerived - IntMethod(" + x + ")");
return x;
}
public long UIntMethod(long x)
{
if (director_primitives.getPrintDebug()) System.out.println("JavaDerived - UIntMethod(" + x + ")");
return x;
}
public float FloatMethod(float x)
{
if (director_primitives.getPrintDebug()) System.out.println("JavaDerived - FloatMethod(" + x + ")");
return x;
}
public String CharPtrMethod(String x)
{
if (director_primitives.getPrintDebug()) System.out.println("JavaDerived - CharPtrMethod(" + x + ")");
return x;
}
public String ConstCharPtrMethod(String x)
{
if (director_primitives.getPrintDebug()) System.out.println("JavaDerived - ConstCharPtrMethod(" + x + ")");
return x;
}
public HShadowMode EnumMethod(HShadowMode x)
{
if (director_primitives.getPrintDebug()) System.out.println("JavaDerived - EnumMethod(" + x + ")");
return x;
}
public void ManyParmsMethod(boolean b, int i, long u, float f, String c, String cc, HShadowMode h)
{
if (director_primitives.getPrintDebug()) System.out.println("JavaDerived - ManyParmsMethod(" + b + ", " + i + ", " + u + ", " + f + ", " + c + ", " + cc + ", " + h);
}
}

View File

@@ -0,0 +1,115 @@
import director_protected.*;
import java.lang.reflect.*;
public class director_protected_runme {
static {
try {
System.loadLibrary("director_protected");
} 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[]) {
Bar b = new Bar();
Foo f = b.create();
director_protected_FooBar fb = new director_protected_FooBar();
director_protected_FooBar2 fb2 = new director_protected_FooBar2();
director_protected_FooBar3 fb3 = new director_protected_FooBar3();
{
String s = fb.used();
if (!s.equals("Foo::pang();Bar::pong();Foo::pong();director_protected_FooBar::ping();"))
throw new RuntimeException( "bad director_protected_FooBar::used" );
}
{
String s = fb2.used();
if (!s.equals("director_protected_FooBar2::pang();Bar::pong();Foo::pong();director_protected_FooBar2::ping();"))
throw new RuntimeException( "bad director_protected_FooBar2::used" );
}
{
String s = b.pong();
if (!s.equals("Bar::pong();Foo::pong();Bar::ping();"))
throw new RuntimeException( "bad Bar::pong" );
}
{
String s = f.pong();
if (!s.equals("Bar::pong();Foo::pong();Bar::ping();"))
throw new RuntimeException(" bad Foo::pong" );
}
{
String s3 = fb.pong();
if (!s3.equals("Bar::pong();Foo::pong();director_protected_FooBar::ping();"))
throw new RuntimeException(" bad director_protected_FooBar::pong" );
}
try {
Method method = b.getClass().getDeclaredMethod("ping", (java.lang.Class[])null);
if ( !Modifier.isProtected(method.getModifiers()) )
throw new RuntimeException("Bar::ping should be protected" );
method = f.getClass().getDeclaredMethod("ping", (java.lang.Class[])null);
if ( !Modifier.isProtected(method.getModifiers()) )
throw new RuntimeException("Foo::ping should be protected" );
method = b.getClass().getDeclaredMethod("cheer", (java.lang.Class[])null);
if ( !Modifier.isProtected(method.getModifiers()) )
throw new RuntimeException("Bar::cheer should be protected" );
method = f.getClass().getDeclaredMethod("cheer", (java.lang.Class[])null);
if ( !Modifier.isProtected(method.getModifiers()) )
throw new RuntimeException("Foo::cheer should be protected" );
} catch (NoSuchMethodException n) {
throw new RuntimeException(n);
} catch (SecurityException s) {
throw new RuntimeException("SecurityException caught. Test failed.");
}
if (!fb3.cheer().equals("director_protected_FooBar3::cheer();"))
throw new RuntimeException("bad fb3::cheer");
if (!fb2.callping().equals("director_protected_FooBar2::ping();"))
throw new RuntimeException("bad fb2.callping");
if (!fb2.callcheer().equals("director_protected_FooBar2::pang();Bar::pong();Foo::pong();director_protected_FooBar2::ping();"))
throw new RuntimeException("bad fb2.callcheer");
if (!fb3.callping().equals("Bar::ping();"))
throw new RuntimeException("bad fb3.callping");
if (!fb3.callcheer().equals("director_protected_FooBar3::cheer();"))
throw new RuntimeException("bad fb3.callcheer");
}
}
class director_protected_FooBar extends Bar {
public String ping() {
return "director_protected_FooBar::ping();";
}
}
class director_protected_FooBar2 extends Bar {
public String ping() {
return "director_protected_FooBar2::ping();";
}
public String pang() {
return "director_protected_FooBar2::pang();";
}
}
class director_protected_FooBar3 extends Bar {
public String cheer() {
return "director_protected_FooBar3::cheer();";
}
}

View File

@@ -0,0 +1,71 @@
import director_ref.*;
public class director_ref_runme {
static {
try {
System.loadLibrary("director_ref");
} 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_ref_MyFoo a = new director_ref_MyFoo();
if (a.GetRefCount() != 1) {
throw new RuntimeException ( "Refcount test 1 failed." );
}
// Make sure director logic still works.
if (!a.GetMsg().equals("director_ref_MyFoo-default")) {
throw new RuntimeException ( "Test 1 failed" );
}
if (!a.GetMsg("boo").equals("director_ref_MyFoo-boo")) {
throw new RuntimeException ( "Test 2 failed" );
}
a.delete(); // should delete the object.
if (a.cppDeleted != true) {
throw new RuntimeException ( "Unref test 1 failed." );
}
a = new director_ref_MyFoo();
FooPtr p = new FooPtr(a);
if (a.GetRefCount() != 2) {
throw new RuntimeException ( "Refcount test 2 failed." );
}
a.delete(); // Shouldn't actually delete the underlying object
if (a.cppDeleted) {
throw new RuntimeException ( "Unref test 2 failed." );
}
if (p.GetOwnedRefCount() != 1) {
throw new RuntimeException ( "Unref test 3 failed." );
}
p.Reset(); // Now it should be deleted on the cpp side.
// We can't check cppDeleted because the director will stop
// working after a delete() call.
if (p.GetOwnedRefCount() != 0) {
throw new RuntimeException ( "Unref test 4 failed." );
}
}
}
class director_ref_MyFoo extends Foo {
public director_ref_MyFoo() {
super();
}
public director_ref_MyFoo(int i) {
super(i);
}
public String Msg(String msg) {
return "director_ref_MyFoo-" + msg;
}
public void OnDelete() {
cppDeleted = true;
}
public boolean cppDeleted = false;
}

View File

@@ -0,0 +1,96 @@
// 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);
}
}
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[]) {
director_smartptr.FooBar fooBar = new director_smartptr.FooBar();
director_smartptr.Foo myBarFoo = new director_smartptr_MyBarFoo();
check(myBarFoo.ping(), "director_smartptr_MyBarFoo.ping()");
check(director_smartptr.Foo.callPong(myBarFoo), "director_smartptr_MyBarFoo.pong();director_smartptr_MyBarFoo.ping()");
check(director_smartptr.Foo.callUpcall(myBarFoo, fooBar), "override;Bar::Foo2::Foo2Bar()");
director_smartptr.Foo myFoo = myBarFoo.makeFoo();
check(myFoo.pong(), "Foo::pong();Foo::ping()");
check(director_smartptr.Foo.callPong(myFoo), "Foo::pong();Foo::ping()");
check(myFoo.upcall(fooBar), "Bar::Foo2::Foo2Bar()");
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();
}
}
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 upcall(director_smartptr.FooBar fooBarPtr) {
return "override;" + fooBarPtr.FooBarDo();
}
@Override
public director_smartptr.Foo makeFoo() {
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();
}
}

View File

@@ -0,0 +1,56 @@
import director_string.*;
public class director_string_runme {
static {
try {
System.loadLibrary("director_string");
} 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[]) {
String s;
director_string_A c = new director_string_A("hi");
for (int i=0; i<3; i++) {
s = c.call_get(i);
if (!s.equals(new Integer(i).toString())) throw new RuntimeException("director_string_A.get(" + i + ") failed. Got:" + s);
}
director_string_B b = new director_string_B("hello");
s = b.call_get_first();
if (!s.equals("director_string_B.get_first")) throw new RuntimeException("call_get_first() failed");
s = b.call_get(0);
if (!s.equals("director_string_B.get: hello")) throw new RuntimeException("get(0) failed");
}
}
class director_string_B extends A {
public director_string_B(String first) {
super(first);
}
public String get_first() {
return "director_string_B.get_first";
}
public String get(int n) {
return "director_string_B.get: " + super.get(n);
}
}
class director_string_A extends A {
public director_string_A(String first) {
super(first);
}
public String get(int n) {
return new Integer(n).toString();
}
}

View File

@@ -0,0 +1,42 @@
import director_thread.*;
import java.lang.reflect.*;
public class director_thread_runme {
static {
try {
System.loadLibrary("director_thread");
} 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[]) {
// This test used to hang the process. The solution is to call DetachCurrentThread in ~JNIEnvWrapper, however it causes seg faults in other JNI calls on older JDKs on Solaris. See SWIG_JAVA_NO_DETACH_CURRENT_THREAD in director.swg.
director_thread_Derived d = new director_thread_Derived();
d.run();
if (d.getVal() >= 0) {
throw new RuntimeException("Failed. Val: " + d.getVal());
}
}
}
class director_thread_Derived extends Foo {
director_thread_Derived() {
super();
}
public void do_foo() {
// Not all operating systems can name threads, so only test on those that can
if (Foo.namedThread()) {
String threadName = Thread.currentThread().getName();
if (!threadName.equals("MyThreadName"))
throw new RuntimeException("Unexpected thread name: " + threadName);
}
setVal(getVal() - 1);
}
}

View File

@@ -0,0 +1,34 @@
import director_unroll.*;
public class director_unroll_runme {
static {
try {
System.loadLibrary("director_unroll");
} 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_unroll_MyFoo a = new director_unroll_MyFoo();
Bar b = new Bar();
b.set(a);
Foo c = b.get();
if (!c.ping().equals("director_unroll_MyFoo::ping()"))
throw new RuntimeException ( "c.ping()" );
}
}
class director_unroll_MyFoo extends Foo {
public String ping() {
return "director_unroll_MyFoo::ping()";
}
}

View File

@@ -0,0 +1,94 @@
import director_wombat.*;
public class director_wombat_runme
{
static {
try {
System.loadLibrary("director_wombat");
} 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[] args)
{
Bar b = new Bar();
Foo_integers a;
int retval;
a = b.meth();
if ((retval = a.meth(49)) != 49) {
throw new RuntimeException ("Test failed: retval = " + retval + ", expected 49");
}
a.delete();
a = new director_wombat_Foo_integers_derived();
if ((retval = a.meth(62)) != 62 + 2) {
throw new RuntimeException ("Test failed: retval = " + retval + ", expected 62 + 2");
}
a.delete();
a = new director_wombat_Foo_integers_derived_2();
if ((retval = a.meth(37)) != 37) {
throw new RuntimeException ("Test failed: retval = " + retval + ", expected 37");
}
b.delete();
b = new director_wombat_Bar_derived_1();
b.foo_meth_ref(a, 0);
b.foo_meth_ptr(a, 1);
b.foo_meth_val(a, 2);
}
}
class director_wombat_Foo_integers_derived extends Foo_integers
{
public director_wombat_Foo_integers_derived()
{
super();
}
public int meth(int param)
{
return param + 2;
}
}
class director_wombat_Foo_integers_derived_2 extends Foo_integers
{
public director_wombat_Foo_integers_derived_2()
{
super();
}
}
class director_wombat_Bar_derived_1 extends Bar
{
public director_wombat_Bar_derived_1()
{
super();
}
public void foo_meth_ref(Foo_integers foo_obj, int param)
{
if (!(foo_obj instanceof director_wombat_Foo_integers_derived_2)) {
throw new RuntimeException ("Test failed: foo_obj in foo_meth_ref is not director_wombat_Foo_integers_derived_2, got " + foo_obj);
}
}
public void foo_meth_ptr(Foo_integers foo_obj, int param)
{
if (!(foo_obj instanceof director_wombat_Foo_integers_derived_2)) {
throw new RuntimeException ("Test failed: foo_obj in foo_meth_ptr is not director_wombat_Foo_integers_derived_2, got " + foo_obj);
}
}
public void foo_meth_val(Foo_integers foo_obj, int param)
{
if (!(foo_obj instanceof director_wombat_Foo_integers_derived_2)) {
throw new RuntimeException ("Test failed: foo_obj in foo_meth_val is not director_wombat_Foo_integers_derived_2, got " + foo_obj);
}
}
}

View File

@@ -0,0 +1,32 @@
import doxygen_alias.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_alias_runme {
static {
try {
System.loadLibrary("doxygen_alias");
} 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[])
{
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_alias runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_alias"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_alias.doxygen_alias.make_something()",
" A function returning something.<br>\n" +
" <br>\n" +
" @return A new object which may be null.\n" +
"");
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,102 @@
import doxygen_basic_notranslate.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_basic_notranslate_runme {
static {
try {
System.loadLibrary("doxygen_basic_notranslate");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_basic_notranslate runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_basic_notranslate"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function3(int)",
" \n" +
" A test for overloaded functions\n" +
" This is function \\b one\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function4()",
" \n" +
" A test of some mixed tag usage\n" +
" \\if CONDITION\n" +
" This \\a code fragment shows us something \\.\n" +
" \\par Minuses:\n" +
" \\arg it's senseless\n" +
" \\arg it's stupid\n" +
" \\arg it's null\n" +
" \n" +
" \\warning This may not work as expected\n" +
" \n" +
" \\code\n" +
" int main() { while(true); }\n" +
" \\endcode\n" +
" \\endif\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function()",
" \n" +
" \\brief\n" +
" Brief description.\n" +
" \n" +
" The comment text\n" +
" \\author Some author\n" +
" \\return Some number\n" +
" \\sa function2\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function5(int)",
" This is a post comment. ");
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function7(doxygen_basic_notranslate.SWIGTYPE_p_p_p_Shape)",
" \n" +
" Test for a parameter with difficult type\n" +
" (mostly for python)\n" +
" @param a Very strange param\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function3(int, int)",
" \n" +
" A test for overloaded functions\n" +
" This is function \\b two\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function6(int)",
" \n" +
" Test for default args\n" +
" @param a Some parameter, default is 42\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function6()",
" \n" +
" Test for default args\n" +
" @param a Some parameter, default is 42\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function1()",
" Single line comment ");
wantedComments.put("doxygen_basic_notranslate.doxygen_basic_notranslate.function2()",
" \n" +
" A test of a very very very very very very very very very very very very very very very very\n" +
" very very very very very long comment string.\n" +
" \n" +
"");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,99 @@
import doxygen_basic_translate.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_basic_translate_runme {
static {
try {
System.loadLibrary("doxygen_basic_translate");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_basic_translate runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_basic_translate"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function()",
" \n" +
" Brief description.\n" +
" \n" +
" The comment text.\n" +
" @author Some author\n" +
" @return Some number\n" +
" @see function2\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function2()",
" A test of a very very very very very very very very very very very very very very very very \n" +
" very very very very very long comment string. \n" +
" \n" +
"");
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function4()",
" A test of some mixed tag usage \n" +
" If: CONDITION {\n" +
" This <i>code </i>fragment shows us something . \n" +
" <p alt=\"Minuses: \">\n" +
" <li>it's senseless \n" +
" </li><li>it's stupid \n" +
" </li><li>it's null \n" +
" \n" +
" </li></p>Warning: This may not work as expected \n" +
" \n" +
" {@code \n" +
"int main() { while(true); } \n" +
" }\n" +
" }\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function3(int)",
" A test for overloaded functions \n" +
" This is function <b>one </b>\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function5(int)",
" This is a post comment. \n" +
"");
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function6(int)",
" Test for default args \n" +
" @param a Some parameter, default is 42" +
" \n" +
"");
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function6()",
" Test for default args \n" +
" \n" +
"");
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function7(doxygen_basic_translate.SWIGTYPE_p_p_p_Shape)",
" Test for a parameter with difficult type \n" +
" (mostly for python) \n" +
" @param a Very strange param \n" +
"");
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function3(int, int)",
" A test for overloaded functions \n" +
" This is function <b>two </b>\n" +
" \n" +
"");
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.Atan2(double, double)",
" Multiple parameters test.\n" +
" \n" +
" @param y Vertical coordinate.\n" +
" @param x Horizontal coordinate.\n" +
" @return Arc tangent of <code>y/x</code>.\n" +
"");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,44 @@
import doxygen_ignore.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_ignore_runme {
static {
try {
System.loadLibrary("doxygen_ignore");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_ignore runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_ignore"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_ignore.doxygen_ignore.func()",
" A contrived example of ignoring too many commands in one comment.<br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" This is specific to <i>Java</i>.<br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" <br>\n" +
" Command ignored, but anything here is still included.<br>\n" +
" <br>\n" +
"\n" +
"\n" +
"\n" +
"");
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,200 @@
import doxygen_misc_constructs.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_misc_constructs_runme {
static {
try {
System.loadLibrary("doxygen_misc_constructs");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_misc_constructs runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_misc_constructs"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.getConnection()",
"\n" +
"\n" +
" This function returns connection id.\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.getAddress(doxygen_misc_constructs.SWIGTYPE_p_int, int)",
" Returns address of file line.\n" +
" \n" +
" @param fileName name of the file, where the source line is located\n" +
" @param line line number\n" +
" {@link Connection::getId() }<br>\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.getG_zipCode()",
" Tag endlink must be recognized also when it is the last token\n" +
" in the comment.\n" +
" \n" +
" {@link Connection::getId() }<br>\n" +
" {@link debugIdeTraceProfilerCoverageSample.py Python example. }\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.setG_zipCode(int)",
" Tag endlink must be recognized also when it is the last token\n" +
" in the comment.\n" +
"\n" +
" {@link Connection::getId() }<br>\n" +
" {@link debugIdeTraceProfilerCoverageSample.py Python example. }\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.getG_counter()",
" Tag endlink must be recognized also when followed by nonspace character.\n" +
"\n" +
" {@link Connection::getId() }<br>\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.waitTime(int)",
" Determines how long the <code>isystem.connect</code> should wait for running\n" +
" instances to respond. Only one of <code>lfWaitXXX</code> flags from IConnect::ELaunchFlags\n" +
" may be specified.\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.CConnectionConfig",
" This class contains information for connection to winIDEA. Its methods\n" +
" return reference to self, so we can use it like this:\n" +
" <pre>\n" +
" CConnectionConfig config = new CConnectionConfig();\n" +
" config.discoveryPort(5534).dllPath(\"C:\\\\myWinIDEA\\\\connect.dll\").id(\"main\");\n" +
" </pre>\n" +
"\n" +
" All parameters are optional. Set only what is required, default values are\n" +
" used for unspecified parameters.\n" +
" <p>\n" +
"\n" +
" {@link advancedWinIDEALaunching.py Python example. }<br>\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.getAddress(doxygen_misc_constructs.SWIGTYPE_p_int, int, boolean)",
" Returns address of file line.\n" +
"\n" +
" @param fileName name of the file, where the source line is located\n" +
" @param line line number\n" +
" @param isGetSize if set, for every object location both address and size are returned\n" +
"\n" +
" {@link Connection::getId() }<br>\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.setG_counter(char)",
" Tag endlink must be recognized also when followed by nonspace character.\n" +
"\n" +
" {@link Connection::getId() }<br>\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum",
" Class description.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested",
" Enum description.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.ONE",
" desc of one\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.TWO",
" desc of two\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.THREE",
" desc of three\n");
wantedComments.put("doxygen_misc_constructs.StructWithReturnComment",
" @return This is a bad place for this tag, but it should be ignored.");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.showList()",
" An example of a list in a documentation comment.<br>\n" +
" <br>\n" +
" - The first item of the list.<br>\n" +
" - The second list item, on<br>\n" +
" several indented lines,<br>\n" +
" showing that the indentation<br>\n" +
" is preserved.<br>\n" +
" - And the final list item after it.<br>\n" +
" <br>\n" +
" And this is not a list item any more.\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.isNoSpaceValidA()",
" This comment without space after '*' is valid in Doxygen.\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.isNoSpaceValidB()",
" .This comment without space after '*' is valid in Doxygen.\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashA()",
" Backslash following<code>word</code> is a valid doxygen command. Output contains\n" +
" 'followingword' with 'word' in code font.\n" +
"\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashB()",
" Doxy command without trailing space is ignored - nothing appears\n" +
" on output. Standalone \\ and '\\' get to output.\n" +
" Standalone @ and '@' get to output.\n" +
" Commands \"in quoted \\b strings are treated as plain text\".\n" +
" Commands not recognized by Doxygen are ignored.\n" +
" Backslashes in DOS paths d:and words\n" +
" following them do not appear on output, we must quote them with\n" +
" double quotes: \"d:\\xyz\\qwe\\myfile\", \"@something\". Single quotes do not help:\n" +
" 'd:'. Escaping works: d:\\xyz\\qwe\\myfile. Unix\n" +
" paths of course have no such problems: /xyz/qwe/myfile\n" +
" Commands for escaped symbols:\n" +
" $ @ \\ &amp; ~ &lt; &gt; # % &quot; . :: @text ::text" +
"\n");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashC()",
" Backslash e at end of <i>line</i> froze SWIG\n" +
" <i>with</i> old comment parser.\n" +
" @see MyClass#fun(char,float)\n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.cycle(int, java.lang.String)",
" The next line contains expression:\n" +
" <pre>\n" +
" ['retVal &lt; 10', 'g_counter == 23 &amp;&amp; g_mode &amp; 3']\n" +
" </pre>\n" +
"\n" +
" Both words should be emphasized <b>isystem.connect</b>.\n" +
" But not the last period. For <b>example</b>, comma should not be emphasized.\n" +
" Similar <b>for</b>: double colon.\n" +
"\n" +
" Spaces at the start of line should be taken into account:\n" +
" @param id used as prefix in log\n" +
" statements. The default value is empty string, which is OK if\n" +
" there is only one app. instance. Example:\n" +
" <pre>\n" +
" ctrl.setBP(\"func1\");\n" +
" </pre>\n" +
" If we set the id to <code>main_</code>, we get:\n" +
" <pre>\n" +
" main_ctrl.setBP(\"func1\");\n" +
" </pre>\n" +
"\n" +
" @param fileName name of the log file\n");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,48 @@
import doxygen_nested_class.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_nested_class_runme {
static {
try {
System.loadLibrary("doxygen_nested_class");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_nested_class runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_nested_class"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_nested_class.DoxOuter()",
" DoxOuter constructor ");
wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner",
" DoxInner class description ");
wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner()",
" DoxInner constructor ");
wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner.setDoxInt(int)",
" doxInt variable ");
wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner.getDoxInt()",
" doxInt variable ");
wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner.doxMethod()",
" doxMethod description ");
wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner.doxStaticMethod()",
" doxStaticMethod description ");
wantedComments.put("doxygen_nested_class.DoxOuter.DoxInner.doxShort",
" doxShort const variable ");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,66 @@
import doxygen_parsing_enums_proper.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_parsing_enums_proper_runme {
static {
try {
System.loadLibrary("doxygen_parsing_enums_proper");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_proper runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_parsing_enums_proper"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2.SOME_ITEM_10",
"Post comment for the first item \n" +
"");
wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum.SOME_ITEM_1",
" The comment for the first item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum",
" Testing comments before enum items \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2.SOME_ITEM_30",
"Post comment for the third item \n" +
"");
wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2",
" Testing comments after enum items \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum.SOME_ITEM_3",
" The comment for the third item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum.SOME_ITEM_2",
" The comment for the second item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2.SOME_ITEM_20",
"Post comment for the second item \n" +
"");
wantedComments.put("doxygen_parsing_enums_proper.SomeEnumWithTrailingComma.SOME_ITEM_100",
"Post comment after comma.");
wantedComments.put("doxygen_parsing_enums_proper.SomeEnumWithTrailingComma.SOME_ITEM_200",
"Post comment after last comma.");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,58 @@
import doxygen_parsing_enums_simple.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_parsing_enums_simple_runme {
static {
try {
System.loadLibrary("doxygen_parsing_enums_simple");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_simple runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_parsing_enums_simple"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_30",
"Post comment for the third item \n" +
"");
wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_3",
" The comment for the third item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_2",
" The comment for the second item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_10",
"Post comment for the first item \n" +
"");
wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_20",
"Post comment for the second item \n" +
"");
wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_1",
" The comment for the first item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_100",
"Post comment after comma.");
wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_200",
"Post comment after last comma.");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,67 @@
import doxygen_parsing_enums_typesafe.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_parsing_enums_typesafe_runme {
static {
try {
System.loadLibrary("doxygen_parsing_enums_typesafe");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typesafe runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_parsing_enums_typesafe"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum.SOME_ITEM_1",
" The comment for the first item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2",
" Testing comments after enum items \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum.SOME_ITEM_2",
" The comment for the second item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2.SOME_ITEM_20",
"Post comment for the second item \n" +
"");
wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum",
" Testing comments before enum items \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2.SOME_ITEM_10",
"Post comment for the first item \n" +
"");
wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum.SOME_ITEM_3",
" The comment for the third item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2.SOME_ITEM_30",
"Post comment for the third item \n" +
"");
wantedComments.put("doxygen_parsing_enums_typesafe.SomeEnumWithTrailingComma.SOME_ITEM_100",
"Post comment after comma.");
wantedComments.put("doxygen_parsing_enums_typesafe.SomeEnumWithTrailingComma.SOME_ITEM_200",
"Post comment after last comma.");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,66 @@
import doxygen_parsing_enums_typeunsafe.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_parsing_enums_typeunsafe_runme {
static {
try {
System.loadLibrary("doxygen_parsing_enums_typeunsafe");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typeunsafe runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_parsing_enums_typeunsafe"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum.SOME_ITEM_2",
" The comment for the second item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum.SOME_ITEM_3",
" The comment for the third item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum.SOME_ITEM_1",
" The comment for the first item \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2.SOME_ITEM_20",
"Post comment for the second item \n" +
"");
wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum",
" Testing comments before enum items \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2",
" Testing comments after enum items \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2.SOME_ITEM_30",
"Post comment for the third item \n" +
"");
wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2.SOME_ITEM_10",
"Post comment for the first item \n" +
"");
wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeEnumWithTrailingComma.SOME_ITEM_100",
"Post comment after comma.");
wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeEnumWithTrailingComma.SOME_ITEM_200",
"Post comment after last comma.");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,141 @@
import doxygen_parsing.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_parsing_runme {
static {
try {
System.loadLibrary("doxygen_parsing");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_parsing runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_parsing"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_parsing.SomeAnotherClass",
" SomeAnotherClass description");
wantedComments.put("doxygen_parsing.SomeAnotherClass(int)",
" First overloaded constructor.");
wantedComments.put("doxygen_parsing.SomeAnotherClass(java.lang.String)",
" Second overloaded constructor.");
wantedComments.put("doxygen_parsing.SomeAnotherClass.getClassAttr()",
" The class attribute comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherClass.setClassAttr3(int)",
"The class attribute post-comment with details \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherStruct.setStructAttr3(int)",
"The struct attribute post-comment with details \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherClass.classMethodExtended2(int, int)",
" The class method with parameter \n" +
" \n" +
" @param a Parameter a \n" +
" @param b Parameter b \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeStruct",
" The struct comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.doxygen_parsing.setSomeVar(int)",
" The var comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherStruct.structMethod()",
" The struct method comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.doxygen_parsing.someFunction()",
" The function comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherClass.classMethodExtended(int, int)",
" The class method with parameter \n" +
" \n" +
" @param a Parameter a \n" +
" @param b Parameter b \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherClass.setClassAttr(int)",
" The class attribute comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherStruct.structMethodExtended(int, int)",
" The struct method with parameter \n" +
" \n" +
" @param a Parameter a \n" +
" @param b Parameter b \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherStruct.getStructAttr()",
" The struct attribute comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeClass",
" The class comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherStruct.getStructAttr3()",
"The struct attribute post-comment with details \n" +
"");
wantedComments.put("doxygen_parsing.doxygen_parsing.getSomeVar()",
" The var comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherStruct.setStructAttr2(int)",
"The struct attribute post-comment \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherClass.getClassAttr2()",
"The class attribute post-comment \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherStruct.getStructAttr2()",
"The struct attribute post-comment \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherStruct.setStructAttr(int)",
" The struct attribute comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeEnum",
" The enum comment \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherClass.getClassAttr3()",
"The class attribute post-comment with details \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherClass.classMethod()",
" The class method comment.<br>\n" +
" <br>\n" +
" {@link SomeAnotherClass#classMethodExtended(int,int) a link text }\n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherStruct.structMethodExtended2(int, int)",
" The struct method with parameter \n" +
" \n" +
" @param a Parameter a \n" +
" @param b Parameter b \n" +
" \n" +
"");
wantedComments.put("doxygen_parsing.SomeAnotherClass.setClassAttr2(int)",
"The class attribute post-comment \n" +
"");
wantedComments.put("doxygen_parsing.doxygen_parsingConstants.CONSTANT_VALUE",
"The constant comment \n" +
"");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,153 @@
import doxygen_translate_all_tags.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_translate_all_tags_runme {
static {
try {
System.loadLibrary("doxygen_translate_all_tags");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_translate_all_tags runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_translate_all_tags"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func01(int)",
" <i>Hello </i>\n\n\n" +
" <a id=\"theAnchor\"></a>\n\n\n" +
" <li>some list item</li>\n\n" +
" This is attention!\n" +
" You were warned!\n" +
" @author lots of them\n" +
" @author Zubr\n\n" +
" <b>boldword</b>\n\n" +
" Some brief description,\n" +
" extended to many lines.\n\n" +
" Not everything works right now...\n" +
" <code>codeword</code>\n\n\n\n\n\n" +
" <i>citationword</i>\n" +
" {@code some test code }\n");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func02(int)",
" Conditional comment: SOMECONDITION \n" +
" Some conditional comment \n" +
" End of conditional comment.\n" +
" Copyright: some copyright \n" +
" 1970 - 2012 \n" +
" @deprecated Now use another function \n" +
" This is very large \n" +
" and detailed description of some thing \n");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func03(int)",
" Comment for <b>func03()</b>.\n" +
" <i>italicword </i>\n" +
" <i>emphazedWord </i>\n" +
" @ example someFile.txt\n" +
" Some details on using the example");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func04(int)",
" @exception SuperError \n" +
" \\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \n" +
" \\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \n" +
" \\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \n" +
" This will only appear in hmtl \n");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func05(int)",
" If: ANOTHERCONDITION {\n" +
" First part of comment \n" +
" If: SECONDCONDITION {\n" +
" Nested condition text \n" +
" }Else if: THIRDCONDITION {\n" +
" The third condition text \n" +
" }Else: {The last text block \n" +
" }\n" +
" }Else: {Second part of comment \n" +
" If: CONDITION {\n" +
" Second part extended \n" +
" }\n" +
" }\n" +
" If not: SOMECONDITION {\n" +
" This is printed if not \n" +
" }\n" +
" <img src=testImage.bmp alt=\"Hello, world!\" />\n" +
" Some text \n" +
" describing invariant. \n");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func06(int)",
" Comment for <b>func06()</b>.\n" +
" This will only appear in LATeX \n" +
" <ul> \n" +
" <li>Some unordered list \n" +
" </li><li>With lots of items \n" +
" </li><li>lots of lots of items \n" +
" </li></ul> \n" +
" {@link someMember Some description follows }\n" +
" This will only appear in man\n");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func07(int)",
" Comment for <b>func07()</b>.\n" +
" Note: Here \n" +
" is the note! \n" +
" This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.\n" +
" <code>someword </code>\n" +
" @package superPackage \n" +
" <p alt=\"The paragraph title \">\n" +
" The paragraph text. \n" +
" Maybe even multiline \n" +
" </p>\n" +
" @param a the first param\n");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func08(int)",
"<a id=\"someAnchor\"></a>\n" +
"Text after anchor.\n" +
"<a href=\"#someAnchor\">Anchor description</a>\n" +
"<a href=\"#someAnchor\">someAnchor</a> not quoted text is not part of ref tag\n" +
"<a href=\"#someAnchor\">someAnchor</a>\n" +
" Remarks: Some remark text \n" +
" Remarks: Another remarks section \n" +
" @return Whatever \n" +
" @return it \n" +
" @return may return \n");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func09(int)",
" This will only appear in RTF \n" +
" @see someOtherMethod \n" +
" @see function \n" +
" Same as \n" +
" brief description \n" +
" @since version 0.0.0.1 \n" +
" @throws superException \n" +
" @throws RuntimeError \n");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func10(int, float)",
" TODO: Some very important task \n" +
" @param b B is mentioned again... \n" +
" {@literal \n" +
"very long \n" +
"text with tags <sometag> \n" +
" }\n" +
" @version 0.0.0.2 \n" +
" Warning: This is senseless! \n" +
" This will only appear in XML \n" +
" Here goes test of symbols: \n" +
" $ @ \\ &amp; ~ &lt; &gt; # % &quot; . :: \n" +
" And here goes simple text \n" +
"");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,69 @@
import doxygen_translate_links.*;
import com.sun.javadoc.*;
import java.util.HashMap;
public class doxygen_translate_links_runme {
static {
try {
System.loadLibrary("doxygen_translate_links");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_translate_links runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_translate_links"});
HashMap<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_translate_links.doxygen_translate_links.function()",
" \n" +
" Testing typenames converting in @ link \n" +
" \n" +
" {@link superFunc(int,String) \n" +
" Test for std_string member \n" +
" }\n" +
" \n" +
" {@link superFunc(int,int,SWIGTYPE_p_void) \n" +
" Test for simple types \n" +
" }\n" +
" \n" +
" {@link superFunc(SWIGTYPE_p_p_Shape) \n" +
" Test for custom types \n" +
" }\n" +
" \n" +
" {@link superFunc(SWIGTYPE_p_p_p_int) \n" +
" Test for complex types \n" +
" }\n" +
" \n" +
" same works for 'See also:' links: \n" +
" \n" +
" @see superFunc(int,String)\n" +
" @see superFunc(int,int,SWIGTYPE_p_void)\n" +
" @see superFunc(SWIGTYPE_p_p_Shape)\n" +
" @see superFunc(SWIGTYPE_p_p_p_int)\n" +
" \n" +
" some failing params: \n" +
" \n" +
" @see superFunc() \n" +
" @see superFunc() \n" +
" @see superFunc() \n" +
" \n" +
" \n" +
"");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,279 @@
import doxygen_translate.*;
import com.sun.javadoc.*;
import java.util.HashMap;
import java.util.Map;
public class doxygen_translate_runme {
static {
try {
System.loadLibrary("doxygen_translate");
} 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[])
{
/*
Here we are using internal javadoc tool, it accepts the name of the class as paramterer,
and calls the start() method of that class with parsed information.
*/
CommentParser parser = new CommentParser();
com.sun.tools.javadoc.Main.execute("doxygen_translate runtime test",
"CommentParser",
new String[]{"-quiet", "doxygen_translate"});
Map<String, String> wantedComments = new HashMap<String, String>();
wantedComments.put("doxygen_translate.doxygen_translate.function(int, float)",
" <i>Hello </i>\n" +
" \n" +
" <li>some list item</li>\n" +
" \n" +
" @author lots of them \n" +
" \n" +
" @author Zubr \n" +
" \n" +
" <b>boldword </b>\n" +
" \n" +
" <code>codeword </code>\n" +
" \n" +
" <i>citationword </i>\n" +
" \n" +
" {@code some test code }\n" +
" \n" +
" Conditional comment: SOMECONDITION \n" +
" Some conditional comment \n" +
" End of conditional comment.\n" +
" \n" +
" Copyright: some copyright \n" +
" \n" +
" @deprecated Now use another function \n" +
" \n" +
" <i>italicword </i>\n" +
" \n" +
" @ example someFile.txt\n" +
" Some details on using the example\n" +
" \n" +
" @exception SuperError \n" +
" \n" +
" If: ANOTHERCONDITION {\n" +
" First part of comment \n" +
" If: SECONDCONDITION {\n" +
" Nested condition text}\n" +
" Else if: THIRDCONDITION {\n" +
" The third condition text}\n" +
" Else: {The last text block}}\n" +
" \n" +
" Else: {Second part of comment \n" +
" If: CONDITION {\n" +
" Second part extended}}\n" +
" \n" +
" \n" +
" \n" +
" If not: SOMECONDITION {\n" +
" This is printed if not}\n" +
" \n" +
" \n" +
" <img src=testImage.bmp alt=\"Hello, world!\"/>\n" +
" \n" +
" <ul> \n" +
" \n" +
" <li>Some unordered list</li>\n" +
" <li>With lots of items</li>\n" +
" <li>lots of lots of items</li>\n" +
" \n" +
" </ul> \n" +
" \n" +
" {@link someMember Some description follows }\n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" Note: Here \n" +
" is the note! \n" +
" \n" +
" This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.\n" +
" \n" +
" <code>someword </code>\n" +
" \n" +
" @package superPackage \n" +
" \n" +
" <p alt=\"The paragraph title \">\n" +
" The paragraph text. \n" +
" Maybe even multiline</p>\n" +
" \n" +
" @param a the first param \n" +
" \n" +
" Remarks: Some remark text \n" +
" \n" +
" Remarks: Another remarks section \n" +
" \n" +
" @return Whatever \n" +
" \n" +
" @return it \n" +
" \n" +
" @return may return \n" +
" \n" +
" @see someOtherMethod \n" +
" \n" +
" @see function \n" +
" \n" +
" @since version 0.0.0.1 \n" +
" \n" +
" @throws superException \n" +
" \n" +
" @throws RuntimeError \n" +
" \n" +
" TODO: Some very important task \n" +
" \n" +
" @param b B is mentioned again... \n" +
" \n" +
" {@literal \n" +
"very long \n" +
"text with tags <sometag> \n" +
" }\n" +
" \n" +
" @version 0.0.0.2 \n" +
" \n" +
" Warning: This is senseless! \n" +
" \n" +
" Here goes test of symbols: \n" +
" $ @ \\ &amp; ~ &lt; &gt; # % &quot; . :: \n" +
" \n" +
" And here goes simple text \n" +
" \n" +
"");
wantedComments.put("doxygen_translate.doxygen_translate.htmlFunction(int, float)",
" Test for html tags. See Doxygen doc for list of tags recognized by Doxygen. \n" +
" \n" +
" <a href=\"http://acme.com/index.html\">This is link</a> \n" +
" <b>bold</b> \n" +
" <blockquote cite=\"http://www.worldwildlife.org/who/index.html\"> \n" +
" Quotation block. \n" +
" </blockquote> \n" +
" <br> \n" +
" <center>center</center> \n" +
" <code>this is code</code> \n" +
"\n" +
" <dl>\n" +
" <dt>Starts an item title.</dt>\n" +
" <dd>Starts an item description.</dd>\n" +
" </dl>\n" +
"\n" +
" <dfn> Starts a piece of text displayed in a typewriter font. \n" +
" </dfn> \n" +
" <div> Starts a section with a specific style (HTML only) \n" +
" </div> \n" +
" <em> Starts a piece of text displayed in an italic font.</em> \n" +
"\n" +
" <form> 'Form' does not generate any output. \n" +
" </form> \n" +
" <hr> \n" +
" <h1> Heading 1 \n" +
" </h1> \n" +
" <h2> Heading 2 \n" +
" </h2> \n" +
" <h3> Heading 3 \n" +
" </h3> \n" +
" <i>Starts a piece of text displayed in an italic font.</i> \n" +
" <input>Input tag. \n" +
" \n" +
" <img src=\"slika.png\"> \n" +
" <meta>Meta tag. \n" +
" <multicol>Multicol is ignored by doxygen. \n" +
" </multicol> \n" +
" \n" +
" <ol> \n" +
" <li>List item 1.</li> \n" +
" <li>List item 2.</li> \n" +
" </ol> \n" +
" \n" +
" <p> Starts a new paragraph. \n" +
" </p> \n" +
" <pre> Starts a preformatted fragment. \n" +
" </pre> \n" +
" <small> Starts a section of text displayed in a smaller font. \n" +
" </small> \n" +
" <span> Starts an inline text fragment with a specific style.</span> \n" +
" \n" +
" <strong> Starts a section of bold text.</strong> \n" +
" <sub> Starts a piece of text displayed in subscript.</sub> \n" +
" <sup> Starts a piece of text displayed in superscript.</sup> \n" +
" \n" +
" <table border = '1'> \n" +
" <caption>Animals</caption> \n" +
" <tr><th> Column 1 </th><th> Column 2 </th></tr> \n" +
" <tr><td> cow </td><td> dog </td></tr> \n" +
" <tr><td> cat </td><td> mouse </td></tr> \n" +
" <tr><td> horse </td><td> parrot </td></tr> \n" +
" </table> \n" +
" \n" +
" <tt> Starts a piece of text displayed in a typewriter font. \n" +
" </tt> \n" +
" <kbd> Starts a piece of text displayed in a typewriter font. \n" +
" </kbd> \n" +
" \n" +
" <ul>\n" +
" <li>List item 1.</li>\n" +
" <li>List item 2.</li>\n" +
" <li>List item 3.</li>\n" +
" </ul>\n" +
" \n" +
" <var> Starts a piece of text displayed in an italic font.</var> \n" +
" \n" +
"\n" +
"<u>underlined \\b bold text - doxy commands are ignored inside 'htmlonly' section </u>\n" +
"\n" +
"");
wantedComments.put("doxygen_translate.doxygen_translate.htmlTableFunction(int)",
"The meaning of flags:\n" +
"\n" +
" @param byFlags bits marking required items:\n" +
" <table>\n" +
" <tr><th> Size in bits</th><th> Items Required </th></tr>\n" +
" <tr><td> 1 - 8 </td><td> 1 </td></tr>\n" +
" <tr><td> 9 - 16 </td><td> 2 </td></tr>\n" +
" <tr><td> 17 - 32 </td><td> 4 </td></tr>\n" +
" </table>\n" +
" Almost all combinations of above flags are supported by\n" +
" <code>htmlTable...</code> functions.\n" +
"");
wantedComments.put("doxygen_translate.doxygen_translate.htmlEntitiesFunction(int, float)",
"All entities are treated as commands &copy; &trade; &reg;\n" +
"should work also&lt;in text \n" +
"&gt; \n" +
"&amp; \n" +
"&apos; \n" +
"&quot; \n" +
"&lsquo; \n" +
"&rsquo; \n" +
"&ldquo; \n" +
"&rdquo; \n" +
"&ndash; \n" +
"&mdash; \n" +
"&nbsp; \n" +
"&times; \n" +
"&minus; \n" +
"&sdot; \n" +
"&sim; \n" +
"&le; \n" +
"&ge; \n" +
"&larr; \n" +
"&rarr; \n" +
"Not an html entity - ignored by Doxygen. \n" +
"Not an &amp;text html entity - ampersand is replaced with entity.\n" +
"");
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
}

View File

@@ -0,0 +1,28 @@
import dynamic_cast.*;
public class dynamic_cast_runme {
static {
try {
System.loadLibrary("dynamic_cast");
} 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[])
{
Foo f = new Foo();
Bar b = new Bar();
Foo x = f.blah();
Foo y = b.blah();
// Note it is possible to downcast y with a Java cast.
String a = dynamic_cast.do_test((Bar)y);
if (!a.equals("Bar::test")) {
throw new RuntimeException("Failed!");
}
}
}

View 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);
}
}

View File

@@ -0,0 +1,117 @@
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;
}
{
Greeks15 a = Greeks15.alpha15;
a = Greeks15.beta15;
a = Greeks15.theta15;
a = Greeks15.delta15;
if (a.swigValue() != 153)
throw new RuntimeException("Greeks15");
}
{
Greeks16 a = Greeks16.alpha16;
a = Greeks16.beta16;
a = Greeks16.theta16;
a = Greeks16.delta16;
if (a.swigValue() != 163)
throw new RuntimeException("Greeks16");
}
{
Greeks17 a = Greeks17.alpha17;
a = Greeks17.beta17;
a = Greeks17.theta17;
a = Greeks17.delta17;
if (a.swigValue() != 173)
throw new RuntimeException("Greeks17");
}
}
}

View File

@@ -0,0 +1,443 @@
import enum_thorough_proper.*;
public class enum_thorough_proper_runme {
static {
try {
System.loadLibrary("enum_thorough_proper");
} 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[])
{
{
// Anonymous enums
int i = enum_thorough_proper.AnonEnum1;
if (enum_thorough_proper.ReallyAnInteger != 200) throw new RuntimeException("Test Anon 1 failed");
int j = enum_thorough_proper.AnonSpaceEnum1;
int k = AnonStruct.AnonStructEnum1;
}
{
colour red = colour.red;
enum_thorough_proper.colourTest1(red);
enum_thorough_proper.colourTest2(red);
enum_thorough_proper.colourTest3(red);
enum_thorough_proper.colourTest4(red);
enum_thorough_proper.setMyColour(red);
}
{
SpeedClass s = new SpeedClass();
SpeedClass.speed speed = SpeedClass.speed.slow;
if (s.speedTest1(speed) != speed) throw new RuntimeException("speedTest 1 failed");
if (s.speedTest2(speed) != speed) throw new RuntimeException("speedTest 2 failed");
if (s.speedTest3(speed) != speed) throw new RuntimeException("speedTest 3 failed");
if (s.speedTest4(speed) != speed) throw new RuntimeException("speedTest 4 failed");
if (s.speedTest5(speed) != speed) throw new RuntimeException("speedTest 5 failed");
if (s.speedTest6(speed) != speed) throw new RuntimeException("speedTest 6 failed");
if (s.speedTest7(speed) != speed) throw new RuntimeException("speedTest 7 failed");
if (s.speedTest8(speed) != speed) throw new RuntimeException("speedTest 8 failed");
if (enum_thorough_proper.speedTest1(speed) != speed) throw new RuntimeException("speedTest Global 1 failed");
if (enum_thorough_proper.speedTest2(speed) != speed) throw new RuntimeException("speedTest Global 2 failed");
if (enum_thorough_proper.speedTest3(speed) != speed) throw new RuntimeException("speedTest Global 3 failed");
if (enum_thorough_proper.speedTest4(speed) != speed) throw new RuntimeException("speedTest Global 4 failed");
if (enum_thorough_proper.speedTest5(speed) != speed) throw new RuntimeException("speedTest Global 5 failed");
}
{
SpeedClass s = new SpeedClass();
SpeedClass.speed slow = SpeedClass.speed.slow;
SpeedClass.speed lightning = SpeedClass.speed.lightning;
if (s.getMySpeedtd1() != slow) throw new RuntimeException("mySpeedtd1 1 failed");
if (s.getMySpeedtd1().swigValue() != 10) throw new RuntimeException("mySpeedtd1 2 failed");
s.setMySpeedtd1(lightning);
if (s.getMySpeedtd1() != lightning) throw new RuntimeException("mySpeedtd1 3 failed");
if (s.getMySpeedtd1().swigValue() != 31) throw new RuntimeException("mySpeedtd1 4 failed");
}
{
if (enum_thorough_proper.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new RuntimeException("namedanonTest 1 failed");
}
{
twonames val = twonames.TwoNames2;
if (enum_thorough_proper.twonamesTest1(val) != val) throw new RuntimeException("twonamesTest 1 failed");
if (enum_thorough_proper.twonamesTest2(val) != val) throw new RuntimeException("twonamesTest 2 failed");
if (enum_thorough_proper.twonamesTest3(val) != val) throw new RuntimeException("twonamesTest 3 failed");
}
{
TwoNamesStruct t = new TwoNamesStruct();
TwoNamesStruct.twonames val = TwoNamesStruct.twonames.TwoNamesStruct1;
if (t.twonamesTest1(val) != val) throw new RuntimeException("twonamesTest 1 failed");
if (t.twonamesTest2(val) != val) throw new RuntimeException("twonamesTest 2 failed");
if (t.twonamesTest3(val) != val) throw new RuntimeException("twonamesTest 3 failed");
}
{
namedanonspace val = namedanonspace.NamedAnonSpace2;
if (enum_thorough_proper.namedanonspaceTest1(val) != val) throw new RuntimeException("namedanonspaceTest 1 failed");
if (enum_thorough_proper.namedanonspaceTest2(val) != val) throw new RuntimeException("namedanonspaceTest 2 failed");
if (enum_thorough_proper.namedanonspaceTest3(val) != val) throw new RuntimeException("namedanonspaceTest 3 failed");
if (enum_thorough_proper.namedanonspaceTest4(val) != val) throw new RuntimeException("namedanonspaceTest 4 failed");
}
{
TemplateClassInt t = new TemplateClassInt();
TemplateClassInt.scientists galileo = TemplateClassInt.scientists.galileo;
if (t.scientistsTest1(galileo) != galileo) throw new RuntimeException("scientistsTest 1 failed");
if (t.scientistsTest2(galileo) != galileo) throw new RuntimeException("scientistsTest 2 failed");
if (t.scientistsTest3(galileo) != galileo) throw new RuntimeException("scientistsTest 3 failed");
if (t.scientistsTest4(galileo) != galileo) throw new RuntimeException("scientistsTest 4 failed");
if (t.scientistsTest5(galileo) != galileo) throw new RuntimeException("scientistsTest 5 failed");
if (t.scientistsTest6(galileo) != galileo) throw new RuntimeException("scientistsTest 6 failed");
if (t.scientistsTest7(galileo) != galileo) throw new RuntimeException("scientistsTest 7 failed");
if (t.scientistsTest8(galileo) != galileo) throw new RuntimeException("scientistsTest 8 failed");
if (t.scientistsTest9(galileo) != galileo) throw new RuntimeException("scientistsTest 9 failed");
// if (t.scientistsTestA(galileo) != galileo) throw new RuntimeException("scientistsTest A failed");
if (t.scientistsTestB(galileo) != galileo) throw new RuntimeException("scientistsTest B failed");
// if (t.scientistsTestC(galileo) != galileo) throw new RuntimeException("scientistsTest C failed");
if (t.scientistsTestD(galileo) != galileo) throw new RuntimeException("scientistsTest D failed");
if (t.scientistsTestE(galileo) != galileo) throw new RuntimeException("scientistsTest E failed");
if (t.scientistsTestF(galileo) != galileo) throw new RuntimeException("scientistsTest F failed");
if (t.scientistsTestG(galileo) != galileo) throw new RuntimeException("scientistsTest G failed");
if (t.scientistsTestH(galileo) != galileo) throw new RuntimeException("scientistsTest H failed");
if (t.scientistsTestI(galileo) != galileo) throw new RuntimeException("scientistsTest I failed");
if (t.scientistsTestJ(galileo) != galileo) throw new RuntimeException("scientistsTest J failed");
if (enum_thorough_proper.scientistsTest1(galileo) != galileo) throw new RuntimeException("scientistsTest Global 1 failed");
if (enum_thorough_proper.scientistsTest2(galileo) != galileo) throw new RuntimeException("scientistsTest Global 2 failed");
if (enum_thorough_proper.scientistsTest3(galileo) != galileo) throw new RuntimeException("scientistsTest Global 3 failed");
if (enum_thorough_proper.scientistsTest4(galileo) != galileo) throw new RuntimeException("scientistsTest Global 4 failed");
if (enum_thorough_proper.scientistsTest5(galileo) != galileo) throw new RuntimeException("scientistsTest Global 5 failed");
if (enum_thorough_proper.scientistsTest6(galileo) != galileo) throw new RuntimeException("scientistsTest Global 6 failed");
if (enum_thorough_proper.scientistsTest7(galileo) != galileo) throw new RuntimeException("scientistsTest Global 7 failed");
if (enum_thorough_proper.scientistsTest8(galileo) != galileo) throw new RuntimeException("scientistsTest Global 8 failed");
}
{
TClassInt t = new TClassInt();
TClassInt.scientists bell = TClassInt.scientists.bell;
TemplateClassInt.scientists galileo = TemplateClassInt.scientists.galileo;
if (t.scientistsNameTest1(bell) != bell) throw new RuntimeException("scientistsNameTest 1 failed");
if (t.scientistsNameTest2(bell) != bell) throw new RuntimeException("scientistsNameTest 2 failed");
if (t.scientistsNameTest3(bell) != bell) throw new RuntimeException("scientistsNameTest 3 failed");
if (t.scientistsNameTest4(bell) != bell) throw new RuntimeException("scientistsNameTest 4 failed");
if (t.scientistsNameTest5(bell) != bell) throw new RuntimeException("scientistsNameTest 5 failed");
if (t.scientistsNameTest6(bell) != bell) throw new RuntimeException("scientistsNameTest 6 failed");
if (t.scientistsNameTest7(bell) != bell) throw new RuntimeException("scientistsNameTest 7 failed");
if (t.scientistsNameTest8(bell) != bell) throw new RuntimeException("scientistsNameTest 8 failed");
if (t.scientistsNameTest9(bell) != bell) throw new RuntimeException("scientistsNameTest 9 failed");
// if (t.scientistsNameTestA(bell) != bell) throw new RuntimeException("scientistsNameTest A failed");
if (t.scientistsNameTestB(bell) != bell) throw new RuntimeException("scientistsNameTest B failed");
// if (t.scientistsNameTestC(bell) != bell) throw new RuntimeException("scientistsNameTest C failed");
if (t.scientistsNameTestD(bell) != bell) throw new RuntimeException("scientistsNameTest D failed");
if (t.scientistsNameTestE(bell) != bell) throw new RuntimeException("scientistsNameTest E failed");
if (t.scientistsNameTestF(bell) != bell) throw new RuntimeException("scientistsNameTest F failed");
if (t.scientistsNameTestG(bell) != bell) throw new RuntimeException("scientistsNameTest G failed");
if (t.scientistsNameTestH(bell) != bell) throw new RuntimeException("scientistsNameTest H failed");
if (t.scientistsNameTestI(bell) != bell) throw new RuntimeException("scientistsNameTest I failed");
if (t.scientistsNameSpaceTest1(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 1 failed");
if (t.scientistsNameSpaceTest2(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 2 failed");
if (t.scientistsNameSpaceTest3(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 3 failed");
if (t.scientistsNameSpaceTest4(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 4 failed");
if (t.scientistsNameSpaceTest5(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 5 failed");
if (t.scientistsNameSpaceTest6(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 6 failed");
if (t.scientistsNameSpaceTest7(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 7 failed");
if (t.scientistsOtherTest1(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 1 failed");
if (t.scientistsOtherTest2(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 2 failed");
if (t.scientistsOtherTest3(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 3 failed");
if (t.scientistsOtherTest4(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 4 failed");
if (t.scientistsOtherTest5(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 5 failed");
if (t.scientistsOtherTest6(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 6 failed");
if (t.scientistsOtherTest7(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 7 failed");
if (enum_thorough_proper.scientistsNameTest1(bell) != bell) throw new RuntimeException("scientistsNameTest Global 1 failed");
if (enum_thorough_proper.scientistsNameTest2(bell) != bell) throw new RuntimeException("scientistsNameTest Global 2 failed");
if (enum_thorough_proper.scientistsNameTest3(bell) != bell) throw new RuntimeException("scientistsNameTest Global 3 failed");
if (enum_thorough_proper.scientistsNameTest4(bell) != bell) throw new RuntimeException("scientistsNameTest Global 4 failed");
if (enum_thorough_proper.scientistsNameTest5(bell) != bell) throw new RuntimeException("scientistsNameTest Global 5 failed");
if (enum_thorough_proper.scientistsNameTest6(bell) != bell) throw new RuntimeException("scientistsNameTest Global 6 failed");
if (enum_thorough_proper.scientistsNameTest7(bell) != bell) throw new RuntimeException("scientistsNameTest Global 7 failed");
if (enum_thorough_proper.scientistsNameSpaceTest1(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 1 failed");
if (enum_thorough_proper.scientistsNameSpaceTest2(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 2 failed");
if (enum_thorough_proper.scientistsNameSpaceTest3(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 3 failed");
if (enum_thorough_proper.scientistsNameSpaceTest4(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 4 failed");
if (enum_thorough_proper.scientistsNameSpaceTest5(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 5 failed");
if (enum_thorough_proper.scientistsNameSpaceTest6(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 6 failed");
if (enum_thorough_proper.scientistsNameSpaceTest7(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 7 failed");
if (enum_thorough_proper.scientistsNameSpaceTest8(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 8 failed");
if (enum_thorough_proper.scientistsNameSpaceTest9(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 9 failed");
if (enum_thorough_proper.scientistsNameSpaceTestA(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global A failed");
if (enum_thorough_proper.scientistsNameSpaceTestB(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global B failed");
if (enum_thorough_proper.scientistsNameSpaceTestC(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global C failed");
if (enum_thorough_proper.scientistsNameSpaceTestD(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global D failed");
if (enum_thorough_proper.scientistsNameSpaceTestE(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global E failed");
if (enum_thorough_proper.scientistsNameSpaceTestF(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global F failed");
if (enum_thorough_proper.scientistsNameSpaceTestG(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global G failed");
if (enum_thorough_proper.scientistsNameSpaceTestH(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global H failed");
if (enum_thorough_proper.scientistsNameSpaceTestI(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global I failed");
if (enum_thorough_proper.scientistsNameSpaceTestJ(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global J failed");
if (enum_thorough_proper.scientistsNameSpaceTestK(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global K failed");
if (enum_thorough_proper.scientistsNameSpaceTestL(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global L failed");
}
{
newname val = newname.argh;
if (enum_thorough_proper.renameTest1(val) != val) throw new RuntimeException("renameTest Global 1 failed");
if (enum_thorough_proper.renameTest2(val) != val) throw new RuntimeException("renameTest Global 2 failed");
}
{
NewNameStruct n = new NewNameStruct();
if (n.renameTest1(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new RuntimeException("renameTest 1 failed");
if (n.renameTest2(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new RuntimeException("renameTest 2 failed");
if (n.renameTest3(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new RuntimeException("renameTest 3 failed");
if (n.renameTest4(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest 4 failed");
if (n.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest 5 failed");
if (n.renameTest6(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new RuntimeException("renameTest 6 failed");
}
{
if (enum_thorough_proper.renameTest3(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new RuntimeException("renameTest Global 3 failed");
if (enum_thorough_proper.renameTest4(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new RuntimeException("renameTest Global 4 failed");
if (enum_thorough_proper.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest Global 5 failed");
if (enum_thorough_proper.renameTest6(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest Global 6 failed");
if (enum_thorough_proper.renameTest7(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new RuntimeException("renameTest Global 7 failed");
}
{
TreesClass t = new TreesClass();
TreesClass.trees pine = TreesClass.trees.pine;
if (t.treesTest1(pine) != pine) throw new RuntimeException("treesTest 1 failed");
if (t.treesTest2(pine) != pine) throw new RuntimeException("treesTest 2 failed");
if (t.treesTest3(pine) != pine) throw new RuntimeException("treesTest 3 failed");
if (t.treesTest4(pine) != pine) throw new RuntimeException("treesTest 4 failed");
if (t.treesTest5(pine) != pine) throw new RuntimeException("treesTest 5 failed");
if (t.treesTest6(pine) != pine) throw new RuntimeException("treesTest 6 failed");
if (t.treesTest7(pine) != pine) throw new RuntimeException("treesTest 7 failed");
if (t.treesTest8(pine) != pine) throw new RuntimeException("treesTest 8 failed");
if (t.treesTest9(pine) != pine) throw new RuntimeException("treesTest 9 failed");
if (t.treesTestA(pine) != pine) throw new RuntimeException("treesTest A failed");
if (t.treesTestB(pine) != pine) throw new RuntimeException("treesTest B failed");
if (t.treesTestC(pine) != pine) throw new RuntimeException("treesTest C failed");
if (t.treesTestD(pine) != pine) throw new RuntimeException("treesTest D failed");
if (t.treesTestE(pine) != pine) throw new RuntimeException("treesTest E failed");
if (t.treesTestF(pine) != pine) throw new RuntimeException("treesTest F failed");
if (t.treesTestG(pine) != pine) throw new RuntimeException("treesTest G failed");
if (t.treesTestH(pine) != pine) throw new RuntimeException("treesTest H failed");
if (t.treesTestI(pine) != pine) throw new RuntimeException("treesTest I failed");
if (t.treesTestJ(pine) != pine) throw new RuntimeException("treesTest J failed");
if (t.treesTestK(pine) != pine) throw new RuntimeException("treesTest K failed");
if (t.treesTestL(pine) != pine) throw new RuntimeException("treesTest L failed");
if (t.treesTestM(pine) != pine) throw new RuntimeException("treesTest M failed");
if (t.treesTestN(pine) != pine) throw new RuntimeException("treesTest N failed");
if (t.treesTestO(pine) != pine) throw new RuntimeException("treesTest O failed");
if (enum_thorough_proper.treesTest1(pine) != pine) throw new RuntimeException("treesTest Global 1 failed");
if (enum_thorough_proper.treesTest2(pine) != pine) throw new RuntimeException("treesTest Global 2 failed");
if (enum_thorough_proper.treesTest3(pine) != pine) throw new RuntimeException("treesTest Global 3 failed");
if (enum_thorough_proper.treesTest4(pine) != pine) throw new RuntimeException("treesTest Global 4 failed");
if (enum_thorough_proper.treesTest5(pine) != pine) throw new RuntimeException("treesTest Global 5 failed");
if (enum_thorough_proper.treesTest6(pine) != pine) throw new RuntimeException("treesTest Global 6 failed");
if (enum_thorough_proper.treesTest7(pine) != pine) throw new RuntimeException("treesTest Global 7 failed");
if (enum_thorough_proper.treesTest8(pine) != pine) throw new RuntimeException("treesTest Global 8 failed");
if (enum_thorough_proper.treesTest9(pine) != pine) throw new RuntimeException("treesTest Global 9 failed");
if (enum_thorough_proper.treesTestA(pine) != pine) throw new RuntimeException("treesTest Global A failed");
if (enum_thorough_proper.treesTestB(pine) != pine) throw new RuntimeException("treesTest Global B failed");
if (enum_thorough_proper.treesTestC(pine) != pine) throw new RuntimeException("treesTest Global C failed");
if (enum_thorough_proper.treesTestD(pine) != pine) throw new RuntimeException("treesTest Global D failed");
if (enum_thorough_proper.treesTestE(pine) != pine) throw new RuntimeException("treesTest Global E failed");
if (enum_thorough_proper.treesTestF(pine) != pine) throw new RuntimeException("treesTest Global F failed");
if (enum_thorough_proper.treesTestG(pine) != pine) throw new RuntimeException("treesTest Global G failed");
if (enum_thorough_proper.treesTestH(pine) != pine) throw new RuntimeException("treesTest Global H failed");
if (enum_thorough_proper.treesTestI(pine) != pine) throw new RuntimeException("treesTest Global I failed");
if (enum_thorough_proper.treesTestJ(pine) != pine) throw new RuntimeException("treesTest Global J failed");
if (enum_thorough_proper.treesTestK(pine) != pine) throw new RuntimeException("treesTest Global K failed");
if (enum_thorough_proper.treesTestL(pine) != pine) throw new RuntimeException("treesTest Global L failed");
if (enum_thorough_proper.treesTestM(pine) != pine) throw new RuntimeException("treesTest Global M failed");
// if (enum_thorough_proper.treesTestN(pine) != pine) throw new RuntimeException("treesTest Global N failed");
if (enum_thorough_proper.treesTestO(pine) != pine) throw new RuntimeException("treesTest Global O failed");
if (enum_thorough_proper.treesTestP(pine) != pine) throw new RuntimeException("treesTest Global P failed");
if (enum_thorough_proper.treesTestQ(pine) != pine) throw new RuntimeException("treesTest Global Q failed");
if (enum_thorough_proper.treesTestR(pine) != pine) throw new RuntimeException("treesTest Global R failed");
}
{
HairStruct h = new HairStruct();
HairStruct.hair ginger = HairStruct.hair.ginger;
if (h.hairTest1(ginger) != ginger) throw new RuntimeException("hairTest 1 failed");
if (h.hairTest2(ginger) != ginger) throw new RuntimeException("hairTest 2 failed");
if (h.hairTest3(ginger) != ginger) throw new RuntimeException("hairTest 3 failed");
if (h.hairTest4(ginger) != ginger) throw new RuntimeException("hairTest 4 failed");
if (h.hairTest5(ginger) != ginger) throw new RuntimeException("hairTest 5 failed");
if (h.hairTest6(ginger) != ginger) throw new RuntimeException("hairTest 6 failed");
if (h.hairTest7(ginger) != ginger) throw new RuntimeException("hairTest 7 failed");
if (h.hairTest8(ginger) != ginger) throw new RuntimeException("hairTest 8 failed");
if (h.hairTest9(ginger) != ginger) throw new RuntimeException("hairTest 9 failed");
if (h.hairTestA(ginger) != ginger) throw new RuntimeException("hairTest A failed");
if (h.hairTestB(ginger) != ginger) throw new RuntimeException("hairTest B failed");
colour red = colour.red;
if (h.colourTest1(red) != red) throw new RuntimeException("colourTest HairStruct 1 failed");
if (h.colourTest2(red) != red) throw new RuntimeException("colourTest HairStruct 2 failed");
if (h.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new RuntimeException("namedanonTest HairStruct 1 failed");
if (h.namedanonspaceTest1(namedanonspace.NamedAnonSpace2) != namedanonspace.NamedAnonSpace2) throw new RuntimeException("namedanonspaceTest HairStruct 1 failed");
TreesClass.trees fir = TreesClass.trees.fir;
if (h.treesGlobalTest1(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 1 failed");
if (h.treesGlobalTest2(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 2 failed");
if (h.treesGlobalTest3(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 3 failed");
if (h.treesGlobalTest4(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 4 failed");
}
{
HairStruct.hair blonde = HairStruct.hair.blonde;
if (enum_thorough_proper.hairTest1(blonde) != blonde) throw new RuntimeException("hairTest Global 1 failed");
if (enum_thorough_proper.hairTest2(blonde) != blonde) throw new RuntimeException("hairTest Global 2 failed");
if (enum_thorough_proper.hairTest3(blonde) != blonde) throw new RuntimeException("hairTest Global 3 failed");
if (enum_thorough_proper.hairTest4(blonde) != blonde) throw new RuntimeException("hairTest Global 4 failed");
if (enum_thorough_proper.hairTest5(blonde) != blonde) throw new RuntimeException("hairTest Global 5 failed");
if (enum_thorough_proper.hairTest6(blonde) != blonde) throw new RuntimeException("hairTest Global 6 failed");
if (enum_thorough_proper.hairTest7(blonde) != blonde) throw new RuntimeException("hairTest Global 7 failed");
if (enum_thorough_proper.hairTest8(blonde) != blonde) throw new RuntimeException("hairTest Global 8 failed");
if (enum_thorough_proper.hairTest9(blonde) != blonde) throw new RuntimeException("hairTest Global 9 failed");
if (enum_thorough_proper.hairTestA(blonde) != blonde) throw new RuntimeException("hairTest Global A failed");
if (enum_thorough_proper.hairTestB(blonde) != blonde) throw new RuntimeException("hairTest Global B failed");
if (enum_thorough_proper.hairTestC(blonde) != blonde) throw new RuntimeException("hairTest Global C failed");
if (enum_thorough_proper.hairTestA1(blonde) != blonde) throw new RuntimeException("hairTest Global A1 failed");
if (enum_thorough_proper.hairTestA2(blonde) != blonde) throw new RuntimeException("hairTest Global A2 failed");
if (enum_thorough_proper.hairTestA3(blonde) != blonde) throw new RuntimeException("hairTest Global A3 failed");
if (enum_thorough_proper.hairTestA4(blonde) != blonde) throw new RuntimeException("hairTest Global A4 failed");
if (enum_thorough_proper.hairTestA5(blonde) != blonde) throw new RuntimeException("hairTest Global A5 failed");
if (enum_thorough_proper.hairTestA6(blonde) != blonde) throw new RuntimeException("hairTest Global A6 failed");
if (enum_thorough_proper.hairTestA7(blonde) != blonde) throw new RuntimeException("hairTest Global A7 failed");
if (enum_thorough_proper.hairTestA8(blonde) != blonde) throw new RuntimeException("hairTest Global A8 failed");
if (enum_thorough_proper.hairTestA9(blonde) != blonde) throw new RuntimeException("hairTest Global A9 failed");
if (enum_thorough_proper.hairTestAA(blonde) != blonde) throw new RuntimeException("hairTest Global AA failed");
if (enum_thorough_proper.hairTestAB(blonde) != blonde) throw new RuntimeException("hairTest Global AB failed");
if (enum_thorough_proper.hairTestAC(blonde) != blonde) throw new RuntimeException("hairTest Global AC failed");
if (enum_thorough_proper.hairTestB1(blonde) != blonde) throw new RuntimeException("hairTest Global B1 failed");
if (enum_thorough_proper.hairTestB2(blonde) != blonde) throw new RuntimeException("hairTest Global B2 failed");
if (enum_thorough_proper.hairTestB3(blonde) != blonde) throw new RuntimeException("hairTest Global B3 failed");
if (enum_thorough_proper.hairTestB4(blonde) != blonde) throw new RuntimeException("hairTest Global B4 failed");
if (enum_thorough_proper.hairTestB5(blonde) != blonde) throw new RuntimeException("hairTest Global B5 failed");
if (enum_thorough_proper.hairTestB6(blonde) != blonde) throw new RuntimeException("hairTest Global B6 failed");
if (enum_thorough_proper.hairTestB7(blonde) != blonde) throw new RuntimeException("hairTest Global B7 failed");
if (enum_thorough_proper.hairTestB8(blonde) != blonde) throw new RuntimeException("hairTest Global B8 failed");
if (enum_thorough_proper.hairTestB9(blonde) != blonde) throw new RuntimeException("hairTest Global B9 failed");
if (enum_thorough_proper.hairTestBA(blonde) != blonde) throw new RuntimeException("hairTest Global BA failed");
if (enum_thorough_proper.hairTestBB(blonde) != blonde) throw new RuntimeException("hairTest Global BB failed");
if (enum_thorough_proper.hairTestBC(blonde) != blonde) throw new RuntimeException("hairTest Global BC failed");
if (enum_thorough_proper.hairTestC1(blonde) != blonde) throw new RuntimeException("hairTest Global C1 failed");
if (enum_thorough_proper.hairTestC2(blonde) != blonde) throw new RuntimeException("hairTest Global C2 failed");
if (enum_thorough_proper.hairTestC3(blonde) != blonde) throw new RuntimeException("hairTest Global C3 failed");
if (enum_thorough_proper.hairTestC4(blonde) != blonde) throw new RuntimeException("hairTest Global C4 failed");
if (enum_thorough_proper.hairTestC5(blonde) != blonde) throw new RuntimeException("hairTest Global C5 failed");
if (enum_thorough_proper.hairTestC6(blonde) != blonde) throw new RuntimeException("hairTest Global C6 failed");
if (enum_thorough_proper.hairTestC7(blonde) != blonde) throw new RuntimeException("hairTest Global C7 failed");
if (enum_thorough_proper.hairTestC8(blonde) != blonde) throw new RuntimeException("hairTest Global C8 failed");
if (enum_thorough_proper.hairTestC9(blonde) != blonde) throw new RuntimeException("hairTest Global C9 failed");
if (enum_thorough_proper.hairTestCA(blonde) != blonde) throw new RuntimeException("hairTest Global CA failed");
if (enum_thorough_proper.hairTestCB(blonde) != blonde) throw new RuntimeException("hairTest Global CB failed");
if (enum_thorough_proper.hairTestCC(blonde) != blonde) throw new RuntimeException("hairTest Global CC failed");
}
{
FirStruct f = new FirStruct();
HairStruct.hair blonde = HairStruct.hair.blonde;
if (f.hairTestFir1(blonde) != blonde) throw new RuntimeException("hairTestFir 1 failed");
if (f.hairTestFir2(blonde) != blonde) throw new RuntimeException("hairTestFir 2 failed");
if (f.hairTestFir3(blonde) != blonde) throw new RuntimeException("hairTestFir 3 failed");
if (f.hairTestFir4(blonde) != blonde) throw new RuntimeException("hairTestFir 4 failed");
if (f.hairTestFir5(blonde) != blonde) throw new RuntimeException("hairTestFir 5 failed");
if (f.hairTestFir6(blonde) != blonde) throw new RuntimeException("hairTestFir 6 failed");
if (f.hairTestFir7(blonde) != blonde) throw new RuntimeException("hairTestFir 7 failed");
if (f.hairTestFir8(blonde) != blonde) throw new RuntimeException("hairTestFir 8 failed");
if (f.hairTestFir9(blonde) != blonde) throw new RuntimeException("hairTestFir 9 failed");
if (f.hairTestFirA(blonde) != blonde) throw new RuntimeException("hairTestFir A failed");
}
{
enum_thorough_proper.setGlobalInstance(enum_thorough_proper.globalinstance2);
if (enum_thorough_proper.getGlobalInstance() != enum_thorough_proper.globalinstance2) throw new RuntimeException("GlobalInstance 1 failed");
Instances i = new Instances();
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue() != 0) throw new RuntimeException("ignoreATest 0 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue() != 3) throw new RuntimeException("ignoreATest 3 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue() != 10) throw new RuntimeException("ignoreATest 10 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue() != 11) throw new RuntimeException("ignoreATest 11 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue() != 13) throw new RuntimeException("ignoreATest 13 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue() != 14) throw new RuntimeException("ignoreATest 14 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue() != 20) throw new RuntimeException("ignoreATest 20 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue() != 30) throw new RuntimeException("ignoreATest 30 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreATest 32 failed");
if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue() != 33) throw new RuntimeException("ignoreATest 33 failed");
}
{
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue() != 11) throw new RuntimeException("ignoreBTest 11 failed");
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue() != 12) throw new RuntimeException("ignoreBTest 12 failed");
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue() != 31) throw new RuntimeException("ignoreBTest 31 failed");
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreBTest 32 failed");
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue() != 41) throw new RuntimeException("ignoreBTest 41 failed");
if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue() != 42) throw new RuntimeException("ignoreBTest 42 failed");
}
{
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue() != 10) throw new RuntimeException("ignoreCTest 10 failed");
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue() != 12) throw new RuntimeException("ignoreCTest 12 failed");
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue() != 30) throw new RuntimeException("ignoreCTest 30 failed");
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreCTest 32 failed");
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue() != 40) throw new RuntimeException("ignoreCTest 40 failed");
if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue() != 42) throw new RuntimeException("ignoreCTest 42 failed");
}
{
if (enum_thorough_proper.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreDTest 21 failed");
if (enum_thorough_proper.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreDTest 22 failed");
}
{
if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue() != 0) throw new RuntimeException("ignoreETest 0 failed");
if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreETest 21 failed");
if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if (enum_thorough_proper.repeatTest(repeat.one).swigValue() != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough_proper.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough_proper.repeatTest(repeat.two).swigValue() != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough_proper.repeatTest(repeat.three).swigValue() != 3) throw new RuntimeException("repeatTest 4 failed");
if (enum_thorough_proper.repeatTest(repeat.llast).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_proper.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
}
// different types
{
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typeint).swigValue() != 10) throw new RuntimeException("differentTypes 1 failed");
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typeboolfalse).swigValue() != 0) throw new RuntimeException("differentTypes 2 failed");
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typebooltrue).swigValue() != 1) throw new RuntimeException("differentTypes 3 failed");
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typebooltwo).swigValue() != 2) throw new RuntimeException("differentTypes 4 failed");
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typechar).swigValue() != 'C') throw new RuntimeException("differentTypes 5 failed");
if (enum_thorough_proper.differentTypesTest(DifferentTypes.typedefaultint).swigValue() != 'D') throw new RuntimeException("differentTypes 6 failed");
int global_enum = enum_thorough_proper.global_typeint;
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
global_enum = enum_thorough_proper.global_typeboolfalse;
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
global_enum = enum_thorough_proper.global_typebooltrue;
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
global_enum = enum_thorough_proper.global_typebooltwo;
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
global_enum = enum_thorough_proper.global_typechar;
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
global_enum = enum_thorough_proper.global_typedefaultint;
if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
}
}
}

View File

@@ -0,0 +1,443 @@
import enum_thorough.*;
public class enum_thorough_runme {
static {
try {
System.loadLibrary("enum_thorough");
} 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[])
{
{
// Anonymous enums
int i = enum_thorough.AnonEnum1;
if (enum_thorough.ReallyAnInteger != 200) throw new RuntimeException("Test Anon 1 failed");
int j = enum_thorough.AnonSpaceEnum1;
int k = AnonStruct.AnonStructEnum1;
}
{
colour red = colour.red;
enum_thorough.colourTest1(red);
enum_thorough.colourTest2(red);
enum_thorough.colourTest3(red);
enum_thorough.colourTest4(red);
enum_thorough.setMyColour(red);
}
{
SpeedClass s = new SpeedClass();
SpeedClass.speed speed = SpeedClass.speed.slow;
if (s.speedTest1(speed) != speed) throw new RuntimeException("speedTest 1 failed");
if (s.speedTest2(speed) != speed) throw new RuntimeException("speedTest 2 failed");
if (s.speedTest3(speed) != speed) throw new RuntimeException("speedTest 3 failed");
if (s.speedTest4(speed) != speed) throw new RuntimeException("speedTest 4 failed");
if (s.speedTest5(speed) != speed) throw new RuntimeException("speedTest 5 failed");
if (s.speedTest6(speed) != speed) throw new RuntimeException("speedTest 6 failed");
if (s.speedTest7(speed) != speed) throw new RuntimeException("speedTest 7 failed");
if (s.speedTest8(speed) != speed) throw new RuntimeException("speedTest 8 failed");
if (enum_thorough.speedTest1(speed) != speed) throw new RuntimeException("speedTest Global 1 failed");
if (enum_thorough.speedTest2(speed) != speed) throw new RuntimeException("speedTest Global 2 failed");
if (enum_thorough.speedTest3(speed) != speed) throw new RuntimeException("speedTest Global 3 failed");
if (enum_thorough.speedTest4(speed) != speed) throw new RuntimeException("speedTest Global 4 failed");
if (enum_thorough.speedTest5(speed) != speed) throw new RuntimeException("speedTest Global 5 failed");
}
{
SpeedClass s = new SpeedClass();
SpeedClass.speed slow = SpeedClass.speed.slow;
SpeedClass.speed lightning = SpeedClass.speed.lightning;
if (s.getMySpeedtd1() != slow) throw new RuntimeException("mySpeedtd1 1 failed");
if (s.getMySpeedtd1().swigValue() != 10) throw new RuntimeException("mySpeedtd1 2 failed");
s.setMySpeedtd1(lightning);
if (s.getMySpeedtd1() != lightning) throw new RuntimeException("mySpeedtd1 3 failed");
if (s.getMySpeedtd1().swigValue() != 31) throw new RuntimeException("mySpeedtd1 4 failed");
}
{
if (enum_thorough.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new RuntimeException("namedanonTest 1 failed");
}
{
twonames val = twonames.TwoNames2;
if (enum_thorough.twonamesTest1(val) != val) throw new RuntimeException("twonamesTest 1 failed");
if (enum_thorough.twonamesTest2(val) != val) throw new RuntimeException("twonamesTest 2 failed");
if (enum_thorough.twonamesTest3(val) != val) throw new RuntimeException("twonamesTest 3 failed");
}
{
TwoNamesStruct t = new TwoNamesStruct();
TwoNamesStruct.twonames val = TwoNamesStruct.twonames.TwoNamesStruct1;
if (t.twonamesTest1(val) != val) throw new RuntimeException("twonamesTest 1 failed");
if (t.twonamesTest2(val) != val) throw new RuntimeException("twonamesTest 2 failed");
if (t.twonamesTest3(val) != val) throw new RuntimeException("twonamesTest 3 failed");
}
{
namedanonspace val = namedanonspace.NamedAnonSpace2;
if (enum_thorough.namedanonspaceTest1(val) != val) throw new RuntimeException("namedanonspaceTest 1 failed");
if (enum_thorough.namedanonspaceTest2(val) != val) throw new RuntimeException("namedanonspaceTest 2 failed");
if (enum_thorough.namedanonspaceTest3(val) != val) throw new RuntimeException("namedanonspaceTest 3 failed");
if (enum_thorough.namedanonspaceTest4(val) != val) throw new RuntimeException("namedanonspaceTest 4 failed");
}
{
TemplateClassInt t = new TemplateClassInt();
TemplateClassInt.scientists galileo = TemplateClassInt.scientists.galileo;
if (t.scientistsTest1(galileo) != galileo) throw new RuntimeException("scientistsTest 1 failed");
if (t.scientistsTest2(galileo) != galileo) throw new RuntimeException("scientistsTest 2 failed");
if (t.scientistsTest3(galileo) != galileo) throw new RuntimeException("scientistsTest 3 failed");
if (t.scientistsTest4(galileo) != galileo) throw new RuntimeException("scientistsTest 4 failed");
if (t.scientistsTest5(galileo) != galileo) throw new RuntimeException("scientistsTest 5 failed");
if (t.scientistsTest6(galileo) != galileo) throw new RuntimeException("scientistsTest 6 failed");
if (t.scientistsTest7(galileo) != galileo) throw new RuntimeException("scientistsTest 7 failed");
if (t.scientistsTest8(galileo) != galileo) throw new RuntimeException("scientistsTest 8 failed");
if (t.scientistsTest9(galileo) != galileo) throw new RuntimeException("scientistsTest 9 failed");
// if (t.scientistsTestA(galileo) != galileo) throw new RuntimeException("scientistsTest A failed");
if (t.scientistsTestB(galileo) != galileo) throw new RuntimeException("scientistsTest B failed");
// if (t.scientistsTestC(galileo) != galileo) throw new RuntimeException("scientistsTest C failed");
if (t.scientistsTestD(galileo) != galileo) throw new RuntimeException("scientistsTest D failed");
if (t.scientistsTestE(galileo) != galileo) throw new RuntimeException("scientistsTest E failed");
if (t.scientistsTestF(galileo) != galileo) throw new RuntimeException("scientistsTest F failed");
if (t.scientistsTestG(galileo) != galileo) throw new RuntimeException("scientistsTest G failed");
if (t.scientistsTestH(galileo) != galileo) throw new RuntimeException("scientistsTest H failed");
if (t.scientistsTestI(galileo) != galileo) throw new RuntimeException("scientistsTest I failed");
if (t.scientistsTestJ(galileo) != galileo) throw new RuntimeException("scientistsTest J failed");
if (enum_thorough.scientistsTest1(galileo) != galileo) throw new RuntimeException("scientistsTest Global 1 failed");
if (enum_thorough.scientistsTest2(galileo) != galileo) throw new RuntimeException("scientistsTest Global 2 failed");
if (enum_thorough.scientistsTest3(galileo) != galileo) throw new RuntimeException("scientistsTest Global 3 failed");
if (enum_thorough.scientistsTest4(galileo) != galileo) throw new RuntimeException("scientistsTest Global 4 failed");
if (enum_thorough.scientistsTest5(galileo) != galileo) throw new RuntimeException("scientistsTest Global 5 failed");
if (enum_thorough.scientistsTest6(galileo) != galileo) throw new RuntimeException("scientistsTest Global 6 failed");
if (enum_thorough.scientistsTest7(galileo) != galileo) throw new RuntimeException("scientistsTest Global 7 failed");
if (enum_thorough.scientistsTest8(galileo) != galileo) throw new RuntimeException("scientistsTest Global 8 failed");
}
{
TClassInt t = new TClassInt();
TClassInt.scientists bell = TClassInt.scientists.bell;
TemplateClassInt.scientists galileo = TemplateClassInt.scientists.galileo;
if (t.scientistsNameTest1(bell) != bell) throw new RuntimeException("scientistsNameTest 1 failed");
if (t.scientistsNameTest2(bell) != bell) throw new RuntimeException("scientistsNameTest 2 failed");
if (t.scientistsNameTest3(bell) != bell) throw new RuntimeException("scientistsNameTest 3 failed");
if (t.scientistsNameTest4(bell) != bell) throw new RuntimeException("scientistsNameTest 4 failed");
if (t.scientistsNameTest5(bell) != bell) throw new RuntimeException("scientistsNameTest 5 failed");
if (t.scientistsNameTest6(bell) != bell) throw new RuntimeException("scientistsNameTest 6 failed");
if (t.scientistsNameTest7(bell) != bell) throw new RuntimeException("scientistsNameTest 7 failed");
if (t.scientistsNameTest8(bell) != bell) throw new RuntimeException("scientistsNameTest 8 failed");
if (t.scientistsNameTest9(bell) != bell) throw new RuntimeException("scientistsNameTest 9 failed");
// if (t.scientistsNameTestA(bell) != bell) throw new RuntimeException("scientistsNameTest A failed");
if (t.scientistsNameTestB(bell) != bell) throw new RuntimeException("scientistsNameTest B failed");
// if (t.scientistsNameTestC(bell) != bell) throw new RuntimeException("scientistsNameTest C failed");
if (t.scientistsNameTestD(bell) != bell) throw new RuntimeException("scientistsNameTest D failed");
if (t.scientistsNameTestE(bell) != bell) throw new RuntimeException("scientistsNameTest E failed");
if (t.scientistsNameTestF(bell) != bell) throw new RuntimeException("scientistsNameTest F failed");
if (t.scientistsNameTestG(bell) != bell) throw new RuntimeException("scientistsNameTest G failed");
if (t.scientistsNameTestH(bell) != bell) throw new RuntimeException("scientistsNameTest H failed");
if (t.scientistsNameTestI(bell) != bell) throw new RuntimeException("scientistsNameTest I failed");
if (t.scientistsNameSpaceTest1(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 1 failed");
if (t.scientistsNameSpaceTest2(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 2 failed");
if (t.scientistsNameSpaceTest3(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 3 failed");
if (t.scientistsNameSpaceTest4(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 4 failed");
if (t.scientistsNameSpaceTest5(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 5 failed");
if (t.scientistsNameSpaceTest6(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 6 failed");
if (t.scientistsNameSpaceTest7(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 7 failed");
if (t.scientistsOtherTest1(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 1 failed");
if (t.scientistsOtherTest2(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 2 failed");
if (t.scientistsOtherTest3(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 3 failed");
if (t.scientistsOtherTest4(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 4 failed");
if (t.scientistsOtherTest5(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 5 failed");
if (t.scientistsOtherTest6(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 6 failed");
if (t.scientistsOtherTest7(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 7 failed");
if (enum_thorough.scientistsNameTest1(bell) != bell) throw new RuntimeException("scientistsNameTest Global 1 failed");
if (enum_thorough.scientistsNameTest2(bell) != bell) throw new RuntimeException("scientistsNameTest Global 2 failed");
if (enum_thorough.scientistsNameTest3(bell) != bell) throw new RuntimeException("scientistsNameTest Global 3 failed");
if (enum_thorough.scientistsNameTest4(bell) != bell) throw new RuntimeException("scientistsNameTest Global 4 failed");
if (enum_thorough.scientistsNameTest5(bell) != bell) throw new RuntimeException("scientistsNameTest Global 5 failed");
if (enum_thorough.scientistsNameTest6(bell) != bell) throw new RuntimeException("scientistsNameTest Global 6 failed");
if (enum_thorough.scientistsNameTest7(bell) != bell) throw new RuntimeException("scientistsNameTest Global 7 failed");
if (enum_thorough.scientistsNameSpaceTest1(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 1 failed");
if (enum_thorough.scientistsNameSpaceTest2(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 2 failed");
if (enum_thorough.scientistsNameSpaceTest3(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 3 failed");
if (enum_thorough.scientistsNameSpaceTest4(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 4 failed");
if (enum_thorough.scientistsNameSpaceTest5(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 5 failed");
if (enum_thorough.scientistsNameSpaceTest6(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 6 failed");
if (enum_thorough.scientistsNameSpaceTest7(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 7 failed");
if (enum_thorough.scientistsNameSpaceTest8(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 8 failed");
if (enum_thorough.scientistsNameSpaceTest9(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 9 failed");
if (enum_thorough.scientistsNameSpaceTestA(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global A failed");
if (enum_thorough.scientistsNameSpaceTestB(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global B failed");
if (enum_thorough.scientistsNameSpaceTestC(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global C failed");
if (enum_thorough.scientistsNameSpaceTestD(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global D failed");
if (enum_thorough.scientistsNameSpaceTestE(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global E failed");
if (enum_thorough.scientistsNameSpaceTestF(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global F failed");
if (enum_thorough.scientistsNameSpaceTestG(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global G failed");
if (enum_thorough.scientistsNameSpaceTestH(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global H failed");
if (enum_thorough.scientistsNameSpaceTestI(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global I failed");
if (enum_thorough.scientistsNameSpaceTestJ(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global J failed");
if (enum_thorough.scientistsNameSpaceTestK(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global K failed");
if (enum_thorough.scientistsNameSpaceTestL(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global L failed");
}
{
newname val = newname.argh;
if (enum_thorough.renameTest1(val) != val) throw new RuntimeException("renameTest Global 1 failed");
if (enum_thorough.renameTest2(val) != val) throw new RuntimeException("renameTest Global 2 failed");
}
{
NewNameStruct n = new NewNameStruct();
if (n.renameTest1(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new RuntimeException("renameTest 1 failed");
if (n.renameTest2(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new RuntimeException("renameTest 2 failed");
if (n.renameTest3(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new RuntimeException("renameTest 3 failed");
if (n.renameTest4(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest 4 failed");
if (n.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest 5 failed");
if (n.renameTest6(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new RuntimeException("renameTest 6 failed");
}
{
if (enum_thorough.renameTest3(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new RuntimeException("renameTest Global 3 failed");
if (enum_thorough.renameTest4(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new RuntimeException("renameTest Global 4 failed");
if (enum_thorough.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest Global 5 failed");
if (enum_thorough.renameTest6(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest Global 6 failed");
if (enum_thorough.renameTest7(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new RuntimeException("renameTest Global 7 failed");
}
{
TreesClass t = new TreesClass();
TreesClass.trees pine = TreesClass.trees.pine;
if (t.treesTest1(pine) != pine) throw new RuntimeException("treesTest 1 failed");
if (t.treesTest2(pine) != pine) throw new RuntimeException("treesTest 2 failed");
if (t.treesTest3(pine) != pine) throw new RuntimeException("treesTest 3 failed");
if (t.treesTest4(pine) != pine) throw new RuntimeException("treesTest 4 failed");
if (t.treesTest5(pine) != pine) throw new RuntimeException("treesTest 5 failed");
if (t.treesTest6(pine) != pine) throw new RuntimeException("treesTest 6 failed");
if (t.treesTest7(pine) != pine) throw new RuntimeException("treesTest 7 failed");
if (t.treesTest8(pine) != pine) throw new RuntimeException("treesTest 8 failed");
if (t.treesTest9(pine) != pine) throw new RuntimeException("treesTest 9 failed");
if (t.treesTestA(pine) != pine) throw new RuntimeException("treesTest A failed");
if (t.treesTestB(pine) != pine) throw new RuntimeException("treesTest B failed");
if (t.treesTestC(pine) != pine) throw new RuntimeException("treesTest C failed");
if (t.treesTestD(pine) != pine) throw new RuntimeException("treesTest D failed");
if (t.treesTestE(pine) != pine) throw new RuntimeException("treesTest E failed");
if (t.treesTestF(pine) != pine) throw new RuntimeException("treesTest F failed");
if (t.treesTestG(pine) != pine) throw new RuntimeException("treesTest G failed");
if (t.treesTestH(pine) != pine) throw new RuntimeException("treesTest H failed");
if (t.treesTestI(pine) != pine) throw new RuntimeException("treesTest I failed");
if (t.treesTestJ(pine) != pine) throw new RuntimeException("treesTest J failed");
if (t.treesTestK(pine) != pine) throw new RuntimeException("treesTest K failed");
if (t.treesTestL(pine) != pine) throw new RuntimeException("treesTest L failed");
if (t.treesTestM(pine) != pine) throw new RuntimeException("treesTest M failed");
if (t.treesTestN(pine) != pine) throw new RuntimeException("treesTest N failed");
if (t.treesTestO(pine) != pine) throw new RuntimeException("treesTest O failed");
if (enum_thorough.treesTest1(pine) != pine) throw new RuntimeException("treesTest Global 1 failed");
if (enum_thorough.treesTest2(pine) != pine) throw new RuntimeException("treesTest Global 2 failed");
if (enum_thorough.treesTest3(pine) != pine) throw new RuntimeException("treesTest Global 3 failed");
if (enum_thorough.treesTest4(pine) != pine) throw new RuntimeException("treesTest Global 4 failed");
if (enum_thorough.treesTest5(pine) != pine) throw new RuntimeException("treesTest Global 5 failed");
if (enum_thorough.treesTest6(pine) != pine) throw new RuntimeException("treesTest Global 6 failed");
if (enum_thorough.treesTest7(pine) != pine) throw new RuntimeException("treesTest Global 7 failed");
if (enum_thorough.treesTest8(pine) != pine) throw new RuntimeException("treesTest Global 8 failed");
if (enum_thorough.treesTest9(pine) != pine) throw new RuntimeException("treesTest Global 9 failed");
if (enum_thorough.treesTestA(pine) != pine) throw new RuntimeException("treesTest Global A failed");
if (enum_thorough.treesTestB(pine) != pine) throw new RuntimeException("treesTest Global B failed");
if (enum_thorough.treesTestC(pine) != pine) throw new RuntimeException("treesTest Global C failed");
if (enum_thorough.treesTestD(pine) != pine) throw new RuntimeException("treesTest Global D failed");
if (enum_thorough.treesTestE(pine) != pine) throw new RuntimeException("treesTest Global E failed");
if (enum_thorough.treesTestF(pine) != pine) throw new RuntimeException("treesTest Global F failed");
if (enum_thorough.treesTestG(pine) != pine) throw new RuntimeException("treesTest Global G failed");
if (enum_thorough.treesTestH(pine) != pine) throw new RuntimeException("treesTest Global H failed");
if (enum_thorough.treesTestI(pine) != pine) throw new RuntimeException("treesTest Global I failed");
if (enum_thorough.treesTestJ(pine) != pine) throw new RuntimeException("treesTest Global J failed");
if (enum_thorough.treesTestK(pine) != pine) throw new RuntimeException("treesTest Global K failed");
if (enum_thorough.treesTestL(pine) != pine) throw new RuntimeException("treesTest Global L failed");
if (enum_thorough.treesTestM(pine) != pine) throw new RuntimeException("treesTest Global M failed");
// if (enum_thorough.treesTestN(pine) != pine) throw new RuntimeException("treesTest Global N failed");
if (enum_thorough.treesTestO(pine) != pine) throw new RuntimeException("treesTest Global O failed");
if (enum_thorough.treesTestP(pine) != pine) throw new RuntimeException("treesTest Global P failed");
if (enum_thorough.treesTestQ(pine) != pine) throw new RuntimeException("treesTest Global Q failed");
if (enum_thorough.treesTestR(pine) != pine) throw new RuntimeException("treesTest Global R failed");
}
{
HairStruct h = new HairStruct();
HairStruct.hair ginger = HairStruct.hair.ginger;
if (h.hairTest1(ginger) != ginger) throw new RuntimeException("hairTest 1 failed");
if (h.hairTest2(ginger) != ginger) throw new RuntimeException("hairTest 2 failed");
if (h.hairTest3(ginger) != ginger) throw new RuntimeException("hairTest 3 failed");
if (h.hairTest4(ginger) != ginger) throw new RuntimeException("hairTest 4 failed");
if (h.hairTest5(ginger) != ginger) throw new RuntimeException("hairTest 5 failed");
if (h.hairTest6(ginger) != ginger) throw new RuntimeException("hairTest 6 failed");
if (h.hairTest7(ginger) != ginger) throw new RuntimeException("hairTest 7 failed");
if (h.hairTest8(ginger) != ginger) throw new RuntimeException("hairTest 8 failed");
if (h.hairTest9(ginger) != ginger) throw new RuntimeException("hairTest 9 failed");
if (h.hairTestA(ginger) != ginger) throw new RuntimeException("hairTest A failed");
if (h.hairTestB(ginger) != ginger) throw new RuntimeException("hairTest B failed");
colour red = colour.red;
if (h.colourTest1(red) != red) throw new RuntimeException("colourTest HairStruct 1 failed");
if (h.colourTest2(red) != red) throw new RuntimeException("colourTest HairStruct 2 failed");
if (h.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new RuntimeException("namedanonTest HairStruct 1 failed");
if (h.namedanonspaceTest1(namedanonspace.NamedAnonSpace2) != namedanonspace.NamedAnonSpace2) throw new RuntimeException("namedanonspaceTest HairStruct 1 failed");
TreesClass.trees fir = TreesClass.trees.fir;
if (h.treesGlobalTest1(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 1 failed");
if (h.treesGlobalTest2(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 2 failed");
if (h.treesGlobalTest3(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 3 failed");
if (h.treesGlobalTest4(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 4 failed");
}
{
HairStruct.hair blonde = HairStruct.hair.blonde;
if (enum_thorough.hairTest1(blonde) != blonde) throw new RuntimeException("hairTest Global 1 failed");
if (enum_thorough.hairTest2(blonde) != blonde) throw new RuntimeException("hairTest Global 2 failed");
if (enum_thorough.hairTest3(blonde) != blonde) throw new RuntimeException("hairTest Global 3 failed");
if (enum_thorough.hairTest4(blonde) != blonde) throw new RuntimeException("hairTest Global 4 failed");
if (enum_thorough.hairTest5(blonde) != blonde) throw new RuntimeException("hairTest Global 5 failed");
if (enum_thorough.hairTest6(blonde) != blonde) throw new RuntimeException("hairTest Global 6 failed");
if (enum_thorough.hairTest7(blonde) != blonde) throw new RuntimeException("hairTest Global 7 failed");
if (enum_thorough.hairTest8(blonde) != blonde) throw new RuntimeException("hairTest Global 8 failed");
if (enum_thorough.hairTest9(blonde) != blonde) throw new RuntimeException("hairTest Global 9 failed");
if (enum_thorough.hairTestA(blonde) != blonde) throw new RuntimeException("hairTest Global A failed");
if (enum_thorough.hairTestB(blonde) != blonde) throw new RuntimeException("hairTest Global B failed");
if (enum_thorough.hairTestC(blonde) != blonde) throw new RuntimeException("hairTest Global C failed");
if (enum_thorough.hairTestA1(blonde) != blonde) throw new RuntimeException("hairTest Global A1 failed");
if (enum_thorough.hairTestA2(blonde) != blonde) throw new RuntimeException("hairTest Global A2 failed");
if (enum_thorough.hairTestA3(blonde) != blonde) throw new RuntimeException("hairTest Global A3 failed");
if (enum_thorough.hairTestA4(blonde) != blonde) throw new RuntimeException("hairTest Global A4 failed");
if (enum_thorough.hairTestA5(blonde) != blonde) throw new RuntimeException("hairTest Global A5 failed");
if (enum_thorough.hairTestA6(blonde) != blonde) throw new RuntimeException("hairTest Global A6 failed");
if (enum_thorough.hairTestA7(blonde) != blonde) throw new RuntimeException("hairTest Global A7 failed");
if (enum_thorough.hairTestA8(blonde) != blonde) throw new RuntimeException("hairTest Global A8 failed");
if (enum_thorough.hairTestA9(blonde) != blonde) throw new RuntimeException("hairTest Global A9 failed");
if (enum_thorough.hairTestAA(blonde) != blonde) throw new RuntimeException("hairTest Global AA failed");
if (enum_thorough.hairTestAB(blonde) != blonde) throw new RuntimeException("hairTest Global AB failed");
if (enum_thorough.hairTestAC(blonde) != blonde) throw new RuntimeException("hairTest Global AC failed");
if (enum_thorough.hairTestB1(blonde) != blonde) throw new RuntimeException("hairTest Global B1 failed");
if (enum_thorough.hairTestB2(blonde) != blonde) throw new RuntimeException("hairTest Global B2 failed");
if (enum_thorough.hairTestB3(blonde) != blonde) throw new RuntimeException("hairTest Global B3 failed");
if (enum_thorough.hairTestB4(blonde) != blonde) throw new RuntimeException("hairTest Global B4 failed");
if (enum_thorough.hairTestB5(blonde) != blonde) throw new RuntimeException("hairTest Global B5 failed");
if (enum_thorough.hairTestB6(blonde) != blonde) throw new RuntimeException("hairTest Global B6 failed");
if (enum_thorough.hairTestB7(blonde) != blonde) throw new RuntimeException("hairTest Global B7 failed");
if (enum_thorough.hairTestB8(blonde) != blonde) throw new RuntimeException("hairTest Global B8 failed");
if (enum_thorough.hairTestB9(blonde) != blonde) throw new RuntimeException("hairTest Global B9 failed");
if (enum_thorough.hairTestBA(blonde) != blonde) throw new RuntimeException("hairTest Global BA failed");
if (enum_thorough.hairTestBB(blonde) != blonde) throw new RuntimeException("hairTest Global BB failed");
if (enum_thorough.hairTestBC(blonde) != blonde) throw new RuntimeException("hairTest Global BC failed");
if (enum_thorough.hairTestC1(blonde) != blonde) throw new RuntimeException("hairTest Global C1 failed");
if (enum_thorough.hairTestC2(blonde) != blonde) throw new RuntimeException("hairTest Global C2 failed");
if (enum_thorough.hairTestC3(blonde) != blonde) throw new RuntimeException("hairTest Global C3 failed");
if (enum_thorough.hairTestC4(blonde) != blonde) throw new RuntimeException("hairTest Global C4 failed");
if (enum_thorough.hairTestC5(blonde) != blonde) throw new RuntimeException("hairTest Global C5 failed");
if (enum_thorough.hairTestC6(blonde) != blonde) throw new RuntimeException("hairTest Global C6 failed");
if (enum_thorough.hairTestC7(blonde) != blonde) throw new RuntimeException("hairTest Global C7 failed");
if (enum_thorough.hairTestC8(blonde) != blonde) throw new RuntimeException("hairTest Global C8 failed");
if (enum_thorough.hairTestC9(blonde) != blonde) throw new RuntimeException("hairTest Global C9 failed");
if (enum_thorough.hairTestCA(blonde) != blonde) throw new RuntimeException("hairTest Global CA failed");
if (enum_thorough.hairTestCB(blonde) != blonde) throw new RuntimeException("hairTest Global CB failed");
if (enum_thorough.hairTestCC(blonde) != blonde) throw new RuntimeException("hairTest Global CC failed");
}
{
FirStruct f = new FirStruct();
HairStruct.hair blonde = HairStruct.hair.blonde;
if (f.hairTestFir1(blonde) != blonde) throw new RuntimeException("hairTestFir 1 failed");
if (f.hairTestFir2(blonde) != blonde) throw new RuntimeException("hairTestFir 2 failed");
if (f.hairTestFir3(blonde) != blonde) throw new RuntimeException("hairTestFir 3 failed");
if (f.hairTestFir4(blonde) != blonde) throw new RuntimeException("hairTestFir 4 failed");
if (f.hairTestFir5(blonde) != blonde) throw new RuntimeException("hairTestFir 5 failed");
if (f.hairTestFir6(blonde) != blonde) throw new RuntimeException("hairTestFir 6 failed");
if (f.hairTestFir7(blonde) != blonde) throw new RuntimeException("hairTestFir 7 failed");
if (f.hairTestFir8(blonde) != blonde) throw new RuntimeException("hairTestFir 8 failed");
if (f.hairTestFir9(blonde) != blonde) throw new RuntimeException("hairTestFir 9 failed");
if (f.hairTestFirA(blonde) != blonde) throw new RuntimeException("hairTestFir A failed");
}
{
enum_thorough.setGlobalInstance(enum_thorough.globalinstance2);
if (enum_thorough.getGlobalInstance() != enum_thorough.globalinstance2) throw new RuntimeException("GlobalInstance 1 failed");
Instances i = new Instances();
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue() != 0) throw new RuntimeException("ignoreATest 0 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue() != 3) throw new RuntimeException("ignoreATest 3 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue() != 10) throw new RuntimeException("ignoreATest 10 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue() != 11) throw new RuntimeException("ignoreATest 11 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue() != 13) throw new RuntimeException("ignoreATest 13 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue() != 14) throw new RuntimeException("ignoreATest 14 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue() != 20) throw new RuntimeException("ignoreATest 20 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue() != 30) throw new RuntimeException("ignoreATest 30 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreATest 32 failed");
if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue() != 33) throw new RuntimeException("ignoreATest 33 failed");
}
{
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue() != 11) throw new RuntimeException("ignoreBTest 11 failed");
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue() != 12) throw new RuntimeException("ignoreBTest 12 failed");
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue() != 31) throw new RuntimeException("ignoreBTest 31 failed");
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreBTest 32 failed");
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue() != 41) throw new RuntimeException("ignoreBTest 41 failed");
if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue() != 42) throw new RuntimeException("ignoreBTest 42 failed");
}
{
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue() != 10) throw new RuntimeException("ignoreCTest 10 failed");
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue() != 12) throw new RuntimeException("ignoreCTest 12 failed");
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue() != 30) throw new RuntimeException("ignoreCTest 30 failed");
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreCTest 32 failed");
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue() != 40) throw new RuntimeException("ignoreCTest 40 failed");
if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue() != 42) throw new RuntimeException("ignoreCTest 42 failed");
}
{
if (enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreDTest 21 failed");
if (enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreDTest 22 failed");
}
{
if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue() != 0) throw new RuntimeException("ignoreETest 0 failed");
if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreETest 21 failed");
if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if (enum_thorough.repeatTest(repeat.one).swigValue() != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough.repeatTest(repeat.two).swigValue() != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough.repeatTest(repeat.three).swigValue() != 3) throw new RuntimeException("repeatTest 4 failed");
if (enum_thorough.repeatTest(repeat.llast).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
}
// different types
{
if (enum_thorough.differentTypesTest(DifferentTypes.typeint).swigValue() != 10) throw new RuntimeException("differentTypes 1 failed");
if (enum_thorough.differentTypesTest(DifferentTypes.typeboolfalse).swigValue() != 0) throw new RuntimeException("differentTypes 2 failed");
if (enum_thorough.differentTypesTest(DifferentTypes.typebooltrue).swigValue() != 1) throw new RuntimeException("differentTypes 3 failed");
if (enum_thorough.differentTypesTest(DifferentTypes.typebooltwo).swigValue() != 2) throw new RuntimeException("differentTypes 4 failed");
if (enum_thorough.differentTypesTest(DifferentTypes.typechar).swigValue() != 'C') throw new RuntimeException("differentTypes 5 failed");
if (enum_thorough.differentTypesTest(DifferentTypes.typedefaultint).swigValue() != 'D') throw new RuntimeException("differentTypes 6 failed");
int global_enum = enum_thorough.global_typeint;
if (enum_thorough.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
global_enum = enum_thorough.global_typeboolfalse;
if (enum_thorough.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
global_enum = enum_thorough.global_typebooltrue;
if (enum_thorough.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
global_enum = enum_thorough.global_typebooltwo;
if (enum_thorough.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
global_enum = enum_thorough.global_typechar;
if (enum_thorough.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
global_enum = enum_thorough.global_typedefaultint;
if (enum_thorough.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
}
}
}

View File

@@ -0,0 +1,443 @@
import enum_thorough_simple.*;
public class enum_thorough_simple_runme {
static {
try {
System.loadLibrary("enum_thorough_simple");
} 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[])
{
{
// Anonymous enums
int i = enum_thorough_simple.AnonEnum1;
if (enum_thorough_simple.ReallyAnInteger != 200) throw new RuntimeException("Test Anon 1 failed");
int j = enum_thorough_simple.AnonSpaceEnum1;
int k = AnonStruct.AnonStructEnum1;
}
{
int red = enum_thorough_simple.red;
enum_thorough_simple.colourTest1(red);
enum_thorough_simple.colourTest2(red);
enum_thorough_simple.colourTest3(red);
enum_thorough_simple.colourTest4(red);
enum_thorough_simple.setMyColour(red);
}
{
SpeedClass s = new SpeedClass();
int speed = SpeedClass.slow;
if (s.speedTest1(speed) != speed) throw new RuntimeException("speedTest 1 failed");
if (s.speedTest2(speed) != speed) throw new RuntimeException("speedTest 2 failed");
if (s.speedTest3(speed) != speed) throw new RuntimeException("speedTest 3 failed");
if (s.speedTest4(speed) != speed) throw new RuntimeException("speedTest 4 failed");
if (s.speedTest5(speed) != speed) throw new RuntimeException("speedTest 5 failed");
if (s.speedTest6(speed) != speed) throw new RuntimeException("speedTest 6 failed");
if (s.speedTest7(speed) != speed) throw new RuntimeException("speedTest 7 failed");
if (s.speedTest8(speed) != speed) throw new RuntimeException("speedTest 8 failed");
if (enum_thorough_simple.speedTest1(speed) != speed) throw new RuntimeException("speedTest Global 1 failed");
if (enum_thorough_simple.speedTest2(speed) != speed) throw new RuntimeException("speedTest Global 2 failed");
if (enum_thorough_simple.speedTest3(speed) != speed) throw new RuntimeException("speedTest Global 3 failed");
if (enum_thorough_simple.speedTest4(speed) != speed) throw new RuntimeException("speedTest Global 4 failed");
if (enum_thorough_simple.speedTest5(speed) != speed) throw new RuntimeException("speedTest Global 5 failed");
}
{
SpeedClass s = new SpeedClass();
int slow = SpeedClass.slow;
int lightning = SpeedClass.lightning;
if (s.getMySpeedtd1() != slow) throw new RuntimeException("mySpeedtd1 1 failed");
if (s.getMySpeedtd1() != 10) throw new RuntimeException("mySpeedtd1 2 failed");
s.setMySpeedtd1(lightning);
if (s.getMySpeedtd1() != lightning) throw new RuntimeException("mySpeedtd1 3 failed");
if (s.getMySpeedtd1() != 31) throw new RuntimeException("mySpeedtd1 4 failed");
}
{
if (enum_thorough_simple.namedanonTest1(enum_thorough_simple.NamedAnon2) != enum_thorough_simple.NamedAnon2) throw new RuntimeException("namedanonTest 1 failed");
}
{
int val = enum_thorough_simple.TwoNames2;
if (enum_thorough_simple.twonamesTest1(val) != val) throw new RuntimeException("twonamesTest 1 failed");
if (enum_thorough_simple.twonamesTest2(val) != val) throw new RuntimeException("twonamesTest 2 failed");
if (enum_thorough_simple.twonamesTest3(val) != val) throw new RuntimeException("twonamesTest 3 failed");
}
{
TwoNamesStruct t = new TwoNamesStruct();
int val = TwoNamesStruct.TwoNamesStruct1;
if (t.twonamesTest1(val) != val) throw new RuntimeException("twonamesTest 1 failed");
if (t.twonamesTest2(val) != val) throw new RuntimeException("twonamesTest 2 failed");
if (t.twonamesTest3(val) != val) throw new RuntimeException("twonamesTest 3 failed");
}
{
int val = enum_thorough_simple.NamedAnonSpace2;
if (enum_thorough_simple.namedanonspaceTest1(val) != val) throw new RuntimeException("namedanonspaceTest 1 failed");
if (enum_thorough_simple.namedanonspaceTest2(val) != val) throw new RuntimeException("namedanonspaceTest 2 failed");
if (enum_thorough_simple.namedanonspaceTest3(val) != val) throw new RuntimeException("namedanonspaceTest 3 failed");
if (enum_thorough_simple.namedanonspaceTest4(val) != val) throw new RuntimeException("namedanonspaceTest 4 failed");
}
{
TemplateClassInt t = new TemplateClassInt();
int galileo = TemplateClassInt.galileo;
if (t.scientistsTest1(galileo) != galileo) throw new RuntimeException("scientistsTest 1 failed");
if (t.scientistsTest2(galileo) != galileo) throw new RuntimeException("scientistsTest 2 failed");
if (t.scientistsTest3(galileo) != galileo) throw new RuntimeException("scientistsTest 3 failed");
if (t.scientistsTest4(galileo) != galileo) throw new RuntimeException("scientistsTest 4 failed");
if (t.scientistsTest5(galileo) != galileo) throw new RuntimeException("scientistsTest 5 failed");
if (t.scientistsTest6(galileo) != galileo) throw new RuntimeException("scientistsTest 6 failed");
if (t.scientistsTest7(galileo) != galileo) throw new RuntimeException("scientistsTest 7 failed");
if (t.scientistsTest8(galileo) != galileo) throw new RuntimeException("scientistsTest 8 failed");
if (t.scientistsTest9(galileo) != galileo) throw new RuntimeException("scientistsTest 9 failed");
// if (t.scientistsTestA(galileo) != galileo) throw new RuntimeException("scientistsTest A failed");
if (t.scientistsTestB(galileo) != galileo) throw new RuntimeException("scientistsTest B failed");
// if (t.scientistsTestC(galileo) != galileo) throw new RuntimeException("scientistsTest C failed");
if (t.scientistsTestD(galileo) != galileo) throw new RuntimeException("scientistsTest D failed");
if (t.scientistsTestE(galileo) != galileo) throw new RuntimeException("scientistsTest E failed");
if (t.scientistsTestF(galileo) != galileo) throw new RuntimeException("scientistsTest F failed");
if (t.scientistsTestG(galileo) != galileo) throw new RuntimeException("scientistsTest G failed");
if (t.scientistsTestH(galileo) != galileo) throw new RuntimeException("scientistsTest H failed");
if (t.scientistsTestI(galileo) != galileo) throw new RuntimeException("scientistsTest I failed");
if (t.scientistsTestJ(galileo) != galileo) throw new RuntimeException("scientistsTest J failed");
if (enum_thorough_simple.scientistsTest1(galileo) != galileo) throw new RuntimeException("scientistsTest Global 1 failed");
if (enum_thorough_simple.scientistsTest2(galileo) != galileo) throw new RuntimeException("scientistsTest Global 2 failed");
if (enum_thorough_simple.scientistsTest3(galileo) != galileo) throw new RuntimeException("scientistsTest Global 3 failed");
if (enum_thorough_simple.scientistsTest4(galileo) != galileo) throw new RuntimeException("scientistsTest Global 4 failed");
if (enum_thorough_simple.scientistsTest5(galileo) != galileo) throw new RuntimeException("scientistsTest Global 5 failed");
if (enum_thorough_simple.scientistsTest6(galileo) != galileo) throw new RuntimeException("scientistsTest Global 6 failed");
if (enum_thorough_simple.scientistsTest7(galileo) != galileo) throw new RuntimeException("scientistsTest Global 7 failed");
if (enum_thorough_simple.scientistsTest8(galileo) != galileo) throw new RuntimeException("scientistsTest Global 8 failed");
}
{
TClassInt t = new TClassInt();
int bell = TClassInt.bell;
int galileo = TemplateClassInt.galileo;
if (t.scientistsNameTest1(bell) != bell) throw new RuntimeException("scientistsNameTest 1 failed");
if (t.scientistsNameTest2(bell) != bell) throw new RuntimeException("scientistsNameTest 2 failed");
if (t.scientistsNameTest3(bell) != bell) throw new RuntimeException("scientistsNameTest 3 failed");
if (t.scientistsNameTest4(bell) != bell) throw new RuntimeException("scientistsNameTest 4 failed");
if (t.scientistsNameTest5(bell) != bell) throw new RuntimeException("scientistsNameTest 5 failed");
if (t.scientistsNameTest6(bell) != bell) throw new RuntimeException("scientistsNameTest 6 failed");
if (t.scientistsNameTest7(bell) != bell) throw new RuntimeException("scientistsNameTest 7 failed");
if (t.scientistsNameTest8(bell) != bell) throw new RuntimeException("scientistsNameTest 8 failed");
if (t.scientistsNameTest9(bell) != bell) throw new RuntimeException("scientistsNameTest 9 failed");
// if (t.scientistsNameTestA(bell) != bell) throw new RuntimeException("scientistsNameTest A failed");
if (t.scientistsNameTestB(bell) != bell) throw new RuntimeException("scientistsNameTest B failed");
// if (t.scientistsNameTestC(bell) != bell) throw new RuntimeException("scientistsNameTest C failed");
if (t.scientistsNameTestD(bell) != bell) throw new RuntimeException("scientistsNameTest D failed");
if (t.scientistsNameTestE(bell) != bell) throw new RuntimeException("scientistsNameTest E failed");
if (t.scientistsNameTestF(bell) != bell) throw new RuntimeException("scientistsNameTest F failed");
if (t.scientistsNameTestG(bell) != bell) throw new RuntimeException("scientistsNameTest G failed");
if (t.scientistsNameTestH(bell) != bell) throw new RuntimeException("scientistsNameTest H failed");
if (t.scientistsNameTestI(bell) != bell) throw new RuntimeException("scientistsNameTest I failed");
if (t.scientistsNameSpaceTest1(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 1 failed");
if (t.scientistsNameSpaceTest2(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 2 failed");
if (t.scientistsNameSpaceTest3(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 3 failed");
if (t.scientistsNameSpaceTest4(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 4 failed");
if (t.scientistsNameSpaceTest5(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 5 failed");
if (t.scientistsNameSpaceTest6(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 6 failed");
if (t.scientistsNameSpaceTest7(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 7 failed");
if (t.scientistsOtherTest1(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 1 failed");
if (t.scientistsOtherTest2(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 2 failed");
if (t.scientistsOtherTest3(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 3 failed");
if (t.scientistsOtherTest4(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 4 failed");
if (t.scientistsOtherTest5(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 5 failed");
if (t.scientistsOtherTest6(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 6 failed");
if (t.scientistsOtherTest7(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 7 failed");
if (enum_thorough_simple.scientistsNameTest1(bell) != bell) throw new RuntimeException("scientistsNameTest Global 1 failed");
if (enum_thorough_simple.scientistsNameTest2(bell) != bell) throw new RuntimeException("scientistsNameTest Global 2 failed");
if (enum_thorough_simple.scientistsNameTest3(bell) != bell) throw new RuntimeException("scientistsNameTest Global 3 failed");
if (enum_thorough_simple.scientistsNameTest4(bell) != bell) throw new RuntimeException("scientistsNameTest Global 4 failed");
if (enum_thorough_simple.scientistsNameTest5(bell) != bell) throw new RuntimeException("scientistsNameTest Global 5 failed");
if (enum_thorough_simple.scientistsNameTest6(bell) != bell) throw new RuntimeException("scientistsNameTest Global 6 failed");
if (enum_thorough_simple.scientistsNameTest7(bell) != bell) throw new RuntimeException("scientistsNameTest Global 7 failed");
if (enum_thorough_simple.scientistsNameSpaceTest1(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 1 failed");
if (enum_thorough_simple.scientistsNameSpaceTest2(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 2 failed");
if (enum_thorough_simple.scientistsNameSpaceTest3(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 3 failed");
if (enum_thorough_simple.scientistsNameSpaceTest4(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 4 failed");
if (enum_thorough_simple.scientistsNameSpaceTest5(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 5 failed");
if (enum_thorough_simple.scientistsNameSpaceTest6(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 6 failed");
if (enum_thorough_simple.scientistsNameSpaceTest7(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 7 failed");
if (enum_thorough_simple.scientistsNameSpaceTest8(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 8 failed");
if (enum_thorough_simple.scientistsNameSpaceTest9(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 9 failed");
if (enum_thorough_simple.scientistsNameSpaceTestA(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global A failed");
if (enum_thorough_simple.scientistsNameSpaceTestB(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global B failed");
if (enum_thorough_simple.scientistsNameSpaceTestC(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global C failed");
if (enum_thorough_simple.scientistsNameSpaceTestD(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global D failed");
if (enum_thorough_simple.scientistsNameSpaceTestE(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global E failed");
if (enum_thorough_simple.scientistsNameSpaceTestF(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global F failed");
if (enum_thorough_simple.scientistsNameSpaceTestG(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global G failed");
if (enum_thorough_simple.scientistsNameSpaceTestH(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global H failed");
if (enum_thorough_simple.scientistsNameSpaceTestI(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global I failed");
if (enum_thorough_simple.scientistsNameSpaceTestJ(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global J failed");
if (enum_thorough_simple.scientistsNameSpaceTestK(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global K failed");
if (enum_thorough_simple.scientistsNameSpaceTestL(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global L failed");
}
{
int val = enum_thorough_simple.argh;
if (enum_thorough_simple.renameTest1(val) != val) throw new RuntimeException("renameTest Global 1 failed");
if (enum_thorough_simple.renameTest2(val) != val) throw new RuntimeException("renameTest Global 2 failed");
}
{
NewNameStruct n = new NewNameStruct();
if (n.renameTest1(NewNameStruct.bang) != NewNameStruct.bang) throw new RuntimeException("renameTest 1 failed");
if (n.renameTest2(NewNameStruct.bang) != NewNameStruct.bang) throw new RuntimeException("renameTest 2 failed");
if (n.renameTest3(NewNameStruct.simple1) != NewNameStruct.simple1) throw new RuntimeException("renameTest 3 failed");
if (n.renameTest4(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new RuntimeException("renameTest 4 failed");
if (n.renameTest5(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new RuntimeException("renameTest 5 failed");
if (n.renameTest6(NewNameStruct.singlename1) != NewNameStruct.singlename1) throw new RuntimeException("renameTest 6 failed");
}
{
if (enum_thorough_simple.renameTest3(NewNameStruct.bang) != NewNameStruct.bang) throw new RuntimeException("renameTest Global 3 failed");
if (enum_thorough_simple.renameTest4(NewNameStruct.simple1) != NewNameStruct.simple1) throw new RuntimeException("renameTest Global 4 failed");
if (enum_thorough_simple.renameTest5(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new RuntimeException("renameTest Global 5 failed");
if (enum_thorough_simple.renameTest6(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new RuntimeException("renameTest Global 6 failed");
if (enum_thorough_simple.renameTest7(NewNameStruct.singlename1) != NewNameStruct.singlename1) throw new RuntimeException("renameTest Global 7 failed");
}
{
TreesClass t = new TreesClass();
int pine = TreesClass.pine;
if (t.treesTest1(pine) != pine) throw new RuntimeException("treesTest 1 failed");
if (t.treesTest2(pine) != pine) throw new RuntimeException("treesTest 2 failed");
if (t.treesTest3(pine) != pine) throw new RuntimeException("treesTest 3 failed");
if (t.treesTest4(pine) != pine) throw new RuntimeException("treesTest 4 failed");
if (t.treesTest5(pine) != pine) throw new RuntimeException("treesTest 5 failed");
if (t.treesTest6(pine) != pine) throw new RuntimeException("treesTest 6 failed");
if (t.treesTest7(pine) != pine) throw new RuntimeException("treesTest 7 failed");
if (t.treesTest8(pine) != pine) throw new RuntimeException("treesTest 8 failed");
if (t.treesTest9(pine) != pine) throw new RuntimeException("treesTest 9 failed");
if (t.treesTestA(pine) != pine) throw new RuntimeException("treesTest A failed");
if (t.treesTestB(pine) != pine) throw new RuntimeException("treesTest B failed");
if (t.treesTestC(pine) != pine) throw new RuntimeException("treesTest C failed");
if (t.treesTestD(pine) != pine) throw new RuntimeException("treesTest D failed");
if (t.treesTestE(pine) != pine) throw new RuntimeException("treesTest E failed");
if (t.treesTestF(pine) != pine) throw new RuntimeException("treesTest F failed");
if (t.treesTestG(pine) != pine) throw new RuntimeException("treesTest G failed");
if (t.treesTestH(pine) != pine) throw new RuntimeException("treesTest H failed");
if (t.treesTestI(pine) != pine) throw new RuntimeException("treesTest I failed");
if (t.treesTestJ(pine) != pine) throw new RuntimeException("treesTest J failed");
if (t.treesTestK(pine) != pine) throw new RuntimeException("treesTest K failed");
if (t.treesTestL(pine) != pine) throw new RuntimeException("treesTest L failed");
if (t.treesTestM(pine) != pine) throw new RuntimeException("treesTest M failed");
if (t.treesTestN(pine) != pine) throw new RuntimeException("treesTest N failed");
if (t.treesTestO(pine) != pine) throw new RuntimeException("treesTest O failed");
if (enum_thorough_simple.treesTest1(pine) != pine) throw new RuntimeException("treesTest Global 1 failed");
if (enum_thorough_simple.treesTest2(pine) != pine) throw new RuntimeException("treesTest Global 2 failed");
if (enum_thorough_simple.treesTest3(pine) != pine) throw new RuntimeException("treesTest Global 3 failed");
if (enum_thorough_simple.treesTest4(pine) != pine) throw new RuntimeException("treesTest Global 4 failed");
if (enum_thorough_simple.treesTest5(pine) != pine) throw new RuntimeException("treesTest Global 5 failed");
if (enum_thorough_simple.treesTest6(pine) != pine) throw new RuntimeException("treesTest Global 6 failed");
if (enum_thorough_simple.treesTest7(pine) != pine) throw new RuntimeException("treesTest Global 7 failed");
if (enum_thorough_simple.treesTest8(pine) != pine) throw new RuntimeException("treesTest Global 8 failed");
if (enum_thorough_simple.treesTest9(pine) != pine) throw new RuntimeException("treesTest Global 9 failed");
if (enum_thorough_simple.treesTestA(pine) != pine) throw new RuntimeException("treesTest Global A failed");
if (enum_thorough_simple.treesTestB(pine) != pine) throw new RuntimeException("treesTest Global B failed");
if (enum_thorough_simple.treesTestC(pine) != pine) throw new RuntimeException("treesTest Global C failed");
if (enum_thorough_simple.treesTestD(pine) != pine) throw new RuntimeException("treesTest Global D failed");
if (enum_thorough_simple.treesTestE(pine) != pine) throw new RuntimeException("treesTest Global E failed");
if (enum_thorough_simple.treesTestF(pine) != pine) throw new RuntimeException("treesTest Global F failed");
if (enum_thorough_simple.treesTestG(pine) != pine) throw new RuntimeException("treesTest Global G failed");
if (enum_thorough_simple.treesTestH(pine) != pine) throw new RuntimeException("treesTest Global H failed");
if (enum_thorough_simple.treesTestI(pine) != pine) throw new RuntimeException("treesTest Global I failed");
if (enum_thorough_simple.treesTestJ(pine) != pine) throw new RuntimeException("treesTest Global J failed");
if (enum_thorough_simple.treesTestK(pine) != pine) throw new RuntimeException("treesTest Global K failed");
if (enum_thorough_simple.treesTestL(pine) != pine) throw new RuntimeException("treesTest Global L failed");
if (enum_thorough_simple.treesTestM(pine) != pine) throw new RuntimeException("treesTest Global M failed");
// if (enum_thorough_simple.treesTestN(pine) != pine) throw new RuntimeException("treesTest Global N failed");
if (enum_thorough_simple.treesTestO(pine) != pine) throw new RuntimeException("treesTest Global O failed");
if (enum_thorough_simple.treesTestP(pine) != pine) throw new RuntimeException("treesTest Global P failed");
if (enum_thorough_simple.treesTestQ(pine) != pine) throw new RuntimeException("treesTest Global Q failed");
if (enum_thorough_simple.treesTestR(pine) != pine) throw new RuntimeException("treesTest Global R failed");
}
{
HairStruct h = new HairStruct();
int ginger = HairStruct.ginger;
if (h.hairTest1(ginger) != ginger) throw new RuntimeException("hairTest 1 failed");
if (h.hairTest2(ginger) != ginger) throw new RuntimeException("hairTest 2 failed");
if (h.hairTest3(ginger) != ginger) throw new RuntimeException("hairTest 3 failed");
if (h.hairTest4(ginger) != ginger) throw new RuntimeException("hairTest 4 failed");
if (h.hairTest5(ginger) != ginger) throw new RuntimeException("hairTest 5 failed");
if (h.hairTest6(ginger) != ginger) throw new RuntimeException("hairTest 6 failed");
if (h.hairTest7(ginger) != ginger) throw new RuntimeException("hairTest 7 failed");
if (h.hairTest8(ginger) != ginger) throw new RuntimeException("hairTest 8 failed");
if (h.hairTest9(ginger) != ginger) throw new RuntimeException("hairTest 9 failed");
if (h.hairTestA(ginger) != ginger) throw new RuntimeException("hairTest A failed");
if (h.hairTestB(ginger) != ginger) throw new RuntimeException("hairTest B failed");
int red = enum_thorough_simple.red;
if (h.colourTest1(red) != red) throw new RuntimeException("colourTest HairStruct 1 failed");
if (h.colourTest2(red) != red) throw new RuntimeException("colourTest HairStruct 2 failed");
if (h.namedanonTest1(enum_thorough_simple.NamedAnon2) != enum_thorough_simple.NamedAnon2) throw new RuntimeException("namedanonTest HairStruct 1 failed");
if (h.namedanonspaceTest1(enum_thorough_simple.NamedAnonSpace2) != enum_thorough_simple.NamedAnonSpace2) throw new RuntimeException("namedanonspaceTest HairStruct 1 failed");
int fir = TreesClass.fir;
if (h.treesGlobalTest1(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 1 failed");
if (h.treesGlobalTest2(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 2 failed");
if (h.treesGlobalTest3(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 3 failed");
if (h.treesGlobalTest4(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 4 failed");
}
{
int blonde = HairStruct.blonde;
if (enum_thorough_simple.hairTest1(blonde) != blonde) throw new RuntimeException("hairTest Global 1 failed");
if (enum_thorough_simple.hairTest2(blonde) != blonde) throw new RuntimeException("hairTest Global 2 failed");
if (enum_thorough_simple.hairTest3(blonde) != blonde) throw new RuntimeException("hairTest Global 3 failed");
if (enum_thorough_simple.hairTest4(blonde) != blonde) throw new RuntimeException("hairTest Global 4 failed");
if (enum_thorough_simple.hairTest5(blonde) != blonde) throw new RuntimeException("hairTest Global 5 failed");
if (enum_thorough_simple.hairTest6(blonde) != blonde) throw new RuntimeException("hairTest Global 6 failed");
if (enum_thorough_simple.hairTest7(blonde) != blonde) throw new RuntimeException("hairTest Global 7 failed");
if (enum_thorough_simple.hairTest8(blonde) != blonde) throw new RuntimeException("hairTest Global 8 failed");
if (enum_thorough_simple.hairTest9(blonde) != blonde) throw new RuntimeException("hairTest Global 9 failed");
if (enum_thorough_simple.hairTestA(blonde) != blonde) throw new RuntimeException("hairTest Global A failed");
if (enum_thorough_simple.hairTestB(blonde) != blonde) throw new RuntimeException("hairTest Global B failed");
if (enum_thorough_simple.hairTestC(blonde) != blonde) throw new RuntimeException("hairTest Global C failed");
if (enum_thorough_simple.hairTestA1(blonde) != blonde) throw new RuntimeException("hairTest Global A1 failed");
if (enum_thorough_simple.hairTestA2(blonde) != blonde) throw new RuntimeException("hairTest Global A2 failed");
if (enum_thorough_simple.hairTestA3(blonde) != blonde) throw new RuntimeException("hairTest Global A3 failed");
if (enum_thorough_simple.hairTestA4(blonde) != blonde) throw new RuntimeException("hairTest Global A4 failed");
if (enum_thorough_simple.hairTestA5(blonde) != blonde) throw new RuntimeException("hairTest Global A5 failed");
if (enum_thorough_simple.hairTestA6(blonde) != blonde) throw new RuntimeException("hairTest Global A6 failed");
if (enum_thorough_simple.hairTestA7(blonde) != blonde) throw new RuntimeException("hairTest Global A7 failed");
if (enum_thorough_simple.hairTestA8(blonde) != blonde) throw new RuntimeException("hairTest Global A8 failed");
if (enum_thorough_simple.hairTestA9(blonde) != blonde) throw new RuntimeException("hairTest Global A9 failed");
if (enum_thorough_simple.hairTestAA(blonde) != blonde) throw new RuntimeException("hairTest Global AA failed");
if (enum_thorough_simple.hairTestAB(blonde) != blonde) throw new RuntimeException("hairTest Global AB failed");
if (enum_thorough_simple.hairTestAC(blonde) != blonde) throw new RuntimeException("hairTest Global AC failed");
if (enum_thorough_simple.hairTestB1(blonde) != blonde) throw new RuntimeException("hairTest Global B1 failed");
if (enum_thorough_simple.hairTestB2(blonde) != blonde) throw new RuntimeException("hairTest Global B2 failed");
if (enum_thorough_simple.hairTestB3(blonde) != blonde) throw new RuntimeException("hairTest Global B3 failed");
if (enum_thorough_simple.hairTestB4(blonde) != blonde) throw new RuntimeException("hairTest Global B4 failed");
if (enum_thorough_simple.hairTestB5(blonde) != blonde) throw new RuntimeException("hairTest Global B5 failed");
if (enum_thorough_simple.hairTestB6(blonde) != blonde) throw new RuntimeException("hairTest Global B6 failed");
if (enum_thorough_simple.hairTestB7(blonde) != blonde) throw new RuntimeException("hairTest Global B7 failed");
if (enum_thorough_simple.hairTestB8(blonde) != blonde) throw new RuntimeException("hairTest Global B8 failed");
if (enum_thorough_simple.hairTestB9(blonde) != blonde) throw new RuntimeException("hairTest Global B9 failed");
if (enum_thorough_simple.hairTestBA(blonde) != blonde) throw new RuntimeException("hairTest Global BA failed");
if (enum_thorough_simple.hairTestBB(blonde) != blonde) throw new RuntimeException("hairTest Global BB failed");
if (enum_thorough_simple.hairTestBC(blonde) != blonde) throw new RuntimeException("hairTest Global BC failed");
if (enum_thorough_simple.hairTestC1(blonde) != blonde) throw new RuntimeException("hairTest Global C1 failed");
if (enum_thorough_simple.hairTestC2(blonde) != blonde) throw new RuntimeException("hairTest Global C2 failed");
if (enum_thorough_simple.hairTestC3(blonde) != blonde) throw new RuntimeException("hairTest Global C3 failed");
if (enum_thorough_simple.hairTestC4(blonde) != blonde) throw new RuntimeException("hairTest Global C4 failed");
if (enum_thorough_simple.hairTestC5(blonde) != blonde) throw new RuntimeException("hairTest Global C5 failed");
if (enum_thorough_simple.hairTestC6(blonde) != blonde) throw new RuntimeException("hairTest Global C6 failed");
if (enum_thorough_simple.hairTestC7(blonde) != blonde) throw new RuntimeException("hairTest Global C7 failed");
if (enum_thorough_simple.hairTestC8(blonde) != blonde) throw new RuntimeException("hairTest Global C8 failed");
if (enum_thorough_simple.hairTestC9(blonde) != blonde) throw new RuntimeException("hairTest Global C9 failed");
if (enum_thorough_simple.hairTestCA(blonde) != blonde) throw new RuntimeException("hairTest Global CA failed");
if (enum_thorough_simple.hairTestCB(blonde) != blonde) throw new RuntimeException("hairTest Global CB failed");
if (enum_thorough_simple.hairTestCC(blonde) != blonde) throw new RuntimeException("hairTest Global CC failed");
}
{
FirStruct f = new FirStruct();
int blonde = HairStruct.blonde;
if (f.hairTestFir1(blonde) != blonde) throw new RuntimeException("hairTestFir 1 failed");
if (f.hairTestFir2(blonde) != blonde) throw new RuntimeException("hairTestFir 2 failed");
if (f.hairTestFir3(blonde) != blonde) throw new RuntimeException("hairTestFir 3 failed");
if (f.hairTestFir4(blonde) != blonde) throw new RuntimeException("hairTestFir 4 failed");
if (f.hairTestFir5(blonde) != blonde) throw new RuntimeException("hairTestFir 5 failed");
if (f.hairTestFir6(blonde) != blonde) throw new RuntimeException("hairTestFir 6 failed");
if (f.hairTestFir7(blonde) != blonde) throw new RuntimeException("hairTestFir 7 failed");
if (f.hairTestFir8(blonde) != blonde) throw new RuntimeException("hairTestFir 8 failed");
if (f.hairTestFir9(blonde) != blonde) throw new RuntimeException("hairTestFir 9 failed");
if (f.hairTestFirA(blonde) != blonde) throw new RuntimeException("hairTestFir A failed");
}
{
enum_thorough_simple.setGlobalInstance(enum_thorough_simple.globalinstance2);
if (enum_thorough_simple.getGlobalInstance() != enum_thorough_simple.globalinstance2) throw new RuntimeException("GlobalInstance 1 failed");
Instances i = new Instances();
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_zero) != 0) throw new RuntimeException("ignoreATest 0 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_three) != 3) throw new RuntimeException("ignoreATest 3 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_ten) != 10) throw new RuntimeException("ignoreATest 10 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_eleven) != 11) throw new RuntimeException("ignoreATest 11 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirteen) != 13) throw new RuntimeException("ignoreATest 13 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_fourteen) != 14) throw new RuntimeException("ignoreATest 14 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_twenty) != 20) throw new RuntimeException("ignoreATest 20 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty) != 30) throw new RuntimeException("ignoreATest 30 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_two) != 32) throw new RuntimeException("ignoreATest 32 failed");
if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_three) != 33) throw new RuntimeException("ignoreATest 33 failed");
}
{
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_eleven) != 11) throw new RuntimeException("ignoreBTest 11 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_twelve) != 12) throw new RuntimeException("ignoreBTest 12 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_one) != 31) throw new RuntimeException("ignoreBTest 31 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_two) != 32) throw new RuntimeException("ignoreBTest 32 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_one) != 41) throw new RuntimeException("ignoreBTest 41 failed");
if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_two) != 42) throw new RuntimeException("ignoreBTest 42 failed");
}
{
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_ten) != 10) throw new RuntimeException("ignoreCTest 10 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_twelve) != 12) throw new RuntimeException("ignoreCTest 12 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty) != 30) throw new RuntimeException("ignoreCTest 30 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty_two) != 32) throw new RuntimeException("ignoreCTest 32 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty) != 40) throw new RuntimeException("ignoreCTest 40 failed");
if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty_two) != 42) throw new RuntimeException("ignoreCTest 42 failed");
}
{
if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_one) != 21) throw new RuntimeException("ignoreDTest 21 failed");
if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_two) != 22) throw new RuntimeException("ignoreDTest 22 failed");
}
{
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_zero) != 0) throw new RuntimeException("ignoreETest 0 failed");
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_one) != 21) throw new RuntimeException("ignoreETest 21 failed");
if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_two) != 22) throw new RuntimeException("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.one) != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.two) != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.three) != 3) throw new RuntimeException("repeatTest 4 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.llast) != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.end) != 3) throw new RuntimeException("repeatTest 6 failed");
}
// different types
{
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typeint) != 10) throw new RuntimeException("differentTypes 1 failed");
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typeboolfalse) != 0) throw new RuntimeException("differentTypes 2 failed");
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typebooltrue) != 1) throw new RuntimeException("differentTypes 3 failed");
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typebooltwo) != 2) throw new RuntimeException("differentTypes 4 failed");
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typechar) != 'C') throw new RuntimeException("differentTypes 5 failed");
if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typedefaultint) != 'D') throw new RuntimeException("differentTypes 6 failed");
int global_enum = enum_thorough_simple.global_typeint;
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
global_enum = enum_thorough_simple.global_typeboolfalse;
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
global_enum = enum_thorough_simple.global_typebooltrue;
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
global_enum = enum_thorough_simple.global_typebooltwo;
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
global_enum = enum_thorough_simple.global_typechar;
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
global_enum = enum_thorough_simple.global_typedefaultint;
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
}
}
}

View File

@@ -0,0 +1,443 @@
import enum_thorough_typeunsafe.*;
public class enum_thorough_typeunsafe_runme {
static {
try {
System.loadLibrary("enum_thorough_typeunsafe");
} 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[])
{
{
// Anonymous enums
int i = enum_thorough_typeunsafe.AnonEnum1;
if (enum_thorough_typeunsafe.ReallyAnInteger != 200) throw new RuntimeException("Test Anon 1 failed");
int j = enum_thorough_typeunsafe.AnonSpaceEnum1;
int k = AnonStruct.AnonStructEnum1;
}
{
int red = colour.red;
enum_thorough_typeunsafe.colourTest1(red);
enum_thorough_typeunsafe.colourTest2(red);
enum_thorough_typeunsafe.colourTest3(red);
enum_thorough_typeunsafe.colourTest4(red);
enum_thorough_typeunsafe.setMyColour(red);
}
{
SpeedClass s = new SpeedClass();
int speed = SpeedClass.speed.slow;
if (s.speedTest1(speed) != speed) throw new RuntimeException("speedTest 1 failed");
if (s.speedTest2(speed) != speed) throw new RuntimeException("speedTest 2 failed");
if (s.speedTest3(speed) != speed) throw new RuntimeException("speedTest 3 failed");
if (s.speedTest4(speed) != speed) throw new RuntimeException("speedTest 4 failed");
if (s.speedTest5(speed) != speed) throw new RuntimeException("speedTest 5 failed");
if (s.speedTest6(speed) != speed) throw new RuntimeException("speedTest 6 failed");
if (s.speedTest7(speed) != speed) throw new RuntimeException("speedTest 7 failed");
if (s.speedTest8(speed) != speed) throw new RuntimeException("speedTest 8 failed");
if (enum_thorough_typeunsafe.speedTest1(speed) != speed) throw new RuntimeException("speedTest Global 1 failed");
if (enum_thorough_typeunsafe.speedTest2(speed) != speed) throw new RuntimeException("speedTest Global 2 failed");
if (enum_thorough_typeunsafe.speedTest3(speed) != speed) throw new RuntimeException("speedTest Global 3 failed");
if (enum_thorough_typeunsafe.speedTest4(speed) != speed) throw new RuntimeException("speedTest Global 4 failed");
if (enum_thorough_typeunsafe.speedTest5(speed) != speed) throw new RuntimeException("speedTest Global 5 failed");
}
{
SpeedClass s = new SpeedClass();
int slow = SpeedClass.speed.slow;
int lightning = SpeedClass.speed.lightning;
if (s.getMySpeedtd1() != slow) throw new RuntimeException("mySpeedtd1 1 failed");
if (s.getMySpeedtd1() != 10) throw new RuntimeException("mySpeedtd1 2 failed");
s.setMySpeedtd1(lightning);
if (s.getMySpeedtd1() != lightning) throw new RuntimeException("mySpeedtd1 3 failed");
if (s.getMySpeedtd1() != 31) throw new RuntimeException("mySpeedtd1 4 failed");
}
{
if (enum_thorough_typeunsafe.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new RuntimeException("namedanonTest 1 failed");
}
{
int val = twonames.TwoNames2;
if (enum_thorough_typeunsafe.twonamesTest1(val) != val) throw new RuntimeException("twonamesTest 1 failed");
if (enum_thorough_typeunsafe.twonamesTest2(val) != val) throw new RuntimeException("twonamesTest 2 failed");
if (enum_thorough_typeunsafe.twonamesTest3(val) != val) throw new RuntimeException("twonamesTest 3 failed");
}
{
TwoNamesStruct t = new TwoNamesStruct();
int val = TwoNamesStruct.twonames.TwoNamesStruct1;
if (t.twonamesTest1(val) != val) throw new RuntimeException("twonamesTest 1 failed");
if (t.twonamesTest2(val) != val) throw new RuntimeException("twonamesTest 2 failed");
if (t.twonamesTest3(val) != val) throw new RuntimeException("twonamesTest 3 failed");
}
{
int val = namedanonspace.NamedAnonSpace2;
if (enum_thorough_typeunsafe.namedanonspaceTest1(val) != val) throw new RuntimeException("namedanonspaceTest 1 failed");
if (enum_thorough_typeunsafe.namedanonspaceTest2(val) != val) throw new RuntimeException("namedanonspaceTest 2 failed");
if (enum_thorough_typeunsafe.namedanonspaceTest3(val) != val) throw new RuntimeException("namedanonspaceTest 3 failed");
if (enum_thorough_typeunsafe.namedanonspaceTest4(val) != val) throw new RuntimeException("namedanonspaceTest 4 failed");
}
{
TemplateClassInt t = new TemplateClassInt();
int galileo = TemplateClassInt.scientists.galileo;
if (t.scientistsTest1(galileo) != galileo) throw new RuntimeException("scientistsTest 1 failed");
if (t.scientistsTest2(galileo) != galileo) throw new RuntimeException("scientistsTest 2 failed");
if (t.scientistsTest3(galileo) != galileo) throw new RuntimeException("scientistsTest 3 failed");
if (t.scientistsTest4(galileo) != galileo) throw new RuntimeException("scientistsTest 4 failed");
if (t.scientistsTest5(galileo) != galileo) throw new RuntimeException("scientistsTest 5 failed");
if (t.scientistsTest6(galileo) != galileo) throw new RuntimeException("scientistsTest 6 failed");
if (t.scientistsTest7(galileo) != galileo) throw new RuntimeException("scientistsTest 7 failed");
if (t.scientistsTest8(galileo) != galileo) throw new RuntimeException("scientistsTest 8 failed");
if (t.scientistsTest9(galileo) != galileo) throw new RuntimeException("scientistsTest 9 failed");
// if (t.scientistsTestA(galileo) != galileo) throw new RuntimeException("scientistsTest A failed");
if (t.scientistsTestB(galileo) != galileo) throw new RuntimeException("scientistsTest B failed");
// if (t.scientistsTestC(galileo) != galileo) throw new RuntimeException("scientistsTest C failed");
if (t.scientistsTestD(galileo) != galileo) throw new RuntimeException("scientistsTest D failed");
if (t.scientistsTestE(galileo) != galileo) throw new RuntimeException("scientistsTest E failed");
if (t.scientistsTestF(galileo) != galileo) throw new RuntimeException("scientistsTest F failed");
if (t.scientistsTestG(galileo) != galileo) throw new RuntimeException("scientistsTest G failed");
if (t.scientistsTestH(galileo) != galileo) throw new RuntimeException("scientistsTest H failed");
if (t.scientistsTestI(galileo) != galileo) throw new RuntimeException("scientistsTest I failed");
if (t.scientistsTestJ(galileo) != galileo) throw new RuntimeException("scientistsTest J failed");
if (enum_thorough_typeunsafe.scientistsTest1(galileo) != galileo) throw new RuntimeException("scientistsTest Global 1 failed");
if (enum_thorough_typeunsafe.scientistsTest2(galileo) != galileo) throw new RuntimeException("scientistsTest Global 2 failed");
if (enum_thorough_typeunsafe.scientistsTest3(galileo) != galileo) throw new RuntimeException("scientistsTest Global 3 failed");
if (enum_thorough_typeunsafe.scientistsTest4(galileo) != galileo) throw new RuntimeException("scientistsTest Global 4 failed");
if (enum_thorough_typeunsafe.scientistsTest5(galileo) != galileo) throw new RuntimeException("scientistsTest Global 5 failed");
if (enum_thorough_typeunsafe.scientistsTest6(galileo) != galileo) throw new RuntimeException("scientistsTest Global 6 failed");
if (enum_thorough_typeunsafe.scientistsTest7(galileo) != galileo) throw new RuntimeException("scientistsTest Global 7 failed");
if (enum_thorough_typeunsafe.scientistsTest8(galileo) != galileo) throw new RuntimeException("scientistsTest Global 8 failed");
}
{
TClassInt t = new TClassInt();
int bell = TClassInt.scientists.bell;
int galileo = TemplateClassInt.scientists.galileo;
if (t.scientistsNameTest1(bell) != bell) throw new RuntimeException("scientistsNameTest 1 failed");
if (t.scientistsNameTest2(bell) != bell) throw new RuntimeException("scientistsNameTest 2 failed");
if (t.scientistsNameTest3(bell) != bell) throw new RuntimeException("scientistsNameTest 3 failed");
if (t.scientistsNameTest4(bell) != bell) throw new RuntimeException("scientistsNameTest 4 failed");
if (t.scientistsNameTest5(bell) != bell) throw new RuntimeException("scientistsNameTest 5 failed");
if (t.scientistsNameTest6(bell) != bell) throw new RuntimeException("scientistsNameTest 6 failed");
if (t.scientistsNameTest7(bell) != bell) throw new RuntimeException("scientistsNameTest 7 failed");
if (t.scientistsNameTest8(bell) != bell) throw new RuntimeException("scientistsNameTest 8 failed");
if (t.scientistsNameTest9(bell) != bell) throw new RuntimeException("scientistsNameTest 9 failed");
// if (t.scientistsNameTestA(bell) != bell) throw new RuntimeException("scientistsNameTest A failed");
if (t.scientistsNameTestB(bell) != bell) throw new RuntimeException("scientistsNameTest B failed");
// if (t.scientistsNameTestC(bell) != bell) throw new RuntimeException("scientistsNameTest C failed");
if (t.scientistsNameTestD(bell) != bell) throw new RuntimeException("scientistsNameTest D failed");
if (t.scientistsNameTestE(bell) != bell) throw new RuntimeException("scientistsNameTest E failed");
if (t.scientistsNameTestF(bell) != bell) throw new RuntimeException("scientistsNameTest F failed");
if (t.scientistsNameTestG(bell) != bell) throw new RuntimeException("scientistsNameTest G failed");
if (t.scientistsNameTestH(bell) != bell) throw new RuntimeException("scientistsNameTest H failed");
if (t.scientistsNameTestI(bell) != bell) throw new RuntimeException("scientistsNameTest I failed");
if (t.scientistsNameSpaceTest1(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 1 failed");
if (t.scientistsNameSpaceTest2(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 2 failed");
if (t.scientistsNameSpaceTest3(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 3 failed");
if (t.scientistsNameSpaceTest4(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 4 failed");
if (t.scientistsNameSpaceTest5(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 5 failed");
if (t.scientistsNameSpaceTest6(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 6 failed");
if (t.scientistsNameSpaceTest7(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest 7 failed");
if (t.scientistsOtherTest1(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 1 failed");
if (t.scientistsOtherTest2(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 2 failed");
if (t.scientistsOtherTest3(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 3 failed");
if (t.scientistsOtherTest4(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 4 failed");
if (t.scientistsOtherTest5(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 5 failed");
if (t.scientistsOtherTest6(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 6 failed");
if (t.scientistsOtherTest7(galileo) != galileo) throw new RuntimeException("scientistsOtherTest 7 failed");
if (enum_thorough_typeunsafe.scientistsNameTest1(bell) != bell) throw new RuntimeException("scientistsNameTest Global 1 failed");
if (enum_thorough_typeunsafe.scientistsNameTest2(bell) != bell) throw new RuntimeException("scientistsNameTest Global 2 failed");
if (enum_thorough_typeunsafe.scientistsNameTest3(bell) != bell) throw new RuntimeException("scientistsNameTest Global 3 failed");
if (enum_thorough_typeunsafe.scientistsNameTest4(bell) != bell) throw new RuntimeException("scientistsNameTest Global 4 failed");
if (enum_thorough_typeunsafe.scientistsNameTest5(bell) != bell) throw new RuntimeException("scientistsNameTest Global 5 failed");
if (enum_thorough_typeunsafe.scientistsNameTest6(bell) != bell) throw new RuntimeException("scientistsNameTest Global 6 failed");
if (enum_thorough_typeunsafe.scientistsNameTest7(bell) != bell) throw new RuntimeException("scientistsNameTest Global 7 failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTest1(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 1 failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTest2(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 2 failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTest3(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 3 failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTest4(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 4 failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTest5(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 5 failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTest6(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 6 failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTest7(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 7 failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTest8(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 8 failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTest9(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global 9 failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestA(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global A failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestB(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global B failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestC(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global C failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestD(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global D failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestE(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global E failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestF(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global F failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestG(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global G failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestH(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global H failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestI(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global I failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestJ(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global J failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestK(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global K failed");
if (enum_thorough_typeunsafe.scientistsNameSpaceTestL(bell) != bell) throw new RuntimeException("scientistsNameSpaceTest Global L failed");
}
{
int val = newname.argh;
if (enum_thorough_typeunsafe.renameTest1(val) != val) throw new RuntimeException("renameTest Global 1 failed");
if (enum_thorough_typeunsafe.renameTest2(val) != val) throw new RuntimeException("renameTest Global 2 failed");
}
{
NewNameStruct n = new NewNameStruct();
if (n.renameTest1(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new RuntimeException("renameTest 1 failed");
if (n.renameTest2(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new RuntimeException("renameTest 2 failed");
if (n.renameTest3(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new RuntimeException("renameTest 3 failed");
if (n.renameTest4(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest 4 failed");
if (n.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest 5 failed");
if (n.renameTest6(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new RuntimeException("renameTest 6 failed");
}
{
if (enum_thorough_typeunsafe.renameTest3(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new RuntimeException("renameTest Global 3 failed");
if (enum_thorough_typeunsafe.renameTest4(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new RuntimeException("renameTest Global 4 failed");
if (enum_thorough_typeunsafe.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest Global 5 failed");
if (enum_thorough_typeunsafe.renameTest6(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new RuntimeException("renameTest Global 6 failed");
if (enum_thorough_typeunsafe.renameTest7(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new RuntimeException("renameTest Global 7 failed");
}
{
TreesClass t = new TreesClass();
int pine = TreesClass.trees.pine;
if (t.treesTest1(pine) != pine) throw new RuntimeException("treesTest 1 failed");
if (t.treesTest2(pine) != pine) throw new RuntimeException("treesTest 2 failed");
if (t.treesTest3(pine) != pine) throw new RuntimeException("treesTest 3 failed");
if (t.treesTest4(pine) != pine) throw new RuntimeException("treesTest 4 failed");
if (t.treesTest5(pine) != pine) throw new RuntimeException("treesTest 5 failed");
if (t.treesTest6(pine) != pine) throw new RuntimeException("treesTest 6 failed");
if (t.treesTest7(pine) != pine) throw new RuntimeException("treesTest 7 failed");
if (t.treesTest8(pine) != pine) throw new RuntimeException("treesTest 8 failed");
if (t.treesTest9(pine) != pine) throw new RuntimeException("treesTest 9 failed");
if (t.treesTestA(pine) != pine) throw new RuntimeException("treesTest A failed");
if (t.treesTestB(pine) != pine) throw new RuntimeException("treesTest B failed");
if (t.treesTestC(pine) != pine) throw new RuntimeException("treesTest C failed");
if (t.treesTestD(pine) != pine) throw new RuntimeException("treesTest D failed");
if (t.treesTestE(pine) != pine) throw new RuntimeException("treesTest E failed");
if (t.treesTestF(pine) != pine) throw new RuntimeException("treesTest F failed");
if (t.treesTestG(pine) != pine) throw new RuntimeException("treesTest G failed");
if (t.treesTestH(pine) != pine) throw new RuntimeException("treesTest H failed");
if (t.treesTestI(pine) != pine) throw new RuntimeException("treesTest I failed");
if (t.treesTestJ(pine) != pine) throw new RuntimeException("treesTest J failed");
if (t.treesTestK(pine) != pine) throw new RuntimeException("treesTest K failed");
if (t.treesTestL(pine) != pine) throw new RuntimeException("treesTest L failed");
if (t.treesTestM(pine) != pine) throw new RuntimeException("treesTest M failed");
if (t.treesTestN(pine) != pine) throw new RuntimeException("treesTest N failed");
if (t.treesTestO(pine) != pine) throw new RuntimeException("treesTest O failed");
if (enum_thorough_typeunsafe.treesTest1(pine) != pine) throw new RuntimeException("treesTest Global 1 failed");
if (enum_thorough_typeunsafe.treesTest2(pine) != pine) throw new RuntimeException("treesTest Global 2 failed");
if (enum_thorough_typeunsafe.treesTest3(pine) != pine) throw new RuntimeException("treesTest Global 3 failed");
if (enum_thorough_typeunsafe.treesTest4(pine) != pine) throw new RuntimeException("treesTest Global 4 failed");
if (enum_thorough_typeunsafe.treesTest5(pine) != pine) throw new RuntimeException("treesTest Global 5 failed");
if (enum_thorough_typeunsafe.treesTest6(pine) != pine) throw new RuntimeException("treesTest Global 6 failed");
if (enum_thorough_typeunsafe.treesTest7(pine) != pine) throw new RuntimeException("treesTest Global 7 failed");
if (enum_thorough_typeunsafe.treesTest8(pine) != pine) throw new RuntimeException("treesTest Global 8 failed");
if (enum_thorough_typeunsafe.treesTest9(pine) != pine) throw new RuntimeException("treesTest Global 9 failed");
if (enum_thorough_typeunsafe.treesTestA(pine) != pine) throw new RuntimeException("treesTest Global A failed");
if (enum_thorough_typeunsafe.treesTestB(pine) != pine) throw new RuntimeException("treesTest Global B failed");
if (enum_thorough_typeunsafe.treesTestC(pine) != pine) throw new RuntimeException("treesTest Global C failed");
if (enum_thorough_typeunsafe.treesTestD(pine) != pine) throw new RuntimeException("treesTest Global D failed");
if (enum_thorough_typeunsafe.treesTestE(pine) != pine) throw new RuntimeException("treesTest Global E failed");
if (enum_thorough_typeunsafe.treesTestF(pine) != pine) throw new RuntimeException("treesTest Global F failed");
if (enum_thorough_typeunsafe.treesTestG(pine) != pine) throw new RuntimeException("treesTest Global G failed");
if (enum_thorough_typeunsafe.treesTestH(pine) != pine) throw new RuntimeException("treesTest Global H failed");
if (enum_thorough_typeunsafe.treesTestI(pine) != pine) throw new RuntimeException("treesTest Global I failed");
if (enum_thorough_typeunsafe.treesTestJ(pine) != pine) throw new RuntimeException("treesTest Global J failed");
if (enum_thorough_typeunsafe.treesTestK(pine) != pine) throw new RuntimeException("treesTest Global K failed");
if (enum_thorough_typeunsafe.treesTestL(pine) != pine) throw new RuntimeException("treesTest Global L failed");
if (enum_thorough_typeunsafe.treesTestM(pine) != pine) throw new RuntimeException("treesTest Global M failed");
// if (enum_thorough_typeunsafe.treesTestN(pine) != pine) throw new RuntimeException("treesTest Global N failed");
if (enum_thorough_typeunsafe.treesTestO(pine) != pine) throw new RuntimeException("treesTest Global O failed");
if (enum_thorough_typeunsafe.treesTestP(pine) != pine) throw new RuntimeException("treesTest Global P failed");
if (enum_thorough_typeunsafe.treesTestQ(pine) != pine) throw new RuntimeException("treesTest Global Q failed");
if (enum_thorough_typeunsafe.treesTestR(pine) != pine) throw new RuntimeException("treesTest Global R failed");
}
{
HairStruct h = new HairStruct();
int ginger = HairStruct.hair.ginger;
if (h.hairTest1(ginger) != ginger) throw new RuntimeException("hairTest 1 failed");
if (h.hairTest2(ginger) != ginger) throw new RuntimeException("hairTest 2 failed");
if (h.hairTest3(ginger) != ginger) throw new RuntimeException("hairTest 3 failed");
if (h.hairTest4(ginger) != ginger) throw new RuntimeException("hairTest 4 failed");
if (h.hairTest5(ginger) != ginger) throw new RuntimeException("hairTest 5 failed");
if (h.hairTest6(ginger) != ginger) throw new RuntimeException("hairTest 6 failed");
if (h.hairTest7(ginger) != ginger) throw new RuntimeException("hairTest 7 failed");
if (h.hairTest8(ginger) != ginger) throw new RuntimeException("hairTest 8 failed");
if (h.hairTest9(ginger) != ginger) throw new RuntimeException("hairTest 9 failed");
if (h.hairTestA(ginger) != ginger) throw new RuntimeException("hairTest A failed");
if (h.hairTestB(ginger) != ginger) throw new RuntimeException("hairTest B failed");
int red = colour.red;
if (h.colourTest1(red) != red) throw new RuntimeException("colourTest HairStruct 1 failed");
if (h.colourTest2(red) != red) throw new RuntimeException("colourTest HairStruct 2 failed");
if (h.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new RuntimeException("namedanonTest HairStruct 1 failed");
if (h.namedanonspaceTest1(namedanonspace.NamedAnonSpace2) != namedanonspace.NamedAnonSpace2) throw new RuntimeException("namedanonspaceTest HairStruct 1 failed");
int fir = TreesClass.trees.fir;
if (h.treesGlobalTest1(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 1 failed");
if (h.treesGlobalTest2(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 2 failed");
if (h.treesGlobalTest3(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 3 failed");
if (h.treesGlobalTest4(fir) != fir) throw new RuntimeException("treesGlobalTest1 HairStruct 4 failed");
}
{
int blonde = HairStruct.hair.blonde;
if (enum_thorough_typeunsafe.hairTest1(blonde) != blonde) throw new RuntimeException("hairTest Global 1 failed");
if (enum_thorough_typeunsafe.hairTest2(blonde) != blonde) throw new RuntimeException("hairTest Global 2 failed");
if (enum_thorough_typeunsafe.hairTest3(blonde) != blonde) throw new RuntimeException("hairTest Global 3 failed");
if (enum_thorough_typeunsafe.hairTest4(blonde) != blonde) throw new RuntimeException("hairTest Global 4 failed");
if (enum_thorough_typeunsafe.hairTest5(blonde) != blonde) throw new RuntimeException("hairTest Global 5 failed");
if (enum_thorough_typeunsafe.hairTest6(blonde) != blonde) throw new RuntimeException("hairTest Global 6 failed");
if (enum_thorough_typeunsafe.hairTest7(blonde) != blonde) throw new RuntimeException("hairTest Global 7 failed");
if (enum_thorough_typeunsafe.hairTest8(blonde) != blonde) throw new RuntimeException("hairTest Global 8 failed");
if (enum_thorough_typeunsafe.hairTest9(blonde) != blonde) throw new RuntimeException("hairTest Global 9 failed");
if (enum_thorough_typeunsafe.hairTestA(blonde) != blonde) throw new RuntimeException("hairTest Global A failed");
if (enum_thorough_typeunsafe.hairTestB(blonde) != blonde) throw new RuntimeException("hairTest Global B failed");
if (enum_thorough_typeunsafe.hairTestC(blonde) != blonde) throw new RuntimeException("hairTest Global C failed");
if (enum_thorough_typeunsafe.hairTestA1(blonde) != blonde) throw new RuntimeException("hairTest Global A1 failed");
if (enum_thorough_typeunsafe.hairTestA2(blonde) != blonde) throw new RuntimeException("hairTest Global A2 failed");
if (enum_thorough_typeunsafe.hairTestA3(blonde) != blonde) throw new RuntimeException("hairTest Global A3 failed");
if (enum_thorough_typeunsafe.hairTestA4(blonde) != blonde) throw new RuntimeException("hairTest Global A4 failed");
if (enum_thorough_typeunsafe.hairTestA5(blonde) != blonde) throw new RuntimeException("hairTest Global A5 failed");
if (enum_thorough_typeunsafe.hairTestA6(blonde) != blonde) throw new RuntimeException("hairTest Global A6 failed");
if (enum_thorough_typeunsafe.hairTestA7(blonde) != blonde) throw new RuntimeException("hairTest Global A7 failed");
if (enum_thorough_typeunsafe.hairTestA8(blonde) != blonde) throw new RuntimeException("hairTest Global A8 failed");
if (enum_thorough_typeunsafe.hairTestA9(blonde) != blonde) throw new RuntimeException("hairTest Global A9 failed");
if (enum_thorough_typeunsafe.hairTestAA(blonde) != blonde) throw new RuntimeException("hairTest Global AA failed");
if (enum_thorough_typeunsafe.hairTestAB(blonde) != blonde) throw new RuntimeException("hairTest Global AB failed");
if (enum_thorough_typeunsafe.hairTestAC(blonde) != blonde) throw new RuntimeException("hairTest Global AC failed");
if (enum_thorough_typeunsafe.hairTestB1(blonde) != blonde) throw new RuntimeException("hairTest Global B1 failed");
if (enum_thorough_typeunsafe.hairTestB2(blonde) != blonde) throw new RuntimeException("hairTest Global B2 failed");
if (enum_thorough_typeunsafe.hairTestB3(blonde) != blonde) throw new RuntimeException("hairTest Global B3 failed");
if (enum_thorough_typeunsafe.hairTestB4(blonde) != blonde) throw new RuntimeException("hairTest Global B4 failed");
if (enum_thorough_typeunsafe.hairTestB5(blonde) != blonde) throw new RuntimeException("hairTest Global B5 failed");
if (enum_thorough_typeunsafe.hairTestB6(blonde) != blonde) throw new RuntimeException("hairTest Global B6 failed");
if (enum_thorough_typeunsafe.hairTestB7(blonde) != blonde) throw new RuntimeException("hairTest Global B7 failed");
if (enum_thorough_typeunsafe.hairTestB8(blonde) != blonde) throw new RuntimeException("hairTest Global B8 failed");
if (enum_thorough_typeunsafe.hairTestB9(blonde) != blonde) throw new RuntimeException("hairTest Global B9 failed");
if (enum_thorough_typeunsafe.hairTestBA(blonde) != blonde) throw new RuntimeException("hairTest Global BA failed");
if (enum_thorough_typeunsafe.hairTestBB(blonde) != blonde) throw new RuntimeException("hairTest Global BB failed");
if (enum_thorough_typeunsafe.hairTestBC(blonde) != blonde) throw new RuntimeException("hairTest Global BC failed");
if (enum_thorough_typeunsafe.hairTestC1(blonde) != blonde) throw new RuntimeException("hairTest Global C1 failed");
if (enum_thorough_typeunsafe.hairTestC2(blonde) != blonde) throw new RuntimeException("hairTest Global C2 failed");
if (enum_thorough_typeunsafe.hairTestC3(blonde) != blonde) throw new RuntimeException("hairTest Global C3 failed");
if (enum_thorough_typeunsafe.hairTestC4(blonde) != blonde) throw new RuntimeException("hairTest Global C4 failed");
if (enum_thorough_typeunsafe.hairTestC5(blonde) != blonde) throw new RuntimeException("hairTest Global C5 failed");
if (enum_thorough_typeunsafe.hairTestC6(blonde) != blonde) throw new RuntimeException("hairTest Global C6 failed");
if (enum_thorough_typeunsafe.hairTestC7(blonde) != blonde) throw new RuntimeException("hairTest Global C7 failed");
if (enum_thorough_typeunsafe.hairTestC8(blonde) != blonde) throw new RuntimeException("hairTest Global C8 failed");
if (enum_thorough_typeunsafe.hairTestC9(blonde) != blonde) throw new RuntimeException("hairTest Global C9 failed");
if (enum_thorough_typeunsafe.hairTestCA(blonde) != blonde) throw new RuntimeException("hairTest Global CA failed");
if (enum_thorough_typeunsafe.hairTestCB(blonde) != blonde) throw new RuntimeException("hairTest Global CB failed");
if (enum_thorough_typeunsafe.hairTestCC(blonde) != blonde) throw new RuntimeException("hairTest Global CC failed");
}
{
FirStruct f = new FirStruct();
int blonde = HairStruct.hair.blonde;
if (f.hairTestFir1(blonde) != blonde) throw new RuntimeException("hairTestFir 1 failed");
if (f.hairTestFir2(blonde) != blonde) throw new RuntimeException("hairTestFir 2 failed");
if (f.hairTestFir3(blonde) != blonde) throw new RuntimeException("hairTestFir 3 failed");
if (f.hairTestFir4(blonde) != blonde) throw new RuntimeException("hairTestFir 4 failed");
if (f.hairTestFir5(blonde) != blonde) throw new RuntimeException("hairTestFir 5 failed");
if (f.hairTestFir6(blonde) != blonde) throw new RuntimeException("hairTestFir 6 failed");
if (f.hairTestFir7(blonde) != blonde) throw new RuntimeException("hairTestFir 7 failed");
if (f.hairTestFir8(blonde) != blonde) throw new RuntimeException("hairTestFir 8 failed");
if (f.hairTestFir9(blonde) != blonde) throw new RuntimeException("hairTestFir 9 failed");
if (f.hairTestFirA(blonde) != blonde) throw new RuntimeException("hairTestFir A failed");
}
{
enum_thorough_typeunsafe.setGlobalInstance(enum_thorough_typeunsafe.globalinstance2);
if (enum_thorough_typeunsafe.getGlobalInstance() != enum_thorough_typeunsafe.globalinstance2) throw new RuntimeException("GlobalInstance 1 failed");
Instances i = new Instances();
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
// ignore enum item tests start
{
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero) != 0) throw new RuntimeException("ignoreATest 0 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three) != 3) throw new RuntimeException("ignoreATest 3 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten) != 10) throw new RuntimeException("ignoreATest 10 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven) != 11) throw new RuntimeException("ignoreATest 11 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen) != 13) throw new RuntimeException("ignoreATest 13 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen) != 14) throw new RuntimeException("ignoreATest 14 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty) != 20) throw new RuntimeException("ignoreATest 20 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty) != 30) throw new RuntimeException("ignoreATest 30 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two) != 32) throw new RuntimeException("ignoreATest 32 failed");
if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three) != 33) throw new RuntimeException("ignoreATest 33 failed");
}
{
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven) != 11) throw new RuntimeException("ignoreBTest 11 failed");
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve) != 12) throw new RuntimeException("ignoreBTest 12 failed");
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one) != 31) throw new RuntimeException("ignoreBTest 31 failed");
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two) != 32) throw new RuntimeException("ignoreBTest 32 failed");
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one) != 41) throw new RuntimeException("ignoreBTest 41 failed");
if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two) != 42) throw new RuntimeException("ignoreBTest 42 failed");
}
{
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten) != 10) throw new RuntimeException("ignoreCTest 10 failed");
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve) != 12) throw new RuntimeException("ignoreCTest 12 failed");
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty) != 30) throw new RuntimeException("ignoreCTest 30 failed");
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two) != 32) throw new RuntimeException("ignoreCTest 32 failed");
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty) != 40) throw new RuntimeException("ignoreCTest 40 failed");
if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two) != 42) throw new RuntimeException("ignoreCTest 42 failed");
}
{
if (enum_thorough_typeunsafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one) != 21) throw new RuntimeException("ignoreDTest 21 failed");
if (enum_thorough_typeunsafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two) != 22) throw new RuntimeException("ignoreDTest 22 failed");
}
{
if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero) != 0) throw new RuntimeException("ignoreETest 0 failed");
if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one) != 21) throw new RuntimeException("ignoreETest 21 failed");
if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two) != 22) throw new RuntimeException("ignoreETest 22 failed");
}
// ignore enum item tests end
{
if (enum_thorough_typeunsafe.repeatTest(repeat.one) != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.two) != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.three) != 3) throw new RuntimeException("repeatTest 4 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.llast) != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.end) != 3) throw new RuntimeException("repeatTest 6 failed");
}
// different types
{
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typeint) != 10) throw new RuntimeException("differentTypes 1 failed");
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typeboolfalse) != 0) throw new RuntimeException("differentTypes 2 failed");
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typebooltrue) != 1) throw new RuntimeException("differentTypes 3 failed");
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typebooltwo) != 2) throw new RuntimeException("differentTypes 4 failed");
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typechar) != 'C') throw new RuntimeException("differentTypes 5 failed");
if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typedefaultint) != 'D') throw new RuntimeException("differentTypes 6 failed");
int global_enum = enum_thorough_typeunsafe.global_typeint;
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
global_enum = enum_thorough_typeunsafe.global_typeboolfalse;
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
global_enum = enum_thorough_typeunsafe.global_typebooltrue;
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
global_enum = enum_thorough_typeunsafe.global_typebooltwo;
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
global_enum = enum_thorough_typeunsafe.global_typechar;
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
global_enum = enum_thorough_typeunsafe.global_typedefaultint;
if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
}
}
}

View File

@@ -0,0 +1,52 @@
import extend_constructor_destructor.*;
public class extend_constructor_destructor_runme {
static {
try {
System.loadLibrary("extend_constructor_destructor");
} 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[]) {
AStruct a = new AStruct(10);
checkGlobal(10);
BStruct b = new BStruct(20);
checkGlobal(20);
CStruct c = new CStruct(30);
checkGlobal(30);
DStruct d = new DStruct(40);
checkGlobal(40);
EStruct e = new EStruct(50);
checkGlobal(50);
FStruct f = new FStruct(60);
checkGlobal(60);
GStruct g = new GStruct(70);
checkGlobal(70);
a.delete();
checkGlobal(-10);
b.delete();
checkGlobal(-20);
c.delete();
checkGlobal(-30);
d.delete();
checkGlobal(-40);
e.delete();
checkGlobal(-50);
f.delete();
checkGlobal(-60);
g.delete();
checkGlobal(-70);
}
public static void checkGlobal(int val) {
int global = extend_constructor_destructor.getGlobalVar();
if (global != val)
throw new RuntimeException("global value incorrect. Expected: " + val + " got: " + global);
}
}

View File

@@ -0,0 +1,226 @@
import extend_default.Override;
import extend_default.*;
public class extend_default_runme {
static {
try {
System.loadLibrary("extend_default");
} 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[])
{
// %extend before the class definition
{
Before ex = new Before();
if (ex.getI() != -1.0 && ex.getD() != -1.0)
throw new RuntimeException("Before constructor 1 failed");
ex = new Before(10);
if (ex.getI() != 10.0 && ex.getD() != -1.0)
throw new RuntimeException("Before constructor 2 failed");
ex = new Before(20, 30.0);
if (ex.getI() != 20 && ex.getD() != 30.0)
throw new RuntimeException("Before constructor 3 failed");
}
{
Before ex = new Before();
if (ex.AddedMethod() != -2.0)
throw new RuntimeException("Before AddedMethod 1 failed");
if (ex.AddedMethod(-2) != -3.0)
throw new RuntimeException("Before AddedMethod 2 failed");
if (ex.AddedMethod(-10, -10.0) != -20)
throw new RuntimeException("Before AddedMethod 3 failed");
}
{
if (Before.AddedStaticMethod() != -2.0)
throw new RuntimeException("Before AddedStaticMethod 1 failed");
if (Before.AddedStaticMethod(-2) != -3.0)
throw new RuntimeException("Before AddedStaticMethod 2 failed");
if (Before.AddedStaticMethod(-10, -10.0) != -20)
throw new RuntimeException("Before AddedStaticMethod 3 failed");
}
// %extend after the class definition
{
After ex = new After();
if (ex.getI() != -1.0 && ex.getD() != -1.0)
throw new RuntimeException("After constructor 1 failed");
ex = new After(10);
if (ex.getI() != 10.0 && ex.getD() != -1.0)
throw new RuntimeException("After constructor 2 failed");
ex = new After(20, 30.0);
if (ex.getI() != 20 && ex.getD() != 30.0)
throw new RuntimeException("After constructor 3 failed");
}
{
After ex = new After();
if (ex.AddedMethod() != -2.0)
throw new RuntimeException("After AddedMethod 1 failed");
if (ex.AddedMethod(-2) != -3.0)
throw new RuntimeException("After AddedMethod 2 failed");
if (ex.AddedMethod(-10, -10.0) != -20)
throw new RuntimeException("After AddedMethod 3 failed");
}
{
if (After.AddedStaticMethod() != -2.0)
throw new RuntimeException("After AddedStaticMethod 1 failed");
if (After.AddedStaticMethod(-2) != -3.0)
throw new RuntimeException("After AddedStaticMethod 2 failed");
if (After.AddedStaticMethod(-10, -10.0) != -20)
throw new RuntimeException("After AddedStaticMethod 3 failed");
}
// %extend before the class definition - with overloading and default args
{
OverBefore ex = new OverBefore();
if (ex.getI() != -1.0 && ex.getD() != -1.0)
throw new RuntimeException("OverBefore constructor 1 failed");
ex = new OverBefore(10);
if (ex.getI() != 10.0 && ex.getD() != -1.0)
throw new RuntimeException("OverBefore constructor 2 failed");
ex = new OverBefore(20, 30.0);
if (ex.getI() != 20 && ex.getD() != 30.0)
throw new RuntimeException("OverBefore constructor 3 failed");
}
{
OverBefore ex = new OverBefore();
if (ex.AddedMethod() != -2.0)
throw new RuntimeException("OverBefore AddedMethod 1 failed");
if (ex.AddedMethod(-2) != -3.0)
throw new RuntimeException("OverBefore AddedMethod 2 failed");
if (ex.AddedMethod(-10, -10.0) != -20)
throw new RuntimeException("OverBefore AddedMethod 3 failed");
}
{
if (OverBefore.AddedStaticMethod() != -2.0)
throw new RuntimeException("OverBefore AddedStaticMethod 1 failed");
if (OverBefore.AddedStaticMethod(-2) != -3.0)
throw new RuntimeException("OverBefore AddedStaticMethod 2 failed");
if (OverBefore.AddedStaticMethod(-10, -10.0) != -20)
throw new RuntimeException("OverBefore AddedStaticMethod 3 failed");
}
{
OverBefore ex = new OverBefore("hello");
if (ex.getI() != -2.0 && ex.getD() != -2.0)
throw new RuntimeException("OverBefore overload constructor 1 failed");
ex = new OverBefore("hello", 10);
if (ex.getI() != 10.0 && ex.getD() != -1.0)
throw new RuntimeException("OverBefore overload constructor 2 failed");
ex = new OverBefore("hello", 20, 30.0);
if (ex.getI() != 20 && ex.getD() != 30.0)
throw new RuntimeException("OverBefore overload constructor 3 failed");
}
{
OverBefore ex = new OverBefore("hello");
if (ex.AddedMethod("hello") != -2.0)
throw new RuntimeException("OverBefore overload AddedMethod 1 failed");
if (ex.AddedMethod("hello", -2) != -3.0)
throw new RuntimeException("OverBefore overload AddedMethod 2 failed");
if (ex.AddedMethod("hello", -10, -10.0) != -20)
throw new RuntimeException("OverBefore overload AddedMethod 3 failed");
}
{
if (OverBefore.AddedStaticMethod("hello") != -2.0)
throw new RuntimeException("OverBefore overload AddedStaticMethod 1 failed");
if (OverBefore.AddedStaticMethod("hello", -2) != -3.0)
throw new RuntimeException("OverBefore overload AddedStaticMethod 2 failed");
if (OverBefore.AddedStaticMethod("hello", -10, -10.0) != -20)
throw new RuntimeException("OverBefore overload AddedStaticMethod 3 failed");
}
// %extend after the class definition - with overloading and default args
{
OverAfter ex = new OverAfter();
if (ex.getI() != -1.0 && ex.getD() != -1.0)
throw new RuntimeException("OverAfter constructor 1 failed");
ex = new OverAfter(10);
if (ex.getI() != 10.0 && ex.getD() != -1.0)
throw new RuntimeException("OverAfter constructor 2 failed");
ex = new OverAfter(20, 30.0);
if (ex.getI() != 20 && ex.getD() != 30.0)
throw new RuntimeException("OverAfter constructor 3 failed");
}
{
OverAfter ex = new OverAfter();
if (ex.AddedMethod() != -2.0)
throw new RuntimeException("OverAfter AddedMethod 1 failed");
if (ex.AddedMethod(-2) != -3.0)
throw new RuntimeException("OverAfter AddedMethod 2 failed");
if (ex.AddedMethod(-10, -10.0) != -20)
throw new RuntimeException("OverAfter AddedMethod 3 failed");
}
{
if (OverAfter.AddedStaticMethod() != -2.0)
throw new RuntimeException("OverAfter AddedStaticMethod 1 failed");
if (OverAfter.AddedStaticMethod(-2) != -3.0)
throw new RuntimeException("OverAfter AddedStaticMethod 2 failed");
if (OverAfter.AddedStaticMethod(-10, -10.0) != -20)
throw new RuntimeException("OverAfter AddedStaticMethod 3 failed");
}
{
OverAfter ex = new OverAfter("hello");
if (ex.getI() != -2.0 && ex.getD() != -2.0)
throw new RuntimeException("OverAfter overload constructor 1 failed");
ex = new OverAfter("hello", 10);
if (ex.getI() != 10.0 && ex.getD() != -1.0)
throw new RuntimeException("OverAfter overload constructor 2 failed");
ex = new OverAfter("hello", 20, 30.0);
if (ex.getI() != 20 && ex.getD() != 30.0)
throw new RuntimeException("OverAfter overload constructor 3 failed");
}
{
OverAfter ex = new OverAfter("hello");
if (ex.AddedMethod("hello") != -2.0)
throw new RuntimeException("OverAfter overload AddedMethod 1 failed");
if (ex.AddedMethod("hello", -2) != -3.0)
throw new RuntimeException("OverAfter overload AddedMethod 2 failed");
if (ex.AddedMethod("hello", -10, -10.0) != -20)
throw new RuntimeException("OverAfter overload AddedMethod 3 failed");
}
{
if (OverAfter.AddedStaticMethod("hello") != -2.0)
throw new RuntimeException("OverAfter overload AddedStaticMethod 1 failed");
if (OverAfter.AddedStaticMethod("hello", -2) != -3.0)
throw new RuntimeException("OverAfter overload AddedStaticMethod 2 failed");
if (OverAfter.AddedStaticMethod("hello", -10, -10.0) != -20)
throw new RuntimeException("OverAfter overload AddedStaticMethod 3 failed");
}
// Override
{
Override o = new Override();
if (o.over() != -1)
throw new RuntimeException("override test 1 failed");
if (o.over(10) != 10*10)
throw new RuntimeException("override test 2 failed");
if (o.ride() != -1)
throw new RuntimeException("override test 3 failed");
if (o.ride(10) != 10)
throw new RuntimeException("override test 4 failed");
if (o.overload() != -10)
throw new RuntimeException("override test 5 failed");
if (o.overload(10) != 10*10)
throw new RuntimeException("override test 6 failed");
}
}
}

View 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);
}
}

View File

@@ -0,0 +1,63 @@
import extend_template_method.*;
public class extend_template_method_runme {
static {
try {
System.loadLibrary("extend_template_method");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
{
ExtendMe em = new ExtendMe();
{
double ret_double = em.do_stuff_double(1, 1.1);
if (ret_double != 1.1)
throw new RuntimeException("double failed " + ret_double);
String ret_string = em.do_stuff_string(1, "hello there");
if (!ret_string.equals("hello there"))
throw new RuntimeException("string failed " + ret_string);
}
{
double ret_double = em.do_overloaded_stuff(1.1);
if (ret_double != 1.1)
throw new RuntimeException("double failed " + ret_double);
String ret_string = em.do_overloaded_stuff("hello there");
if (!ret_string.equals("hello there"))
throw new RuntimeException("string failed " + ret_string);
}
if (ExtendMe.static_method(123) != 123)
throw new RuntimeException("static_method failed");
ExtendMe em2 = new ExtendMe(123);
}
{
TemplateExtend em = new TemplateExtend();
{
double ret_double = em.do_template_stuff_double(1, 1.1);
if (ret_double != 1.1)
throw new RuntimeException("double failed " + ret_double);
String ret_string = em.do_template_stuff_string(1, "hello there");
if (!ret_string.equals("hello there"))
throw new RuntimeException("string failed " + ret_string);
}
{
double ret_double = em.do_template_overloaded_stuff(1.1);
if (ret_double != 1.1)
throw new RuntimeException("double failed " + ret_double);
String ret_string = em.do_template_overloaded_stuff("hello there");
if (!ret_string.equals("hello there"))
throw new RuntimeException("string failed " + ret_string);
}
if (TemplateExtend.static_template_method(123) != 123)
throw new RuntimeException("static_template_method failed");
TemplateExtend em2 = new TemplateExtend(123);
}
}
}

View File

@@ -0,0 +1,65 @@
import extend_typedef_class.*;
public class extend_typedef_class_runme {
static {
try {
System.loadLibrary("extend_typedef_class");
} 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[]) {
// No namespace
{
AClass s = new AClass();
s.setMembervar(10);
checkMatch(s.getvar(), 10);
}
{
BClass s = new BClass();
s.setMembervar(20);
checkMatch(s.getvar(), 20);
}
{
CClass s = new CClass();
s.setMembervar(30);
checkMatch(s.getvar(), 30);
}
{
DClass s = new DClass();
s.setMembervar(40);
checkMatch(s.getvar(), 40);
}
// In namespace
{
AStruct s = new AStruct();
s.setMembervar(10);
checkMatch(s.getvar(), 10);
}
{
BStruct s = new BStruct();
s.setMembervar(20);
checkMatch(s.getvar(), 20);
}
{
CStruct s = new CStruct();
s.setMembervar(30);
checkMatch(s.getvar(), 30);
}
{
DStruct s = new DStruct();
s.setMembervar(40);
checkMatch(s.getvar(), 40);
}
}
public static void checkMatch(int expected, int got) {
if (expected != got)
throw new RuntimeException("Value incorrect. Expected: " + expected + " got: " + got);
}
}

View File

@@ -0,0 +1,21 @@
import extern_declaration.*;
public class extern_declaration_runme {
static {
try {
System.loadLibrary("extern_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[])
{
if (extern_declaration.externimport(100) != 100) throw new RuntimeException("externimport failed");
if (extern_declaration.externexport(200) != 200) throw new RuntimeException("externexport failed");
if (extern_declaration.externstdcall(300) != 300) throw new RuntimeException("externstdcall failed");
}
}

View File

@@ -0,0 +1,53 @@
import friends.*;
public class friends_runme {
static {
try {
System.loadLibrary("friends");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) throws Throwable
{
A a = new A(2);
if (friends.get_val1(a) != 2)
throw new RuntimeException("failed");
if (friends.get_val2(a) != 4)
throw new RuntimeException("failed");
if (friends.get_val3(a) != 6)
throw new RuntimeException("failed");
// nice overload working fine
if (friends.get_val1(1,2,3) != 1)
throw new RuntimeException("failed");
B b = new B(3);
// David's case
if (friends.mix(a,b) != 5)
throw new RuntimeException("failed");
D_d di = new D_d(2);
D_d dd = new D_d(3.3);
// incredible template overloading working just fine
if (friends.get_val1(di) != 2)
throw new RuntimeException("failed");
if (friends.get_val1(dd) != 3.3)
throw new RuntimeException("failed");
friends.set(di, 4);
friends.set(dd, 1.3);
if (friends.get_val1(di) != 4)
throw new RuntimeException("failed");
if (friends.get_val1(dd) != 1.3)
throw new RuntimeException("failed");
}
}

View File

@@ -0,0 +1,28 @@
import friends_template.*;
public class friends_template_runme {
static {
try {
System.loadLibrary("friends_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[]) {
friends_template.OperatorOutputDouble(1.1, new MyClassDouble());
friends_template.OperatorInputDouble(1.1, new MyClassDouble());
friends_template.funk_hidden(1.1, new MyClassDouble());
friends_template.funk_seen(1.1, new MyClassDouble());
friends_template.TemplateFriendHiddenInt(0);
friends_template.TemplateFriendSeenInt(0, 0);
SWIGTYPE_p_MyClassT_int_t myClassInt = friends_template.makeMyClassInt();
friends_template.OperatorInputInt(1, myClassInt);
friends_template.OperatorFunkSeenInt(1.1, myClassInt);
}
}

View File

@@ -0,0 +1,55 @@
import global_namespace.*;
public class global_namespace_runme {
static {
try {
System.loadLibrary("global_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[]) {
Klass1 k1 = new Klass1();
Klass2 k2 = new Klass2();
Klass3 k3 = new Klass3();
Klass4 k4 = new Klass4();
Klass5 k5 = new Klass5();
Klass6 k6 = new Klass6();
Klass7 k7 = new Klass7();
KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7);
KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7);
k1 = global_namespace.getKlass1A();
k2 = global_namespace.getKlass2A();
k3 = global_namespace.getKlass3A();
k4 = global_namespace.getKlass4A();
k5 = global_namespace.getKlass5A();
k6 = global_namespace.getKlass6A();
k7 = global_namespace.getKlass7A();
KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7);
KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7);
k1 = global_namespace.getKlass1B();
k2 = global_namespace.getKlass2B();
k3 = global_namespace.getKlass3B();
k4 = global_namespace.getKlass4B();
k5 = global_namespace.getKlass5B();
k6 = global_namespace.getKlass6B();
k7 = global_namespace.getKlass7B();
KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7);
KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7);
XYZMethods.methodA(new XYZ1(), new XYZ2(), new XYZ3(), new XYZ4(), new XYZ5(), new XYZ6(), new XYZ7());
XYZMethods.methodB(new XYZ1(), new XYZ2(), new XYZ3(), new XYZ4(), new XYZ5(), new XYZ6(), new XYZ7());
TheEnumMethods.methodA(TheEnum1.theenum1, TheEnum2.theenum2, TheEnum3.theenum3);
TheEnumMethods.methodA(TheEnum1.theenum1, TheEnum2.theenum2, TheEnum3.theenum3);
}
}

View File

@@ -0,0 +1,36 @@
// Runtime test checking the %typemap(ignore) macro
import ignore_parameter.*;
public class ignore_parameter_runme {
static {
try {
System.loadLibrary("ignore_parameter");
} 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[])
{
// 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")) { 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")) { 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);
MorrisMinor mm = new MorrisMinor("slow", 0.0);
FordAnglia fa = new FordAnglia("slow", 200);
AustinAllegro aa = new AustinAllegro();
}
}

View File

@@ -0,0 +1,24 @@
// This is the imports runtime testcase. It shows that the %import directive
// is working correctly
import imports.*;
public class imports_runme {
static {
try {
System.loadLibrary("imports_a");
System.loadLibrary("imports_b");
} 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[]) {
B b = new B();
b.hello(); //call member function in A which is in a different SWIG generated library.
}
}

View File

@@ -0,0 +1,21 @@
import inctest.*;
public class inctest_runme {
static {
try {
System.loadLibrary("inctest");
} 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[])
{
MY_THINGS things = new MY_THINGS();
int i=0;
things.setIntegerMember(i);
double d = things.getDoubleMember();
}
}

View File

@@ -0,0 +1,35 @@
import inherit_target_language.*;
public class inherit_target_language_runme {
static {
try {
System.loadLibrary("inherit_target_language");
} 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 Derived1().targetLanguageBaseMethod();
new Derived2().targetLanguageBaseMethod();
new MultipleDerived1().targetLanguageBaseMethod();
new MultipleDerived2().targetLanguageBaseMethod();
new MultipleDerived3().f();
new MultipleDerived4().g();
BaseX baseX = new BaseX();
baseX.basex();
baseX.targetLanguageBase2Method();
DerivedX derivedX = new DerivedX();
derivedX.basex();
derivedX.derivedx();
derivedX.targetLanguageBase2Method();
}
}

View File

@@ -0,0 +1,24 @@
import intermediary_classname.*;
public class intermediary_classname_runme {
static {
try {
System.loadLibrary("intermediary_classname");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
// test the renamed module class is correctly named
double d = intermediary_classnameModule.maxdouble(10.0, 20.0);
if (d!=20.0) throw new RuntimeException("Test failed");
// test the renamed intermediary class is correctly named
long ptr = intermediary_classname.new_vecdouble(10);
intermediary_classname.delete_vecdouble(ptr);
}
}

View File

@@ -0,0 +1,29 @@
import java_constants.*;
public class java_constants_runme {
static {
try {
System.loadLibrary("java_constants");
} 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 number = 200;
// Switch statement will only compile if these constants are initialised
// from a constant Java value, that is not from a function call
switch(number) {
case java_constants.CHINA:
break;
case java_constants.BRISTOLS:
break;
default:
break;
}
}
}

View File

@@ -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 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()" );
}
}
}

View File

@@ -0,0 +1,159 @@
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() + "'");
StackTraceElement[] st = e.getStackTrace();
failif( st.length != 5, "Stack length is only " + st.length);
failif( ! st[0].toString().startsWith("java_director_exception_feature_nspace_MyFooDirectorImpl.genericpong(java_director_exception_feature_nspace_runme.java:"), "Incorrect top of stack: " + st[0]);
}
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() + "'");
StackTraceElement[] st = e.getStackTrace();
failif( st.length != 5, "Stack length is only " + st.length);
failif( ! st[0].toString().startsWith("java_director_exception_feature_nspace_MyFooDirectorImpl.genericpong(java_director_exception_feature_nspace_runme.java:"), "Incorrect top of stack: " + st[0]);
}
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() + "'");
StackTraceElement[] st = e.getStackTrace();
failif( st.length != 5, "Stack length is only " + st.length);
failif( ! st[0].toString().startsWith("java_director_exception_feature_nspace_MyFooDirectorImpl.genericpong(java_director_exception_feature_nspace_runme.java:"), "Incorrect top of stack: " + st[0]);
}
try { b.genericpong(4); fail("No exception thrown in genericpong(4)");}
catch (RuntimeException e) {
failif ( e.getClass() != RuntimeException.class, "Exception " + e + " is not exactly RuntimeException");
failif( ! "Unspecified DirectorException message".equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
}
}
catch (Exception e) {
e.printStackTrace();
fail("Unexpected exception thrown or exception not mapped properly");
}
}
}

View File

@@ -0,0 +1,161 @@
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() + "'");
StackTraceElement[] st = e.getStackTrace();
failif( st.length != 5, "Stack length is only " + st.length);
failif( ! st[0].toString().startsWith("java_director_exception_feature_MyFooDirectorImpl.genericpong(java_director_exception_feature_runme.java:"), "Incorrect top of stack: " + st[0]);
}
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() + "'");
StackTraceElement[] st = e.getStackTrace();
failif( st.length != 5, "Stack length is only " + st.length);
failif( ! st[0].toString().startsWith("java_director_exception_feature_MyFooDirectorImpl.genericpong(java_director_exception_feature_runme.java:"), "Incorrect top of stack: " + st[0]);
}
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() + "'");
StackTraceElement[] st = e.getStackTrace();
failif( st.length != 5, "Stack length is only " + st.length);
failif( ! st[0].toString().startsWith("java_director_exception_feature_MyFooDirectorImpl.genericpong(java_director_exception_feature_runme.java:"), "Incorrect top of stack: " + st[0]);
}
try { b.genericpong(4); fail("No exception thrown in genericpong(4)");}
catch (RuntimeException e) {
failif ( e.getClass() != RuntimeException.class, "Exception " + e + " is not exactly RuntimeException");
failif( ! "Unspecified DirectorException message".equals(e.getMessage()), "Expected exception has unexpected message: '" + e.getMessage() + "'");
}
}
catch (Exception e) {
e.printStackTrace();
fail("Unexpected exception thrown or exception not mapped properly");
}
}
}

View File

@@ -0,0 +1,47 @@
import java_director_ptrclass.*;
public class java_director_ptrclass_runme {
static {
try {
System.loadLibrary("java_director_ptrclass");
} 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[]) {
Foo f = new Foo();
Foo ft = new TouchingFoo();
Baz b = new Baz();
if (b.GetTouched()) {
throw new RuntimeException ( "Baz should not have been touched yet." );
}
Baz b2 = f.FinalMaybeTouch(b);
if (b2.GetTouched() || b.GetTouched()) {
throw new RuntimeException ( "Baz should not have been touched by Foo." );
}
Baz b3 = ft.FinalMaybeTouch(b);
if (!b.GetTouched() || !b3.GetTouched() || !b2.GetTouched()) {
throw new RuntimeException ( "Baz was not touched by TouchingFoo. This" +
" might mean the directorin typemap is not" +
" parsing the typemap(jstype, Bar) in its" +
" 'descriptor' kwarg correctly." );
}
}
}
class TouchingFoo extends Foo {
@Override
public Baz MaybeTouch(Baz baz_ptr) {
baz_ptr.SetTouched();
return baz_ptr;
}
}

Some files were not shown because too many files have changed in this diff Show More