summaryrefslogtreecommitdiff
path: root/trunk/Examples/test-suite/csharp
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/Examples/test-suite/csharp')
-rw-r--r--trunk/Examples/test-suite/csharp/Makefile.in88
-rw-r--r--trunk/Examples/test-suite/csharp/README42
-rw-r--r--trunk/Examples/test-suite/csharp/aggregate_runme.cs28
-rw-r--r--trunk/Examples/test-suite/csharp/allprotected_runme.cs71
-rw-r--r--trunk/Examples/test-suite/csharp/apply_strings_runme.cs16
-rw-r--r--trunk/Examples/test-suite/csharp/bools_runme.cs29
-rw-r--r--trunk/Examples/test-suite/csharp/catches_runme.cs66
-rw-r--r--trunk/Examples/test-suite/csharp/char_strings_runme.cs155
-rw-r--r--trunk/Examples/test-suite/csharp/constover_runme.cs34
-rw-r--r--trunk/Examples/test-suite/csharp/csharp_attributes_runme.cs266
-rw-r--r--trunk/Examples/test-suite/csharp/csharp_exceptions_runme.cs342
-rw-r--r--trunk/Examples/test-suite/csharp/csharp_lib_arrays_runme.cs70
-rw-r--r--trunk/Examples/test-suite/csharp/csharp_prepost_runme.cs70
-rw-r--r--trunk/Examples/test-suite/csharp/csharp_typemaps_runme.cs113
-rw-r--r--trunk/Examples/test-suite/csharp/default_args_runme.cs143
-rw-r--r--trunk/Examples/test-suite/csharp/default_constructor_runme.cs24
-rw-r--r--trunk/Examples/test-suite/csharp/director_basic_runme.cs74
-rw-r--r--trunk/Examples/test-suite/csharp/director_classes_runme.cs180
-rw-r--r--trunk/Examples/test-suite/csharp/director_classic_runme.cs314
-rw-r--r--trunk/Examples/test-suite/csharp/director_ignore_runme.cs57
-rw-r--r--trunk/Examples/test-suite/csharp/director_primitives_runme.cs127
-rw-r--r--trunk/Examples/test-suite/csharp/director_protected_runme.cs72
-rw-r--r--trunk/Examples/test-suite/csharp/director_string_runme.cs53
-rw-r--r--trunk/Examples/test-suite/csharp/enum_thorough_runme.cs410
-rw-r--r--trunk/Examples/test-suite/csharp/enum_thorough_simple_runme.cs410
-rw-r--r--trunk/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs410
-rw-r--r--trunk/Examples/test-suite/csharp/exception_order_runme.cs48
-rw-r--r--trunk/Examples/test-suite/csharp/imports_runme.cs18
-rw-r--r--trunk/Examples/test-suite/csharp/inherit_target_language_runme.cs24
-rw-r--r--trunk/Examples/test-suite/csharp/intermediary_classname_runme.cs21
-rw-r--r--trunk/Examples/test-suite/csharp/li_attribute_runme.cs78
-rw-r--r--trunk/Examples/test-suite/csharp/li_boost_shared_ptr_bits_runme.cs17
-rw-r--r--trunk/Examples/test-suite/csharp/li_boost_shared_ptr_runme.cs589
-rw-r--r--trunk/Examples/test-suite/csharp/li_std_combinations_runme.cs31
-rw-r--r--trunk/Examples/test-suite/csharp/li_std_except_runme.cs24
-rw-r--r--trunk/Examples/test-suite/csharp/li_std_map_runme.cs238
-rw-r--r--trunk/Examples/test-suite/csharp/li_std_string_runme.cs100
-rw-r--r--trunk/Examples/test-suite/csharp/li_std_vector_runme.cs638
-rw-r--r--trunk/Examples/test-suite/csharp/li_std_wstring_runme.cs76
-rw-r--r--trunk/Examples/test-suite/csharp/li_typemaps_runme.cs101
-rw-r--r--trunk/Examples/test-suite/csharp/long_long_runme.cs41
-rw-r--r--trunk/Examples/test-suite/csharp/member_pointer_runme.cs47
-rw-r--r--trunk/Examples/test-suite/csharp/nspace_extend_runme.cs39
-rw-r--r--trunk/Examples/test-suite/csharp/nspace_runme.cs76
-rw-r--r--trunk/Examples/test-suite/csharp/operator_overload_runme.cs46
-rw-r--r--trunk/Examples/test-suite/csharp/overload_complicated_runme.cs55
-rw-r--r--trunk/Examples/test-suite/csharp/overload_template_runme.cs152
-rw-r--r--trunk/Examples/test-suite/csharp/pointer_reference_runme.cs18
-rw-r--r--trunk/Examples/test-suite/csharp/preproc_constants_c_runme.cs70
-rw-r--r--trunk/Examples/test-suite/csharp/preproc_constants_runme.cs69
-rw-r--r--trunk/Examples/test-suite/csharp/sizet_runme.cs18
-rw-r--r--trunk/Examples/test-suite/csharp/sneaky1_runme.cs20
-rw-r--r--trunk/Examples/test-suite/csharp/special_variable_macros_runme.cs22
-rw-r--r--trunk/Examples/test-suite/csharp/threads_runme.cs61
-rw-r--r--trunk/Examples/test-suite/csharp/throw_exception_runme.cs24
-rw-r--r--trunk/Examples/test-suite/csharp/typemap_namespace_runme.cs16
-rw-r--r--trunk/Examples/test-suite/csharp/typemap_out_optimal_runme.cs13
-rw-r--r--trunk/Examples/test-suite/csharp/varargs_runme.cs20
-rw-r--r--trunk/Examples/test-suite/csharp/virtual_poly_runme.cs51
59 files changed, 6525 insertions, 0 deletions
diff --git a/trunk/Examples/test-suite/csharp/Makefile.in b/trunk/Examples/test-suite/csharp/Makefile.in
new file mode 100644
index 000000000..afb29dfbf
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/Makefile.in
@@ -0,0 +1,88 @@
+#######################################################################
+# Makefile for C# test-suite
+#######################################################################
+
+LANGUAGE = csharp
+SCRIPTSUFFIX = _runme.cs
+INTERPRETER = @CSHARPCILINTERPRETER@
+CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@"
+CSHARPCYGPATH_W = @CSHARPCYGPATH_W@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@/..
+top_builddir = @top_builddir@/..
+
+CPP_TEST_CASES = \
+ csharp_attributes \
+ csharp_exceptions \
+ csharp_features \
+ csharp_lib_arrays \
+ csharp_prepost \
+ csharp_typemaps \
+ enum_thorough_simple \
+ enum_thorough_typesafe \
+ exception_partial_info \
+ intermediary_classname
+
+include $(srcdir)/../common.mk
+
+# Overridden variables here
+SWIGOPT += -namespace $*Namespace
+INTERFACEDIR = ../../
+
+CSHARPFLAGSSPECIAL =
+
+# Custom tests - tests with additional commandline options
+intermediary_classname.cpptest: SWIGOPT += -dllimport intermediary_classname
+csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup)
+ +(cd $* && $(swig_and_compile_cpp))
+ +$(run_testcase)
+
+%.ctest:
+ $(setup)
+ +(cd $* && $(swig_and_compile_c))
+ +$(run_testcase)
+
+%.multicpptest:
+ $(setup)
+ +(cd $* && $(swig_and_compile_multi_cpp))
+ +$(run_testcase)
+
+# Makes a directory for the testcase if it does not exist
+setup = \
+ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \
+ else \
+ echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
+ fi; \
+ if [ ! -d $* ]; then \
+ mkdir $*; \
+ fi
+
+# Compiles C# files then runs the testcase. A testcase is only run if
+# a file is found which has _runme.cs appended after the testcase name.
+# Note C# uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows and SHLIB_PATH on HPUX.
+run_testcase = \
+ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ $(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
+ CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
+ CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \
+ env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" $(RUNTOOL) $(INTERPRETER) $*_runme.exe; \
+ else \
+ cd $* && \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
+ CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
+ CSHARPSRCS='`find . -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile; \
+ fi
+
+# Clean: remove testcase directories
+%.clean:
+ @if [ -d $* ]; then \
+ rm -rf $*; \
+ fi
+
+clean:
+ @rm -f *.exe *.exe.mdb
diff --git a/trunk/Examples/test-suite/csharp/README b/trunk/Examples/test-suite/csharp/README
new file mode 100644
index 000000000..96dea942c
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/README
@@ -0,0 +1,42 @@
+SWIG testsuite README file
+--------------------------
+
+This testsuite is here to ensure SWIG can handle a wide range of c/c++
+syntax. The testsuite comprises many testcases in this directory. Each
+test case is tested under each of the language modules thereby
+thoroughly testing all of SWIG. It ensures that each of the language
+modules are at a similar standard.
+
+Those modules that support shadow classes run the tests producing
+shadow classes to test the full language module functionality.
+
+Some test cases need a runtime test. These need implementing in each
+of the language modules. The language modules look for a file in the
+language specific test-suite directory which has _runme appended after
+the testcase name. If one is found it will be run as part of the test.
+
+Some language modules add to this common set of test cases for
+language specific tests. These can be found in the appropriate
+language test-suite directory. There is also a README in each of the
+language module directories.
+
+For each testcase a message showing which testcase is being tested is
+displayed. Nothing else is printed unless the test fails.
+
+
+Some Developer Guidelines
+-------------------------
+
+Note that the whole test suite need not be run each time a testcase is
+modified. An individual testcase may be run by going to the language
+module test-suite directory and using make testcasename.xxx where xxx
+is the type of test (eg cpptest). See common.mk. make -s doesn't print
+any junk on the screen and is useful for emulating the way make check
+works from the SWIG root directory.
+
+If there are runtime tests needed, don't print anything unless there
+is an error in which case stderr is suggested.
+
+Please set the name of the module to the same name as the testcase,
+otherwise modules will not be found.
+
diff --git a/trunk/Examples/test-suite/csharp/aggregate_runme.cs b/trunk/Examples/test-suite/csharp/aggregate_runme.cs
new file mode 100644
index 000000000..ee6394b56
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/aggregate_runme.cs
@@ -0,0 +1,28 @@
+using System;
+using aggregateNamespace;
+
+public class runme {
+ static void Main() {
+
+ // Confirm that move() returns correct results under normal use
+ int result = aggregate.move(aggregate.UP);
+ if (result != aggregate.UP) throw new Exception("UP failed");
+
+ result = aggregate.move(aggregate.DOWN);
+ if (result != aggregate.DOWN) throw new Exception("DOWN failed");
+
+ result = aggregate.move(aggregate.LEFT);
+ if (result != aggregate.LEFT) throw new Exception("LEFT failed");
+
+ result = aggregate.move(aggregate.RIGHT);
+ if (result != aggregate.RIGHT) throw new Exception("RIGHT failed");
+
+ // Confirm that move() raises an exception when the contract is violated
+ try {
+ aggregate.move(0);
+ throw new Exception("0 test failed");
+ }
+ catch (ArgumentOutOfRangeException) {
+ }
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/allprotected_runme.cs b/trunk/Examples/test-suite/csharp/allprotected_runme.cs
new file mode 100644
index 000000000..99a791d58
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/allprotected_runme.cs
@@ -0,0 +1,71 @@
+using System;
+using allprotectedNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ runme r = new runme();
+ r.run();
+ }
+
+ void run()
+ {
+ MyProtectedBase mpb = new MyProtectedBase("MyProtectedBase");
+ mpb.accessProtected();
+ }
+}
+
+class MyProtectedBase : ProtectedBase
+{
+ public MyProtectedBase(string name) : base(name) {
+ }
+ public void accessProtected() {
+ string s = virtualMethod();
+ if (s != "ProtectedBase")
+ throw new Exception("Failed");
+
+ Klass k = instanceMethod(new Klass("xyz"));
+ if (k.getName() != "xyz")
+ throw new Exception("Failed");
+
+ k = instanceOverloaded(new Klass("xyz"));
+ if (k.getName() != "xyz")
+ throw new Exception("Failed");
+
+ k = instanceOverloaded(new Klass("xyz"), "abc");
+ if (k.getName() != "abc")
+ throw new Exception("Failed");
+
+ k = ProtectedBase.staticMethod(new Klass("abc"));
+ if (k.getName() != "abc")
+ throw new Exception("Failed");
+
+ k = ProtectedBase.staticOverloaded(new Klass("xyz"));
+ if (k.getName() != "xyz")
+ throw new Exception("Failed");
+
+ k = ProtectedBase.staticOverloaded(new Klass("xyz"), "abc");
+ if (k.getName() != "abc")
+ throw new Exception("Failed");
+
+ instanceMemberVariable = 30;
+ int i = instanceMemberVariable;
+ if (i != 30)
+ throw new Exception("Failed");
+
+ staticMemberVariable = 40;
+ i = staticMemberVariable;
+ if (i != 40)
+ throw new Exception("Failed");
+
+ i = staticConstMemberVariable;
+ if (i != 20)
+ throw new Exception("Failed");
+
+ anEnum = ProtectedBase.AnEnum.EnumVal1;
+ ProtectedBase.AnEnum ae = anEnum;
+ if (ae != ProtectedBase.AnEnum.EnumVal1)
+ throw new Exception("Failed");
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/apply_strings_runme.cs b/trunk/Examples/test-suite/csharp/apply_strings_runme.cs
new file mode 100644
index 000000000..deaa5213b
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/apply_strings_runme.cs
@@ -0,0 +1,16 @@
+
+using System;
+using apply_stringsNamespace;
+
+public class apply_strings_runme {
+
+ private static string TEST_MESSAGE = "A message from target language to the C++ world and back again.";
+
+ public static void Main() {
+ if (apply_strings.UCharFunction(TEST_MESSAGE) != TEST_MESSAGE) throw new Exception("UCharFunction failed");
+ if (apply_strings.SCharFunction(TEST_MESSAGE) != TEST_MESSAGE) throw new Exception("SCharFunction failed");
+ SWIGTYPE_p_char pChar = apply_strings.CharFunction(null);
+ if (pChar != null) throw new Exception("CharFunction failed");
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/bools_runme.cs b/trunk/Examples/test-suite/csharp/bools_runme.cs
new file mode 100644
index 000000000..70620fcef
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/bools_runme.cs
@@ -0,0 +1,29 @@
+
+// This is the bool runtime testcase. It checks that the C++ bool type works.
+
+using System;
+using boolsNamespace;
+
+public class bools_runme {
+
+ public static void Main() {
+
+ bool t = true;
+ bool f = false;
+
+ check_bo(f);
+ check_bo(t);
+ }
+
+ public static void check_bo(bool input) {
+
+ for( int i=0; i<1000; i++ ) {
+ if( bools.bo(input) != input ) {
+ string ErrorMessage = "Runtime test check_bo failed.";
+ throw new Exception(ErrorMessage);
+ }
+ }
+
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/catches_runme.cs b/trunk/Examples/test-suite/csharp/catches_runme.cs
new file mode 100644
index 000000000..2b5290eac
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/catches_runme.cs
@@ -0,0 +1,66 @@
+using System;
+using catchesNamespace;
+
+public class runme {
+ static void Main() {
+ // test_catches()
+ try {
+ catches.test_catches(1);
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "C++ int exception thrown, value: 1")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ try {
+ catches.test_catches(2);
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "two")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ try {
+ catches.test_catches(3);
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "C++ ThreeException const & exception thrown")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ // test_exception_specification()
+ try {
+ catches.test_exception_specification(1);
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "C++ int exception thrown, value: 1")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ try {
+ catches.test_exception_specification(2);
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "unknown exception")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ try {
+ catches.test_exception_specification(3);
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "unknown exception")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ // test_catches_all()
+ try {
+ catches.test_catches_all(1);
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "unknown exception")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/char_strings_runme.cs b/trunk/Examples/test-suite/csharp/char_strings_runme.cs
new file mode 100644
index 000000000..414d32b7a
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/char_strings_runme.cs
@@ -0,0 +1,155 @@
+
+using System;
+using char_stringsNamespace;
+
+public class char_strings_runme {
+
+ 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() {
+
+ uint count = 10000;
+ uint i = 0;
+
+ // get functions
+ for (i=0; i<count; i++) {
+ string str = char_strings.GetCharHeapString();
+ if (str != CPLUSPLUS_MSG)
+ throw new Exception("Test char get 1 failed, iteration " + i);
+ char_strings.DeleteCharHeapString();
+ }
+
+ for (i=0; i<count; i++) {
+ string str = char_strings.GetConstCharProgramCodeString();
+ if (str != CPLUSPLUS_MSG)
+ throw new Exception("Test char get 2 failed, iteration " + i);
+ char_strings.DeleteCharHeapString();
+ }
+
+ for (i=0; i<count; i++) {
+ string str = char_strings.GetCharStaticString();
+ if (str != CPLUSPLUS_MSG)
+ throw new Exception("Test char get 3 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ string str = char_strings.GetCharStaticStringFixed();
+ if (str != CPLUSPLUS_MSG)
+ throw new Exception("Test char get 4 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ string str = char_strings.GetConstCharStaticStringFixed();
+ if (str != CPLUSPLUS_MSG)
+ throw new Exception("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 Exception("Test char set 1 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (!char_strings.SetCharStaticString(OTHERLAND_MSG + i, i))
+ throw new Exception("Test char set 2 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (!char_strings.SetCharArrayStaticString(OTHERLAND_MSG + i, i))
+ throw new Exception("Test char set 3 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (!char_strings.SetConstCharHeapString(OTHERLAND_MSG + i, i))
+ throw new Exception("Test char set 4 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (!char_strings.SetConstCharStaticString(OTHERLAND_MSG + i, i))
+ throw new Exception("Test char set 5 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (!char_strings.SetConstCharArrayStaticString(OTHERLAND_MSG + i, i))
+ throw new Exception("Test char set 6 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (!char_strings.SetCharConstStaticString(OTHERLAND_MSG + i, i))
+ throw new Exception("Test char set 7 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (!char_strings.SetConstCharConstStaticString(OTHERLAND_MSG + i, i))
+ throw new Exception("Test char set 8 failed, iteration " + i);
+ }
+
+ // get set function
+ for (i=0; i<count*10; i++) {
+ string ping = OTHERLAND_MSG + i;
+ string pong = char_strings.CharPingPong(ping);
+ if (ping != pong)
+ throw new Exception("Test PingPong 1 failed.\nExpected:" + ping + "\nReceived:" + pong);
+ }
+
+ // variables
+ for (i=0; i<count; i++) {
+ char_strings.global_char = OTHERLAND_MSG + i;
+ if (char_strings.global_char != OTHERLAND_MSG + i)
+ throw new Exception("Test variables 1 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ char_strings.global_char_array1 = OTHERLAND_MSG + i;
+ if (char_strings.global_char_array1 != OTHERLAND_MSG + i)
+ throw new Exception("Test variables 2 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ char_strings.global_char_array2 = OTHERLAND_MSG + i;
+ if (char_strings.global_char_array2 != OTHERLAND_MSG + i)
+ throw new Exception("Test variables 3 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (char_strings.global_const_char != CPLUSPLUS_MSG)
+ throw new Exception("Test variables 4 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (char_strings.global_const_char_array1 != CPLUSPLUS_MSG)
+ throw new Exception("Test variables 5 failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (char_strings.global_const_char_array2 != CPLUSPLUS_MSG)
+ throw new Exception("Test variables 6 failed, iteration " + i);
+ }
+
+ // char *& tests
+ for (i=0; i<count; i++) {
+ String str = char_strings.GetCharPointerRef();
+ if (str != CPLUSPLUS_MSG)
+ throw new Exception("Test char pointer ref get failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ if (!char_strings.SetCharPointerRef(OTHERLAND_MSG + i, i))
+ throw new Exception("Test char pointer ref set failed, iteration " + i);
+ }
+
+ for (i=0; i<count; i++) {
+ String str = char_strings.GetConstCharPointerRef();
+ if (str != CPLUSPLUS_MSG)
+ throw new Exception("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 Exception("Test const char pointer ref set failed, iteration " + i);
+ }
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/constover_runme.cs b/trunk/Examples/test-suite/csharp/constover_runme.cs
new file mode 100644
index 000000000..bae7b38a6
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/constover_runme.cs
@@ -0,0 +1,34 @@
+using System;
+using constoverNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ string p = constover.test("test");
+ if ( p != "test" )
+ throw new Exception( "test failed!" );
+
+ p = constover.test_pconst("test");
+ if ( p != "test_pconst" )
+ throw new Exception( "test_pconst failed!" );
+
+ Foo f = new Foo();
+ p = f.test("test");
+ if ( p != "test" )
+ throw new Exception( "member-test failed!" );
+
+ p = f.test_pconst("test");
+ if ( p != "test_pconst" )
+ throw new Exception( "member-test_pconst failed!" );
+
+ p = f.test_constm("test");
+ if ( p != "test_constmethod" )
+ throw new Exception( "member-test_constm failed!" );
+
+ p = f.test_pconstm("test");
+ if ( p != "test_pconstmethod" )
+ throw new Exception( "member-test_pconstm failed!" );
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/csharp_attributes_runme.cs b/trunk/Examples/test-suite/csharp/csharp_attributes_runme.cs
new file mode 100644
index 000000000..4cdced80d
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/csharp_attributes_runme.cs
@@ -0,0 +1,266 @@
+using System;
+using System.Reflection;
+using System.ComponentModel;
+using csharp_attributesNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ // Custom attributes typemap tests
+ //
+ // cstype typemap attributechecks
+ //
+ // Global function cstype typemap attributes check
+ Type globaltype = typeof(csharp_attributes);
+ {
+ MethodInfo member = (MethodInfo)globaltype.GetMember("GlobalFunction")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(IntOutAttribute)) == null)
+ throw new Exception("No IntOut attribute for " + member.Name);
+ ParameterInfo parameter = member.GetParameters()[0]; // expecting one parameter
+ if (parameter.Name != "myInt")
+ throw new Exception("Incorrect parameter name");
+ Attribute attribute = Attribute.GetCustomAttributes(parameter)[0];
+ if (attribute.GetType() != typeof(IntInAttribute))
+ throw new Exception("Expecting IntIn attribute");
+ }
+ // Constant - cstype typemap attributes check
+ {
+ MemberInfo member = (MemberInfo)globaltype.GetMember("TESTMACRO")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(IntOutAttribute)) == null)
+ throw new Exception("No IntOut attribute for " + member.Name);
+ }
+
+ // Non-static method cstype typemap attributes check
+ Type type = typeof(Stations);
+ {
+ MethodInfo member = (MethodInfo)type.GetMember("Reading")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(IntOutAttribute)) == null)
+ throw new Exception("No IntOut attribute for " + member.Name);
+ ParameterInfo parameter = member.GetParameters()[0]; // expecting one parameter
+ if (parameter.Name != "myInt")
+ throw new Exception("Incorrect parameter name");
+ Attribute attribute = Attribute.GetCustomAttributes(parameter)[0];
+ if (attribute.GetType() != typeof(IntInAttribute))
+ throw new Exception("Expecting IntIn attribute");
+ }
+ // Static method cstype typemap attributes check
+ {
+ MethodInfo member = (MethodInfo)type.GetMember("Swindon")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(IntOutAttribute)) == null)
+ throw new Exception("No IntOut attribute for " + member.Name);
+ ParameterInfo parameter = member.GetParameters()[0]; // expecting one parameter
+ if (parameter.Name != "myInt")
+ throw new Exception("Incorrect parameter name");
+ Attribute attribute = Attribute.GetCustomAttributes(parameter)[0];
+ if (attribute.GetType() != typeof(IntInAttribute))
+ throw new Exception("Expecting IntIn attribute");
+ }
+ // Constructor cstype typemap attributes check
+ {
+ ConstructorInfo member = (ConstructorInfo)type.GetConstructors()[0];
+ ParameterInfo parameter = member.GetParameters()[0]; // expecting one parameter
+ if (parameter.Name != "myInt")
+ throw new Exception("Incorrect parameter name");
+ Attribute attribute = Attribute.GetCustomAttributes(parameter)[0];
+ if (attribute.GetType() != typeof(IntInAttribute))
+ throw new Exception("Expecting IntIn attribute");
+ }
+
+ //
+ // imtype typemap attributechecks
+ //
+ // Global function imtype typemap attributes check
+ Type imclasstype = typeof(csharp_attributesPINVOKE);
+ {
+ MethodInfo member = (MethodInfo)imclasstype.GetMember("GlobalFunction")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(IntegerOutAttribute)) == null)
+ throw new Exception("No IntegerOut attribute for " + member.Name);
+ ParameterInfo parameter = member.GetParameters()[0]; // checking 1st parameter
+ Attribute attribute = Attribute.GetCustomAttributes(parameter)[0];
+ if (attribute.GetType() != typeof(IntegerInAttribute))
+ throw new Exception("Expecting IntegerIn attribute");
+ }
+ // Constant - imtype typemap attributes check
+ {
+ MethodInfo member = (MethodInfo)imclasstype.GetMember("TESTMACRO_get")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(IntegerOutAttribute)) == null)
+ throw new Exception("No IntegerOut attribute for " + member.Name);
+ }
+ // Non-static method imtype typemap attributes check
+ {
+ MethodInfo member = (MethodInfo)imclasstype.GetMember("Stations_Reading")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(IntegerOutAttribute)) == null)
+ throw new Exception("No IntegerOut attribute for " + member.Name);
+ ParameterInfo parameter = member.GetParameters()[1]; // checking 2nd parameter
+ Attribute attribute = Attribute.GetCustomAttributes(parameter)[0];
+ if (attribute.GetType() != typeof(IntegerInAttribute))
+ throw new Exception("Expecting IntegerIn attribute");
+ }
+ // Static method imtype typemap attributes check
+ {
+ MethodInfo member = (MethodInfo)imclasstype.GetMember("Stations_Swindon")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(IntegerOutAttribute)) == null)
+ throw new Exception("No IntegerOut attribute for " + member.Name);
+ ParameterInfo parameter = member.GetParameters()[0]; // checking 1st parameter
+ Attribute attribute = Attribute.GetCustomAttributes(parameter)[0];
+ if (attribute.GetType() != typeof(IntegerInAttribute))
+ throw new Exception("Expecting IntegerIn attribute");
+ }
+
+ //
+ // attributes feature
+ //
+ Type moretype = typeof(MoreStations);
+
+ // Constructor attributes feature check
+ {
+ ConstructorInfo member = (ConstructorInfo)moretype.GetConstructors()[0];
+ if (Attribute.GetCustomAttribute(member, typeof(InterCity1Attribute)) == null)
+ throw new Exception("MoreStations::MoreStations attribute failed");
+ }
+ // Non-static method attributes feature check
+ {
+ MethodInfo member = (MethodInfo)moretype.GetMember("Chippenham")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(InterCity2Attribute)) == null)
+ throw new Exception("MoreStations::Chippenham attribute failed");
+ }
+ // Static method attributes feature check
+ {
+ MethodInfo member = (MethodInfo)moretype.GetMember("Bath")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(InterCity3Attribute)) == null)
+ throw new Exception("MoreStations::Bath attribute failed");
+ }
+ // Non-static member variable attributes feature check
+ {
+ PropertyInfo member = (PropertyInfo)moretype.GetProperty("Bristol");
+ if (Attribute.GetCustomAttribute(member, typeof(InterCity4Attribute)) == null)
+ throw new Exception("MoreStations::Bristol attribute failed");
+ }
+ // Static member variable attributes feature check
+ {
+ PropertyInfo member = (PropertyInfo)moretype.GetProperty("WestonSuperMare");
+ if (Attribute.GetCustomAttribute(member, typeof(InterCity5Attribute)) == null)
+ throw new Exception("MoreStations::Bristol attribute failed");
+ }
+ // Global function attributes feature check
+ {
+ MethodInfo member = (MethodInfo)globaltype.GetMember("Paddington")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(InterCity7Attribute)) == null)
+ throw new Exception("MoreStations::Paddington attribute failed");
+ }
+ // Global variables attributes feature check
+ {
+ PropertyInfo member = (PropertyInfo)globaltype.GetProperty("DidcotParkway");
+ if (Attribute.GetCustomAttribute(member, typeof(InterCity8Attribute)) == null)
+ throw new Exception("MoreStations::Paddington attribute failed");
+ }
+
+ //
+ // csattribute typemaps
+ //
+ // Class csattribute typemap
+ {
+ Object[] attribs = moretype.GetCustomAttributes(true);
+ Eurostar1Attribute tgv = (Eurostar1Attribute)attribs[0];
+ if (tgv == null)
+ throw new Exception("No attribute for MoreStations");
+ }
+ // Nested enum csattribute typemap
+ {
+ MemberInfo member = (MemberInfo)moretype.GetMember("Wales")[0];
+ if (Attribute.GetCustomAttribute(member, typeof(Eurostar2Attribute)) == null)
+ throw new Exception("No attribute for " + member.Name);
+ }
+ // Enum value attributes
+ Type walesType = typeof(MoreStations.Wales);
+ {
+ MemberInfo member = (MemberInfo)walesType.GetMember("Cardiff")[0];
+ DescriptionAttribute attribute = (DescriptionAttribute)Attribute.GetCustomAttribute(member, typeof(System.ComponentModel.DescriptionAttribute));
+ if (attribute == null)
+ throw new Exception("No attribute for " + member.Name);
+ if (attribute.Description != "Cardiff city station")
+ throw new Exception("Incorrect attribute value for " + member.Name);
+ }
+ {
+ MemberInfo member = (MemberInfo)walesType.GetMember("Swansea")[0];
+ DescriptionAttribute attribute = (DescriptionAttribute)Attribute.GetCustomAttribute(member, typeof(System.ComponentModel.DescriptionAttribute));
+ if (attribute == null)
+ throw new Exception("No attribute for " + member.Name);
+ if (attribute.Description != "Swansea city station")
+ throw new Exception("Incorrect attribute value for " + member.Name);
+ }
+ // Enum csattribute typemap
+ {
+ Type cymrutype = typeof(Cymru);
+ Object[] attribs = cymrutype.GetCustomAttributes(true);
+ Eurostar3Attribute tgv = (Eurostar3Attribute)attribs[0];
+ if (tgv == null)
+ throw new Exception("No attribute for Cymru");
+ }
+
+ // No runtime test for directorinattributes and directoroutattributes
+ }
+}
+
+// Custom attribute classes
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class IntInAttribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class IntOutAttribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class IntegerInAttribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class IntegerOutAttribute : Attribute {}
+
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class InterCity1Attribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class InterCity2Attribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class InterCity3Attribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class InterCity4Attribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class InterCity5Attribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class InterCity6Attribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class InterCity7Attribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class InterCity8Attribute : Attribute {}
+
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class Eurostar1Attribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class Eurostar2Attribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class Eurostar3Attribute : Attribute {}
+
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class ThreadSafeAttribute : Attribute {
+ public ThreadSafeAttribute(bool safe) {}
+ public ThreadSafeAttribute() {}
+}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class DirectorIntegerOutAttribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class DirectorIntegerInAttribute : Attribute {}
+
diff --git a/trunk/Examples/test-suite/csharp/csharp_exceptions_runme.cs b/trunk/Examples/test-suite/csharp/csharp_exceptions_runme.cs
new file mode 100644
index 000000000..43585b106
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/csharp_exceptions_runme.cs
@@ -0,0 +1,342 @@
+using System;
+using System.Threading;
+using csharp_exceptionsNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ // %exception tests
+ try {
+ csharp_exceptions.ThrowByValue();
+ throw new Exception("ThrowByValue not working");
+ } catch (DivideByZeroException) {
+ }
+ try {
+ csharp_exceptions.ThrowByReference();
+ throw new Exception("ThrowByReference not working");
+ } catch (DivideByZeroException) {
+ }
+
+ // %csnothrowexception
+ csharp_exceptions.NoThrowException();
+ csharp_exceptions.NullReference(new Ex("should not throw"));
+
+ // exception specifications
+ bool testFailed = false;
+ try {
+ csharp_exceptions.ExceptionSpecificationValue();
+ testFailed = true;
+ } catch (ApplicationException) {
+ }
+ if (testFailed) throw new Exception("ExceptionSpecificationValue not working");
+ try {
+ csharp_exceptions.ExceptionSpecificationReference();
+ testFailed = true;
+ } catch (ApplicationException) {
+ }
+ if (testFailed) throw new Exception("ExceptionSpecificationReference not working");
+ try {
+ csharp_exceptions.ExceptionSpecificationString();
+ testFailed = true;
+ } catch (ApplicationException e) {
+ if (e.Message != "ExceptionSpecificationString") throw new Exception("ExceptionSpecificationString unexpected message: " + e.Message);
+ }
+ if (testFailed) throw new Exception("ExceptionSpecificationString not working");
+ try {
+ csharp_exceptions.ExceptionSpecificationInteger();
+ testFailed = true;
+ } catch (ApplicationException) {
+ }
+ if (testFailed) throw new Exception("ExceptionSpecificationInteger not working");
+
+ // null reference exceptions
+ try {
+ csharp_exceptions.NullReference(null);
+ throw new Exception("NullReference not working");
+ } catch (ArgumentNullException) {
+ }
+ try {
+ csharp_exceptions.NullValue(null);
+ throw new Exception("NullValue not working");
+ } catch (ArgumentNullException) {
+ }
+
+ // enums
+ try {
+ csharp_exceptions.ExceptionSpecificationEnumValue();
+ testFailed = true;
+ } catch (ApplicationException) {
+ }
+ if (testFailed) throw new Exception("ExceptionSpecificationEnumValue not working");
+ try {
+ csharp_exceptions.ExceptionSpecificationEnumReference();
+ testFailed = true;
+ } catch (ApplicationException) {
+ }
+ if (testFailed) throw new Exception("ExceptionSpecificationEnumReference not working");
+
+ // std::string
+ try {
+ csharp_exceptions.NullStdStringValue(null);
+ throw new Exception("NullStdStringValue not working");
+ } catch (ArgumentNullException) {
+ }
+ try {
+ csharp_exceptions.NullStdStringReference(null);
+ throw new Exception("NullStdStringReference not working");
+ } catch (ArgumentNullException) {
+ }
+ try {
+ csharp_exceptions.ExceptionSpecificationStdStringValue();
+ testFailed = true;
+ } catch (ApplicationException e) {
+ if (e.Message != "ExceptionSpecificationStdStringValue") throw new Exception("ExceptionSpecificationStdStringValue unexpected message: " + e.Message);
+ }
+ if (testFailed) throw new Exception("ExceptionSpecificationStdStringValue not working");
+ try {
+ csharp_exceptions.ExceptionSpecificationStdStringReference();
+ testFailed = true;
+ } catch (ApplicationException e) {
+ if (e.Message != "ExceptionSpecificationStdStringReference") throw new Exception("ExceptionSpecificationStdStringReference unexpected message: " + e.Message);
+ }
+ if (testFailed) throw new Exception("ExceptionSpecificationStdStringReference not working");
+
+ // Memory leak check (The C++ exception stack was never unwound in the original approach to throwing exceptions from unmanaged code)
+ try {
+ csharp_exceptions.MemoryLeakCheck();
+ throw new Exception("MemoryLeakCheck not working");
+ } catch (DivideByZeroException) {
+ }
+ if (Counter.count != 0) throw new Exception("Memory leaks when throwing exception. count: " + Counter.count);
+
+ // test exception pending in the csconstruct typemap
+ try {
+ new constructor(null);
+ throw new Exception("constructor 1 not working");
+ } catch (ArgumentNullException) {
+ }
+ try {
+ new constructor();
+ throw new Exception("constructor 2 not working");
+ } catch (ApplicationException) {
+ }
+
+ // test exception pending in the csout typemaps
+ try {
+ csharp_exceptions.ushorttest();
+ throw new Exception("csout not working");
+ } catch (IndexOutOfRangeException) {
+ }
+
+ // test exception pending in the csvarout/csvarin typemaps and canthrow attribute in unmanaged code typemaps (1) global variables
+ // 1) global variables
+ int numberout = 0;
+ try {
+ csharp_exceptions.numberin = -1;
+ throw new Exception("global csvarin not working");
+ } catch (IndexOutOfRangeException) {
+ }
+ csharp_exceptions.numberin = 5;
+ if (csharp_exceptions.numberin != 5)
+ throw new Exception("global numberin not 5");
+ csharp_exceptions.numberout = 20;
+ try {
+ numberout += csharp_exceptions.numberout;
+ throw new Exception("global csvarout not working");
+ } catch (IndexOutOfRangeException) {
+ }
+ // 2) static member variables
+ try {
+ InOutStruct.staticnumberin = -1;
+ throw new Exception("static csvarin not working");
+ } catch (IndexOutOfRangeException) {
+ }
+ InOutStruct.staticnumberin = 5;
+ if (InOutStruct.staticnumberin != 5)
+ throw new Exception("static staticnumberin not 5");
+ InOutStruct.staticnumberout = 20;
+ try {
+ numberout += InOutStruct.staticnumberout;
+ throw new Exception("static csvarout not working");
+ } catch (IndexOutOfRangeException) {
+ }
+ // 3) member variables
+ InOutStruct io = new InOutStruct();
+ try {
+ io.numberin = -1;
+ throw new Exception("member csvarin not working");
+ } catch (IndexOutOfRangeException) {
+ }
+ io.numberin = 5;
+ if (io.numberin != 5)
+ throw new Exception("member numberin not 5");
+ io.numberout = 20;
+ try {
+ numberout += io.numberout;
+ throw new Exception("member csvarout not working");
+ } catch (IndexOutOfRangeException) {
+ }
+ // test SWIG_exception macro - it must return from unmanaged code without executing any further unmanaged code
+ try {
+ csharp_exceptions.exceptionmacrotest(-1);
+ throw new Exception("exception macro not working");
+ } catch (IndexOutOfRangeException) {
+ }
+ if (csharp_exceptions.exception_macro_run_flag)
+ throw new Exception("exceptionmacrotest was executed");
+
+ // test all the types of exceptions
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedApplicationException);
+ throw new Exception("ApplicationException not caught");
+ } catch (ApplicationException e) {
+ if (e.Message != "msg") throw new Exception("ApplicationException msg incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedArithmeticException);
+ throw new Exception("ArithmeticException not caught");
+ } catch (ArithmeticException e) {
+ if (e.Message != "msg") throw new Exception("ArithmeticException msg incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedDivideByZeroException);
+ throw new Exception("DivideByZeroException not caught");
+ } catch (DivideByZeroException e) {
+ if (e.Message != "msg") throw new Exception("DivideByZeroException msg incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedIndexOutOfRangeException);
+ throw new Exception("IndexOutOfRangeException not caught");
+ } catch (IndexOutOfRangeException e) {
+ if (e.Message != "msg") throw new Exception("IndexOutOfRangeException msg incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedInvalidOperationException);
+ throw new Exception("InvalidOperationException not caught");
+ } catch (InvalidOperationException e) {
+ if (e.Message != "msg") throw new Exception("InvalidOperationException msg incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedIOException);
+ throw new Exception("IOException not caught");
+ } catch (System.IO.IOException e) {
+ if (e.Message != "msg") throw new Exception("IOException msg incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedNullReferenceException);
+ throw new Exception("NullReferenceException not caught");
+ } catch (NullReferenceException e) {
+ if (e.Message != "msg") throw new Exception("NullReferenceException msg incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedOutOfMemoryException);
+ throw new Exception("OutOfMemoryException not caught");
+ } catch (OutOfMemoryException e) {
+ if (e.Message != "msg") throw new Exception("OutOfMemoryException msg incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedOverflowException);
+ throw new Exception("OverflowException not caught");
+ } catch (OverflowException e) {
+ if (e.Message != "msg") throw new Exception("OverflowException msg incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedSystemException);
+ throw new Exception("SystemException not caught");
+ } catch (SystemException e) {
+ if (e.Message != "msg") throw new Exception("SystemException msg incorrect");
+ }
+
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedArgumentException);
+ throw new Exception("ArgumentException not caught");
+ } catch (ArgumentException e) {
+ if (e.Message.Replace(CRLF,"\n") != "msg\nParameter name: parm") throw new Exception("ArgumentException msg incorrect");
+ if (e.ParamName != "parm") throw new Exception("ArgumentException parm incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedArgumentNullException);
+ throw new Exception("ArgumentNullException not caught");
+ } catch (ArgumentNullException e) {
+ if (e.Message.Replace(CRLF,"\n") != "msg\nParameter name: parm") throw new Exception("ArgumentNullException msg incorrect");
+ if (e.ParamName != "parm") throw new Exception("ArgumentNullException parm incorrect");
+ }
+ try {
+ csharp_exceptions.check_exception(UnmanagedExceptions.UnmanagedArgumentOutOfRangeException);
+ throw new Exception("ArgumentOutOfRangeException not caught");
+ } catch (ArgumentOutOfRangeException e) {
+ if (e.Message.Replace(CRLF,"\n") != "msg\nParameter name: parm") throw new Exception("ArgumentOutOfRangeException msg incorrect");
+ if (e.ParamName != "parm") throw new Exception("ArgumentOutOfRangeException parm incorrect");
+ }
+
+
+ // exceptions in multiple threads test
+ {
+ ThrowsClass throwsClass = new ThrowsClass(1234.5678);
+ const int NUM_THREADS = 8;
+ Thread[] threads = new Thread[NUM_THREADS];
+ TestThread[] testThreads = new TestThread[NUM_THREADS];
+ // invoke the threads
+ for (int i=0; i<NUM_THREADS; i++) {
+ testThreads[i] = new TestThread(throwsClass, i);
+ threads[i] = new Thread(new ThreadStart(testThreads[i].Run));
+ threads[i].Start();
+ }
+ // wait for the threads to finish
+ for (int i=0; i<NUM_THREADS; i++) {
+ threads[i].Join();
+ }
+ for (int i=0; i<NUM_THREADS; i++) {
+ if (testThreads[i].Failed) throw new Exception("Test Failed");
+ }
+ }
+
+
+ // test inner exceptions
+ try {
+ csharp_exceptions.InnerExceptionTest();
+ throw new Exception("InnerExceptionTest exception not caught");
+ } catch (InvalidOperationException e) {
+ if (e.Message != "My OuterException message") throw new Exception("OuterException msg incorrect");
+ if (e.InnerException.Message != "My InnerException message") throw new Exception("InnerException msg incorrect");
+ }
+ }
+ public static string CRLF = "\r\n"; // Some CLR implementations use a CRLF instead of just CR
+}
+
+public class TestThread {
+ private int threadId;
+ private ThrowsClass throwsClass;
+ public bool Failed;
+ public TestThread(ThrowsClass t, int id) {
+ throwsClass = t;
+ threadId = id;
+ }
+ public void Run() {
+ Failed = false;
+ try {
+ for (int i=0; i<6000; i++) { // run test for about 10 seconds on a 1GHz machine (Mono)
+ try {
+ throwsClass.ThrowException(i);
+ throw new Exception("No exception thrown");
+ } catch (ArgumentOutOfRangeException e) {
+ String expectedMessage = "caught:" + i + "\n" + "Parameter name: input";
+ if (e.Message.Replace(runme.CRLF,"\n") != expectedMessage)
+ throw new Exception("Exception message incorrect. Expected:\n[" + expectedMessage + "]\n" + "Received:\n[" + e.Message + "]");
+ if (e.ParamName != "input")
+ throw new Exception("Exception ParamName incorrect. Expected:\n[input]\n" + "Received:\n[" + e.ParamName + "]");
+ if (e.InnerException != null)
+ throw new Exception("Unexpected inner exception");
+ }
+ if (throwsClass.dub != 1234.5678) // simple check which attempts to catch memory corruption
+ throw new Exception("throwsException.dub = " + throwsClass.dub + " expected: 1234.5678");
+ }
+ } catch (Exception e) {
+ Console.Error.WriteLine("Test failed (thread " + threadId + "): " + e.Message);
+ Failed = true;
+ }
+ }
+}
+
+
diff --git a/trunk/Examples/test-suite/csharp/csharp_lib_arrays_runme.cs b/trunk/Examples/test-suite/csharp/csharp_lib_arrays_runme.cs
new file mode 100644
index 000000000..9f3ea6b88
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/csharp_lib_arrays_runme.cs
@@ -0,0 +1,70 @@
+using System;
+using csharp_lib_arraysNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ {
+ int[] source = { 1, 2, 3, 4, 5 };
+ int[] target = new int[ source.Length ];
+
+ csharp_lib_arrays.myArrayCopy( source, target, target.Length );
+ CompareArrays(source, target);
+ }
+
+ {
+ int[] source = { 1, 2, 3, 4, 5 };
+ int[] target = new int[ source.Length ];
+
+ csharp_lib_arrays.myArrayCopyUsingFixedArrays( source, target, target.Length );
+ CompareArrays(source, target);
+ }
+
+ {
+ int[] source = { 1, 2, 3, 4, 5 };
+ int[] target = new int[] { 6, 7, 8, 9, 10 };
+
+ csharp_lib_arrays.myArraySwap( source, target, target.Length );
+
+ for (int i=0; i<target.Length; ++i)
+ target[i] += 5;
+ CompareArrays(source, target);
+ }
+
+ {
+ int[] source = { 1, 2, 3, 4, 5 };
+ int[] target = new int[] { 6, 7, 8, 9, 10 };
+
+ csharp_lib_arrays.myArraySwapUsingFixedArrays( source, target, target.Length );
+
+ for (int i=0; i<target.Length; ++i)
+ target[i] += 5;
+ CompareArrays(source, target);
+ }
+ }
+
+ static void CompareArrays( int[] a, int[] b )
+ {
+ if (a.Length != b.Length)
+ throw new Exception("size mismatch");
+
+ for(int i=0; i<a.Length; ++i) {
+ if (a[i] != b[i]) {
+ Console.Error.WriteLine("a:");
+ PrintArray(a);
+ Console.Error.WriteLine("b:");
+ PrintArray(b);
+ throw new Exception("element mismatch");
+ }
+ }
+ }
+
+ static void PrintArray( int[] a )
+ {
+ foreach ( int i in a )
+ Console.Error.Write( "{0} ", i );
+ Console.Error.WriteLine();
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/csharp_prepost_runme.cs b/trunk/Examples/test-suite/csharp/csharp_prepost_runme.cs
new file mode 100644
index 000000000..d0bacdaba
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/csharp_prepost_runme.cs
@@ -0,0 +1,70 @@
+
+using System;
+using System.Reflection;
+using csharp_prepostNamespace;
+
+public class csharp_prepost_runme {
+
+ public static void Main() {
+ {
+ double[] v;
+ csharp_prepost.globalfunction(out v);
+ Assert(v.Length, 3);
+ Assert(v[0], 0.0);
+ Assert(v[1], 1.1);
+ Assert(v[2], 2.2);
+ }
+ {
+ double[] v;
+ new PrePostTest(out v);
+ Assert(v.Length, 2);
+ Assert(v[0], 3.3);
+ Assert(v[1], 4.4);
+ }
+ {
+ double[] v;
+ PrePostTest p = new PrePostTest();
+ p.method(out v);
+ Assert(v.Length, 2);
+ Assert(v[0], 5.5);
+ Assert(v[1], 6.6);
+ }
+ {
+ double[] v;
+ PrePostTest.staticmethod(out v);
+ Assert(v.Length, 2);
+ Assert(v[0], 7.7);
+ Assert(v[1], 8.8);
+ }
+
+ // Check attributes are generated for the constructor helper function
+ {
+ CsinAttributes c = new CsinAttributes(5);
+ Assert(c.getVal(), 500);
+
+ Type type = typeof(CsinAttributes);
+ {
+ MethodInfo member = (MethodInfo)type.GetMember("SwigConstructCsinAttributes", BindingFlags.NonPublic | BindingFlags.Static)[0];
+ if (Attribute.GetCustomAttribute(member, typeof(CustomIntPtrAttribute)) == null)
+ throw new Exception("No CustomIntPtr attribute for " + member.Name);
+ ParameterInfo parameter = member.GetParameters()[0]; // expecting one parameter
+ if (parameter.Name != "val")
+ throw new Exception("Incorrect parameter name");
+ Attribute attribute = Attribute.GetCustomAttributes(parameter)[0];
+ if (attribute.GetType() != typeof(CustomIntAttribute))
+ throw new Exception("Expecting CustomInt attribute");
+ }
+ }
+ }
+ private static void Assert(double d1, double d2) {
+ if (d1 != d2)
+ throw new Exception("assertion failure. " + d1 + " != " + d2);
+ }
+}
+
+// Custom attribute classes
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class CustomIntAttribute : Attribute {}
+
+[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+public class CustomIntPtrAttribute : Attribute {}
diff --git a/trunk/Examples/test-suite/csharp/csharp_typemaps_runme.cs b/trunk/Examples/test-suite/csharp/csharp_typemaps_runme.cs
new file mode 100644
index 000000000..846644f09
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/csharp_typemaps_runme.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Threading;
+using csharp_typemapsNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ // Test the C# types customisation by modifying the default char * typemaps to return a single char
+ Things things = new Things();
+ System.Text.StringBuilder initialLetters = new System.Text.StringBuilder();
+ char myChar = things.start("boo");
+ initialLetters.Append(myChar);
+ myChar = Things.stop("hiss");
+ initialLetters.Append(myChar);
+ myChar = csharp_typemaps.partyon("off");
+ initialLetters.Append(myChar);
+ if (initialLetters.ToString() != "bho")
+ throw new Exception("initial letters failed");
+
+ // $csinput expansion
+ csharp_typemaps.myInt = 1;
+ try {
+ csharp_typemaps.myInt = -1;
+ throw new Exception("oops");
+ } catch (ApplicationException) {
+ }
+
+ // Eager garbage collector test
+ {
+ const int NUM_THREADS = 8;
+ Thread[] threads = new Thread[NUM_THREADS];
+ TestThread[] testThreads = new TestThread[NUM_THREADS];
+ // invoke the threads
+ for (int i=0; i<NUM_THREADS; i++) {
+ testThreads[i] = new TestThread(i);
+ threads[i] = new Thread(new ThreadStart(testThreads[i].Run));
+ threads[i].Start();
+ }
+ // wait for the threads to finish
+ for (int i=0; i<NUM_THREADS; i++) {
+ threads[i].Join();
+ }
+ for (int i=0; i<NUM_THREADS; i++) {
+ if (testThreads[i].Failed) throw new Exception("Test Failed");
+ }
+ }
+
+ }
+}
+
+
+public class TestThread {
+ private int threadId;
+ public bool Failed;
+ public TestThread(int id) {
+ threadId = id;
+ }
+ public void Run() {
+ Failed = false;
+ try {
+ // Older versions of SWIG used IntPtr instead of HandleRef to hold the underlying
+ // C++ pointer, so this test would (usually) fail as the garbage collector would
+ // sometimes collect the Number class while it was being used in unmanaged code
+ for (int i=0; i<5000; i++) { // run test for a few seconds
+ {
+ Obj obj = new Obj();
+ Number n = new Number(i);
+ Number triple = obj.triple(n);
+ if (triple.Value != i*3)
+ throw new ApplicationException("triple failed: " + triple.Value);
+ }
+ {
+ Obj obj = new Obj();
+ Number n = new Number(i);
+ Number times6 = obj.times6(n);
+ if (times6.Value != i*6)
+ throw new ApplicationException("times6 failed: " + times6.Value);
+ }
+ {
+ Obj obj = new Obj();
+ Number n = new Number(i);
+ Number times9 = obj.times9(n);
+ if (times9.Value != i*9)
+ throw new ApplicationException("times9 failed: " + times9.Value);
+ }
+ {
+ Number n = new Number(i);
+ Number quadruple = csharp_typemaps.quadruple(n);
+ if (quadruple.Value != i*4)
+ throw new ApplicationException("quadruple failed: " + quadruple.Value);
+ }
+ {
+ Number n = new Number(i);
+ Number times8 = csharp_typemaps.times8(n);
+ if (times8.Value != i*8)
+ throw new ApplicationException("times8 failed: " + times8.Value);
+ }
+ {
+ Number n = new Number(i);
+ Number times12 = csharp_typemaps.times12(n);
+ if (times12.Value != i*12)
+ throw new ApplicationException("times12 failed: " + times12.Value);
+ }
+ }
+ } catch (Exception e) {
+ Console.Error.WriteLine("Test failed (thread " + threadId + "): " + e.Message);
+ Failed = true;
+ }
+ }
+}
+
+
diff --git a/trunk/Examples/test-suite/csharp/default_args_runme.cs b/trunk/Examples/test-suite/csharp/default_args_runme.cs
new file mode 100644
index 000000000..68ea0e854
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/default_args_runme.cs
@@ -0,0 +1,143 @@
+using System;
+using default_argsNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ if (default_args.anonymous() != 7771)
+ throw new Exception("anonymous (1) failed");
+ if (default_args.anonymous(1234) != 1234)
+ throw new Exception("anonymous (2) failed");
+
+ if (default_args.booltest() != true)
+ throw new Exception("booltest (1) failed");
+ if (default_args.booltest(true) != true)
+ throw new Exception("booltest (2) failed");
+ if (default_args.booltest(false) != false)
+ throw new Exception("booltest (3) failed");
+
+ EnumClass ec = new EnumClass();
+ if (ec.blah() != true)
+ throw new Exception("EnumClass failed");
+
+ if (default_args.casts1() != null)
+ throw new Exception("casts1 failed");
+
+ if (default_args.casts2() != "Hello")
+ throw new Exception("casts2 failed");
+
+ if (default_args.casts1("Ciao") != "Ciao")
+ throw new Exception("casts1 not default failed");
+
+ if (default_args.chartest1() != 'x')
+ throw new Exception("chartest1 failed");
+
+ if (default_args.chartest2() != '\0')
+ throw new Exception("chartest2 failed");
+
+ if (default_args.chartest1('y') != 'y')
+ throw new Exception("chartest1 not default failed");
+
+ if (default_args.chartest1('y') != 'y')
+ throw new Exception("chartest1 not default failed");
+
+ if (default_args.reftest1() != 42)
+ throw new Exception("reftest1 failed");
+
+ if (default_args.reftest1(400) != 400)
+ throw new Exception("reftest1 not default failed");
+
+ if (default_args.reftest2() != "hello")
+ throw new Exception("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 Exception("exceptionspec 1 failed");
+ } catch (Exception) {
+ }
+ try {
+ default_args.exceptionspec(-1);
+ throw new Exception("exceptionspec 2 failed");
+ } catch (Exception) {
+ }
+ try {
+ default_args.exceptionspec(100);
+ throw new Exception("exceptionspec 3 failed");
+ } catch (Exception) {
+ }
+ Except ex = new Except(false);
+ try {
+ ex.exspec();
+ throw new Exception("exspec 1 failed");
+ } catch (Exception) {
+ }
+ try {
+ ex.exspec(-1);
+ throw new Exception("exspec 2 failed");
+ } catch (Exception) {
+ }
+ try {
+ ex.exspec(100);
+ throw new Exception("exspec 3 failed");
+ } catch (Exception) {
+ }
+ try {
+ ex = new Except(true);
+ throw new Exception("Except constructor 1 failed");
+ } catch (Exception) {
+ }
+ try {
+ ex = new Except(true, -2);
+ throw new Exception("Except constructor 2 failed");
+ } catch (Exception) {
+ }
+
+ // Default parameters in static class methods
+ if (Statics.staticmethod() != 10+20+30)
+ throw new Exception("staticmethod 1 failed");
+ if (Statics.staticmethod(100) != 100+20+30)
+ throw new Exception("staticmethod 2 failed");
+ if (Statics.staticmethod(100,200,300) != 100+200+300)
+ throw new Exception("staticmethod 3 failed");
+
+
+ Tricky tricky = new Tricky();
+ if (tricky.privatedefault() != 200)
+ throw new Exception("privatedefault failed");
+ if (tricky.protectedint() != 2000)
+ throw new Exception("protectedint failed");
+ if (tricky.protecteddouble() != 987.654)
+ throw new Exception("protecteddouble failed");
+ if (tricky.functiondefault() != 500)
+ throw new Exception("functiondefault failed");
+ if (tricky.contrived() != 'X')
+ throw new Exception("contrived failed");
+
+ if (default_args.constructorcall().val != -1)
+ throw new Exception("constructorcall test 1 failed");
+
+ if (default_args.constructorcall(new Klass(2222)).val != 2222)
+ throw new Exception("constructorcall test 2 failed");
+
+ if (default_args.constructorcall(new Klass()).val != -1)
+ throw new Exception("constructorcall test 3 failed");
+
+ // const methods
+ ConstMethods cm = new ConstMethods();
+ if (cm.coo() != 20)
+ throw new Exception("coo test 1 failed");
+ if (cm.coo(1.0) != 20)
+ throw new Exception("coo test 2 failed");
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/default_constructor_runme.cs b/trunk/Examples/test-suite/csharp/default_constructor_runme.cs
new file mode 100644
index 000000000..acd62dc3d
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/default_constructor_runme.cs
@@ -0,0 +1,24 @@
+using System;
+using default_constructorNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ // calling protected destructor test
+ try {
+ using (G g = new G()) {
+ }
+ throw new Exception("Protected destructor exception should have been thrown");
+ } catch (MethodAccessException) {
+ }
+
+ // calling private destructor test
+ try {
+ using (FFF f = new FFF()) {
+ }
+ throw new Exception("Private destructor exception should have been thrown");
+ } catch (MethodAccessException) {
+ }
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/director_basic_runme.cs b/trunk/Examples/test-suite/csharp/director_basic_runme.cs
new file mode 100644
index 000000000..b9916108c
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/director_basic_runme.cs
@@ -0,0 +1,74 @@
+using System;
+
+namespace director_basicNamespace {
+
+public class runme
+{
+ static void Main()
+ {
+ runme r = new runme();
+ r.run();
+ }
+
+ void run()
+ {
+ director_basic_MyFoo a = new director_basic_MyFoo();
+
+ if (a.ping() != "director_basic_MyFoo::ping()") {
+ throw new Exception ( "a.ping()" );
+ }
+
+ if (a.pong() != "Foo::pong();director_basic_MyFoo::ping()") {
+ throw new Exception ( "a.pong()" );
+ }
+
+ Foo b = new Foo();
+
+ if (b.ping() != "Foo::ping()") {
+ throw new Exception ( "b.ping()" );
+ }
+
+ if (b.pong() != "Foo::pong();Foo::ping()") {
+ throw new Exception ( "b.pong()" );
+ }
+
+ A1 a1 = new A1(1, false);
+ a1.Dispose();
+
+ {
+ MyOverriddenClass my = new MyOverriddenClass();
+
+ my.expectNull = true;
+ if (MyClass.call_pmethod(my, null) != null)
+ throw new Exception("null pointer marshalling problem");
+
+ Bar myBar = new Bar();
+ my.expectNull = false;
+ Bar myNewBar = MyClass.call_pmethod(my, myBar);
+ if (myNewBar == null)
+ throw new Exception("non-null pointer marshalling problem");
+ myNewBar.x = 10;
+ }
+ }
+}
+
+class director_basic_MyFoo : Foo {
+ public director_basic_MyFoo() : base() {
+ }
+
+ public override string ping() {
+ return "director_basic_MyFoo::ping()";
+ }
+}
+
+class MyOverriddenClass : MyClass {
+ public bool expectNull = false;
+ public bool nonNullReceived = false;
+ public override Bar pmethod(Bar b) {
+ if ( expectNull && (b != null) )
+ throw new Exception("null not received as expected");
+ return b;
+ }
+}
+
+}
diff --git a/trunk/Examples/test-suite/csharp/director_classes_runme.cs b/trunk/Examples/test-suite/csharp/director_classes_runme.cs
new file mode 100644
index 000000000..112561464
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/director_classes_runme.cs
@@ -0,0 +1,180 @@
+/*
+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 C# methods, see DefaultParms method.
+
+Expected output if PrintDebug enabled:
+------------ Start ------------
+Base - Val(444.555)
+Base - Ref(444.555)
+Base - Ptr(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 - 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)
+--------------------------------
+CSharpDerived - Val(444.555)
+CSharpDerived - Ref(444.555)
+CSharpDerived - Ptr(444.555)
+CSharpDerived - FullyOverloaded(int 10)
+CSharpDerived - FullyOverloaded(bool True)
+CSharpDerived - SemiOverloaded(-678)
+Base - SemiOverloaded(bool 1)
+CSharpDerived - DefaultParms(10, 2.2)
+CSharpDerived - DefaultParms(10, 1.1)
+------------ Finish ------------
+*/
+
+using System;
+
+namespace director_classesNamespace {
+
+public class runme
+{
+ static void Main()
+ {
+ runme r = new runme();
+ r.run();
+ }
+
+ void run()
+ {
+ if (director_classes.PrintDebug) Console.WriteLine("------------ Start ------------ ");
+
+ Caller myCaller = new Caller();
+
+ // test C++ base class
+ using (Base myBase = new Base(100.0))
+ {
+ makeCalls(myCaller, myBase);
+ }
+
+ if (director_classes.PrintDebug) Console.WriteLine("--------------------------------");
+
+ // test vanilla C++ wrapped derived class
+ using (Base myBase = new Derived(200.0))
+ {
+ makeCalls(myCaller, myBase);
+ }
+
+ if (director_classes.PrintDebug) Console.WriteLine("--------------------------------");
+
+ // test director / C# derived class
+ using (Base myBase = new CSharpDerived(300.0))
+ {
+ makeCalls(myCaller, myBase);
+ }
+
+ if (director_classes.PrintDebug) Console.WriteLine("------------ Finish ------------ ");
+ }
+
+ void makeCalls(Caller myCaller, Base myBase)
+ {
+ string NAMESPACE = "director_classesNamespace.";
+ myCaller.set(myBase);
+
+ DoubleHolder dh = new DoubleHolder(444.555);
+
+ // Class pointer, reference and pass by value tests
+ if (myCaller.ValCall(dh).val != dh.val) throw new Exception("failed");
+ if (myCaller.RefCall(dh).val != dh.val) throw new Exception("failed");
+ if (myCaller.PtrCall(dh).val != dh.val) throw new Exception("failed");
+
+ // Fully overloaded method test (all methods in base class are overloaded)
+ if (NAMESPACE + myCaller.FullyOverloadedCall(10) != myBase.GetType() + "::FullyOverloaded(int)") throw new Exception("failed");
+ if (NAMESPACE + myCaller.FullyOverloadedCall(true) != myBase.GetType() + "::FullyOverloaded(bool)") throw new Exception("failed");
+
+ // Semi overloaded method test (some methods in base class are overloaded)
+ if (NAMESPACE + myCaller.SemiOverloadedCall(-678) != myBase.GetType() + "::SemiOverloaded(int)") throw new Exception("failed");
+ if (myCaller.SemiOverloadedCall(true) != "Base" + "::SemiOverloaded(bool)") throw new Exception("failed");
+
+ // Default parameters methods test
+ if (NAMESPACE + myCaller.DefaultParmsCall(10, 2.2) != myBase.GetType() + "::DefaultParms(int, double)") throw new Exception("failed");
+ if (myBase.GetType() == typeof(CSharpDerived)) { // special handling for C# derived classes, there is no way to do this any other way
+ if (NAMESPACE + myCaller.DefaultParmsCall(10) != myBase.GetType() + "::DefaultParms(int, double)") throw new Exception("failed");
+ } else {
+ if (NAMESPACE + myCaller.DefaultParmsCall(10) != myBase.GetType() + "::DefaultParms(int)") throw new Exception("failed");
+ }
+
+ myCaller.reset();
+ }
+}
+
+public class CSharpDerived : Base
+{
+ public CSharpDerived(double dd)
+ : base(dd)
+ {
+ }
+
+ public override DoubleHolder Val(DoubleHolder x)
+ {
+ if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - Val({0})", x.val);
+ return x;
+ }
+ public override DoubleHolder Ref(DoubleHolder x)
+ {
+ if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - Ref({0})", x.val);
+ return x;
+ }
+ public override DoubleHolder Ptr(DoubleHolder x)
+ {
+ if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - Ptr({0})", x.val);
+ return x;
+ }
+ public override String FullyOverloaded(int x)
+ {
+ if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - FullyOverloaded(int {0})", x);
+ return "CSharpDerived::FullyOverloaded(int)";
+ }
+ public override String FullyOverloaded(bool x)
+ {
+ if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - FullyOverloaded(bool {0})", x);
+ return "CSharpDerived::FullyOverloaded(bool)";
+ }
+ // Note no SemiOverloaded(bool x) method
+ public override String SemiOverloaded(int x)
+ {
+ String ret = "CSharpDerived::SemiOverloaded(int)";
+ if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - SemiOverloaded({0})", x);
+ return ret;
+ }
+ public override String DefaultParms(int x, double y)
+ {
+ String ret = "CSharpDerived::DefaultParms(int, double)";
+ if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - DefaultParms({0}, {1})", 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 override String DefaultParms(int x)
+ {
+ if (director_classes.PrintDebug) Console.WriteLine("CSharpDerived - DefaultParms({0})", x);
+ return DefaultParms(x, 1.1/*use C++ default here*/);
+ }
+}
+
+}
diff --git a/trunk/Examples/test-suite/csharp/director_classic_runme.cs b/trunk/Examples/test-suite/csharp/director_classic_runme.cs
new file mode 100644
index 000000000..7220437d5
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/director_classic_runme.cs
@@ -0,0 +1,314 @@
+using System;
+
+namespace director_classicNamespace {
+
+public class runme
+{
+ static void Main()
+ {
+ {
+ Person person = new Person();
+ check(person, "Person");
+ person.Dispose();
+ }
+ {
+ Person person = new Child();
+ check(person, "Child");
+ person.Dispose();
+ }
+ {
+ Person person = new GrandChild();
+ check(person, "GrandChild");
+ person.Dispose();
+ }
+ {
+ Person person = new TargetLangPerson();
+ check(person, "TargetLangPerson");
+ person.Dispose();
+ }
+ {
+ Person person = new TargetLangChild();
+ check(person, "TargetLangChild");
+ person.Dispose();
+ }
+ {
+ Person person = new TargetLangGrandChild();
+ check(person, "TargetLangGrandChild");
+ person.Dispose();
+ }
+
+ // Semis - don't override id() in target language
+ {
+ Person person = new TargetLangSemiPerson();
+ check(person, "Person");
+ person.Dispose();
+ }
+ {
+ Person person = new TargetLangSemiChild();
+ check(person, "Child");
+ person.Dispose();
+ }
+ {
+ Person person = new TargetLangSemiGrandChild();
+ check(person, "GrandChild");
+ person.Dispose();
+ }
+
+ // Orphans - don't override id() in C++
+ {
+ Person person = new OrphanPerson();
+ check(person, "Person");
+ person.Dispose();
+ }
+ {
+ Person person = new OrphanChild();
+ check(person, "Child");
+ person.Dispose();
+ }
+ {
+ Person person = new TargetLangOrphanPerson();
+ check(person, "TargetLangOrphanPerson");
+ person.Dispose();
+ }
+ {
+ Person person = new TargetLangOrphanChild();
+ check(person, "TargetLangOrphanChild");
+ person.Dispose();
+ }
+
+ // Duals - id() makes an upcall to the base id()
+ {
+ Person person = new TargetLangDualPerson();
+ check(person, "TargetLangDualPerson + Person");
+ person.Dispose();
+ }
+ {
+ Person person = new TargetLangDualChild();
+ check(person, "TargetLangDualChild + Child");
+ person.Dispose();
+ }
+ {
+ Person person = new TargetLangDualGrandChild();
+ check(person, "TargetLangDualGrandChild + GrandChild");
+ person.Dispose();
+ }
+
+ // Mix Orphans and Duals
+ {
+ Person person = new TargetLangDualOrphanPerson();
+ check(person, "TargetLangDualOrphanPerson + Person");
+ person.Dispose();
+ }
+ {
+ Person person = new TargetLangDualOrphanChild();
+ check(person, "TargetLangDualOrphanChild + Child");
+ person.Dispose();
+ }
+ }
+
+ static void check(Person person, String expected) {
+ String ret;
+ // Normal target language polymorphic call
+ ret = person.id();
+ if (debug)
+ Console.WriteLine(ret);
+ if (ret != expected)
+ throw new Exception("Failed. Received: " + ret + " Expected: " + expected);
+
+ // Polymorphic call from C++
+ Caller caller = new Caller();
+ caller.setCallback(person);
+ ret = caller.call();
+ if (debug)
+ Console.WriteLine(ret);
+ if (ret != expected)
+ throw new Exception("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)
+ Console.WriteLine(ret);
+ if (ret != expected)
+ throw new Exception("Failed. Received: " + ret + " Expected: " + expected);
+
+ caller.resetCallback();
+ if (debug)
+ Console.WriteLine("----------------------------------------");
+ }
+ static bool debug = false;
+}
+
+public class TargetLangPerson : Person
+{
+ public TargetLangPerson()
+ : base()
+ {
+ }
+
+ public override String id()
+ {
+ String identifier = "TargetLangPerson";
+ return identifier;
+ }
+}
+
+public class TargetLangChild : Child
+{
+ public TargetLangChild()
+ : base()
+ {
+ }
+
+ public override String id()
+ {
+ String identifier = "TargetLangChild";
+ return identifier;
+ }
+}
+
+public class TargetLangGrandChild : GrandChild
+{
+ public TargetLangGrandChild()
+ : base()
+ {
+ }
+
+ public override String id()
+ {
+ String identifier = "TargetLangGrandChild";
+ return identifier;
+ }
+}
+
+// Semis - don't override id() in target language
+public class TargetLangSemiPerson : Person
+{
+ public TargetLangSemiPerson()
+ : base()
+ {
+ }
+ // No id() override
+}
+
+public class TargetLangSemiChild : Child
+{
+ public TargetLangSemiChild()
+ : base()
+ {
+ }
+ // No id() override
+}
+
+public class TargetLangSemiGrandChild : GrandChild
+{
+ public TargetLangSemiGrandChild()
+ : base()
+ {
+ }
+ // No id() override
+}
+
+// Orphans - don't override id() in C++
+class TargetLangOrphanPerson : OrphanPerson
+{
+ public TargetLangOrphanPerson()
+ : base()
+ {
+ }
+
+ public override String id()
+ {
+ String identifier = "TargetLangOrphanPerson";
+ return identifier;
+ }
+}
+
+class TargetLangOrphanChild : OrphanChild
+{
+ public TargetLangOrphanChild()
+ : base()
+ {
+ }
+
+ public override String id()
+ {
+ String identifier = "TargetLangOrphanChild";
+ return identifier;
+ }
+}
+
+
+// Duals - id() makes an upcall to the base id()
+class TargetLangDualPerson : Person
+{
+ public TargetLangDualPerson()
+ : base()
+ {
+ }
+
+ public override String id()
+ {
+ String identifier = "TargetLangDualPerson + " + base.id();
+ return identifier;
+ }
+}
+
+class TargetLangDualChild : Child
+{
+ public TargetLangDualChild()
+ : base()
+ {
+ }
+
+ public override String id()
+ {
+ String identifier = "TargetLangDualChild + " + base.id();
+ return identifier;
+ }
+}
+
+class TargetLangDualGrandChild : GrandChild
+{
+ public TargetLangDualGrandChild()
+ : base()
+ {
+ }
+
+ public override String id()
+ {
+ String identifier = "TargetLangDualGrandChild + " + base.id();
+ return identifier;
+ }
+}
+
+// Mix Orphans and Duals
+class TargetLangDualOrphanPerson : OrphanPerson
+{
+ public TargetLangDualOrphanPerson()
+ : base()
+ {
+ }
+
+ public override String id()
+ {
+ String identifier = "TargetLangDualOrphanPerson + " + base.id();
+ return identifier;
+ }
+}
+
+class TargetLangDualOrphanChild : OrphanChild
+{
+ public TargetLangDualOrphanChild()
+ : base()
+ {
+ }
+
+ public override String id()
+ {
+ String identifier = "TargetLangDualOrphanChild + " + base.id();
+ return identifier;
+ }
+}
+
+}
diff --git a/trunk/Examples/test-suite/csharp/director_ignore_runme.cs b/trunk/Examples/test-suite/csharp/director_ignore_runme.cs
new file mode 100644
index 000000000..481b1f40a
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/director_ignore_runme.cs
@@ -0,0 +1,57 @@
+using System;
+
+namespace director_ignoreNamespace {
+
+public class runme
+{
+ static void Main()
+ {
+ runme r = new runme();
+ r.run();
+ }
+
+ void run()
+ {
+ // Just check the classes can be instantiated and other methods work as expected
+ DIgnoresDerived a = new DIgnoresDerived();
+ if (a.Triple(5) != 15)
+ throw new Exception("Triple failed");
+ DAbstractIgnoresDerived b = new DAbstractIgnoresDerived();
+ if (b.Quadruple(5) != 20)
+ throw new Exception("Quadruple failed");
+ }
+}
+
+class DIgnoresDerived : DIgnores
+{
+ public DIgnoresDerived() : base()
+ {
+ }
+
+ // These will give a warning if the %ignore is not working
+ public virtual int OverloadedMethod(int n, int xoffset, int yoffset) { return 0; }
+ public virtual int OverloadedMethod(int n, int xoffset) { return 0; }
+ public virtual int OverloadedMethod(int n) { return 0; }
+
+ public virtual int OverloadedProtectedMethod(int n, int xoffset, int yoffset) { return 0; }
+ public virtual int OverloadedProtectedMethod(int n, int xoffset) { return 0; }
+ public virtual int OverloadedProtectedMethod(int n) { return 0; }
+}
+
+class DAbstractIgnoresDerived : DAbstractIgnores
+{
+ public DAbstractIgnoresDerived() : base()
+ {
+ }
+
+ // These will give a warning if the %ignore is not working
+ public virtual int OverloadedMethod(int n, int xoffset, int yoffset) { return 0; }
+ public virtual int OverloadedMethod(int n, int xoffset) { return 0; }
+ public virtual int OverloadedMethod(int n) { return 0; }
+
+ public virtual int OverloadedProtectedMethod(int n, int xoffset, int yoffset) { return 0; }
+ public virtual int OverloadedProtectedMethod(int n, int xoffset) { return 0; }
+ public virtual int OverloadedProtectedMethod(int n) { return 0; }
+}
+
+}
diff --git a/trunk/Examples/test-suite/csharp/director_primitives_runme.cs b/trunk/Examples/test-suite/csharp/director_primitives_runme.cs
new file mode 100644
index 000000000..0a8f705dc
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/director_primitives_runme.cs
@@ -0,0 +1,127 @@
+/*
+ This test program shows a C# class CSharpDerived 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++.
+*/
+
+using System;
+using director_primitivesNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ runme r = new runme();
+ r.run();
+ }
+
+ void run()
+ {
+ if (director_primitives.PrintDebug) Console.WriteLine("------------ Start ------------ ");
+
+ Caller myCaller = new Caller();
+
+ // test C++ base class
+ using (Base myBase = new Base(100.0))
+ {
+ makeCalls(myCaller, myBase);
+ }
+
+ if (director_primitives.PrintDebug) Console.WriteLine("--------------------------------");
+
+ // test vanilla C++ wrapped derived class
+ using (Base myBase = new Derived(200.0))
+ {
+ makeCalls(myCaller, myBase);
+ }
+
+ if (director_primitives.PrintDebug) Console.WriteLine("--------------------------------");
+
+ // test director / C# derived class
+ using (Base myBase = new CSharpDerived(300.0))
+ {
+ makeCalls(myCaller, myBase);
+ }
+
+ if (director_primitives.PrintDebug) Console.WriteLine("------------ Finish ------------ ");
+ }
+
+ void makeCalls(Caller myCaller, Base myBase)
+ {
+ myCaller.set(myBase);
+
+ myCaller.NoParmsMethodCall();
+ if (myCaller.BoolMethodCall(true) != true) throw new Exception("failed");
+ if (myCaller.BoolMethodCall(false) != false) throw new Exception("failed");
+ if (myCaller.IntMethodCall(-123) != -123) throw new Exception("failed");
+ if (myCaller.UIntMethodCall(123) != 123) throw new Exception("failed");
+ if (myCaller.FloatMethodCall((float)-123.456) != (float)-123.456) throw new Exception("failed");
+ if (myCaller.CharPtrMethodCall("test string") != "test string") throw new Exception("failed");
+ if (myCaller.ConstCharPtrMethodCall("another string") != "another string") throw new Exception("failed");
+ if (myCaller.EnumMethodCall(HShadowMode.HShadowHard) != HShadowMode.HShadowHard) throw new Exception("failed");
+ myCaller.ManyParmsMethodCall(true, -123, 123, (float)123.456, "test string", "another string", HShadowMode.HShadowHard);
+ myCaller.NotOverriddenMethodCall();
+
+ myCaller.reset();
+ }
+}
+
+public class CSharpDerived : Base
+{
+ public CSharpDerived(double dd)
+ : base(dd)
+ {
+ }
+
+ public override void NoParmsMethod()
+ {
+ if (director_primitives.PrintDebug) Console.WriteLine("CSharpDerived - NoParmsMethod()");
+ }
+ public override bool BoolMethod(bool x)
+ {
+ if (director_primitives.PrintDebug) Console.WriteLine("CSharpDerived - BoolMethod({0})", x);
+ return x;
+ }
+ public override int IntMethod(int x)
+ {
+ if (director_primitives.PrintDebug) Console.WriteLine("CSharpDerived - IntMethod({0})", x);
+ return x;
+ }
+ public override uint UIntMethod(uint x)
+ {
+ if (director_primitives.PrintDebug) Console.WriteLine("CSharpDerived - UIntMethod({0})", x);
+ return x;
+ }
+ public override float FloatMethod(float x)
+ {
+ if (director_primitives.PrintDebug) Console.WriteLine("CSharpDerived - FloatMethod({0})", x);
+ return x;
+ }
+ public override string CharPtrMethod(string x)
+ {
+ if (director_primitives.PrintDebug) Console.WriteLine("CSharpDerived - CharPtrMethod({0})", x);
+ return x;
+ }
+ public override string ConstCharPtrMethod(string x)
+ {
+ if (director_primitives.PrintDebug) Console.WriteLine("CSharpDerived - ConstCharPtrMethod({0})", x);
+ return x;
+ }
+ public override HShadowMode EnumMethod(HShadowMode x)
+ {
+ if (director_primitives.PrintDebug) Console.WriteLine("CSharpDerived - EnumMethod({0})", x);
+ return x;
+ }
+ public override void ManyParmsMethod(bool b, int i, uint u, float f, string c, string cc, HShadowMode h)
+ {
+ if (director_primitives.PrintDebug) Console.WriteLine("CSharpDerived - ManyParmsMethod({0}, {1}, {2}, {3}, {4}, {5}, {6})", b, i, u, f, c, cc, h);
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/director_protected_runme.cs b/trunk/Examples/test-suite/csharp/director_protected_runme.cs
new file mode 100644
index 000000000..ee4697b0e
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/director_protected_runme.cs
@@ -0,0 +1,72 @@
+using System;
+
+namespace director_protectedNamespace {
+
+public class runme
+{
+ static void Main()
+ {
+ runme r = new runme();
+ r.run();
+ }
+
+ void run()
+ {
+ Bar b = new Bar();
+ Foo f = b.create();
+ FooBar fb = new FooBar();
+ FooBar2 fb2 = new FooBar2();
+
+ String s;
+ s = fb.used();
+ if ( s != ("Foo::pang();Bar::pong();Foo::pong();FooBar::ping();"))
+ throw new Exception("bad FooBar::used" + " - " + s);
+
+ s = fb2.used();
+ if ( s != ("FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();"))
+ throw new Exception("bad FooBar2::used");
+
+ s = b.pong();
+ if ( s != ("Bar::pong();Foo::pong();Bar::ping();"))
+ throw new Exception("bad Bar::pong");
+
+ s = f.pong();
+ if ( s != ("Bar::pong();Foo::pong();Bar::ping();"))
+ throw new Exception("bad Foo::pong");
+
+ s = fb.pong();
+ if ( s != ("Bar::pong();Foo::pong();FooBar::ping();"))
+ throw new Exception("bad FooBar::pong");
+ }
+}
+
+class FooBar : Bar
+{
+ public FooBar() : base()
+ {
+ }
+
+ protected override String ping()
+ {
+ return "FooBar::ping();";
+ }
+}
+
+class FooBar2 : Bar
+{
+ public FooBar2() : base()
+ {
+ }
+
+ protected override String ping()
+ {
+ return "FooBar2::ping();";
+ }
+
+ protected override String pang()
+ {
+ return "FooBar2::pang();";
+ }
+}
+
+}
diff --git a/trunk/Examples/test-suite/csharp/director_string_runme.cs b/trunk/Examples/test-suite/csharp/director_string_runme.cs
new file mode 100644
index 000000000..0b1b04fa4
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/director_string_runme.cs
@@ -0,0 +1,53 @@
+using System;
+using director_stringNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ runme r = new runme();
+ r.run();
+ }
+
+ void run()
+ {
+ String s;
+
+ director_string_A c = new director_string_A("hi");
+ for (int i=0; i<3; i++) {
+ s = c.call_get(i);
+ Object ii = i;
+ if (s != ii.ToString()) throw new Exception("director_string_A.get(" + i + ") failed. Got:" + s);
+ }
+
+ director_string_B b = new director_string_B("hello");
+
+ s = b.call_get_first();
+ if (s != "director_string_B.get_first") throw new Exception("call_get_first() failed");
+
+ s = b.call_get(0);
+ if (s != "director_string_B.get: hello") throw new Exception("get(0) failed");
+ }
+}
+
+class director_string_B : A {
+ public director_string_B(String first) : base(first) {
+ }
+ public override String get_first() {
+ return "director_string_B.get_first";
+ }
+
+ public override String get(int n) {
+ return "director_string_B.get: " + base.get(n);
+ }
+}
+
+class director_string_A : A {
+ public director_string_A(String first) : base(first) {
+ }
+ public override String get(int n) {
+ Object nn = n;
+ return nn.ToString();
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/enum_thorough_runme.cs b/trunk/Examples/test-suite/csharp/enum_thorough_runme.cs
new file mode 100644
index 000000000..144736f2b
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/enum_thorough_runme.cs
@@ -0,0 +1,410 @@
+using System;
+using enum_thoroughNamespace;
+
+public class runme {
+ static void Main() {
+ {
+ // Anonymous enums
+ int i = enum_thorough.AnonEnum1;
+ if (enum_thorough.ReallyAnInteger != 200) throw new Exception("Test Anon 1 failed");
+ i += enum_thorough.AnonSpaceEnum1;
+ i += AnonStruct.AnonStructEnum1;
+ }
+ {
+ colour red = colour.red;
+ enum_thorough.colourTest1(red);
+ enum_thorough.colourTest2(red);
+ enum_thorough.colourTest3(red);
+ enum_thorough.colourTest4(red);
+ enum_thorough.myColour = red;
+ }
+ {
+ SpeedClass s = new SpeedClass();
+ SpeedClass.speed speed = SpeedClass.speed.slow;
+ if (s.speedTest1(speed) != speed) throw new Exception("speedTest 1 failed");
+ if (s.speedTest2(speed) != speed) throw new Exception("speedTest 2 failed");
+ if (s.speedTest3(speed) != speed) throw new Exception("speedTest 3 failed");
+ if (s.speedTest4(speed) != speed) throw new Exception("speedTest 4 failed");
+ if (s.speedTest5(speed) != speed) throw new Exception("speedTest 5 failed");
+ if (s.speedTest6(speed) != speed) throw new Exception("speedTest 6 failed");
+ if (s.speedTest7(speed) != speed) throw new Exception("speedTest 7 failed");
+ if (s.speedTest8(speed) != speed) throw new Exception("speedTest 8 failed");
+
+ if (enum_thorough.speedTest1(speed) != speed) throw new Exception("speedTest Global 1 failed");
+ if (enum_thorough.speedTest2(speed) != speed) throw new Exception("speedTest Global 2 failed");
+ if (enum_thorough.speedTest3(speed) != speed) throw new Exception("speedTest Global 3 failed");
+ if (enum_thorough.speedTest4(speed) != speed) throw new Exception("speedTest Global 4 failed");
+ if (enum_thorough.speedTest5(speed) != speed) throw new Exception("speedTest Global 5 failed");
+ }
+ {
+ SpeedClass s = new SpeedClass();
+ SpeedClass.speed slow = SpeedClass.speed.slow;
+ SpeedClass.speed lightning = SpeedClass.speed.lightning;
+
+ if (s.mySpeedtd1 != slow) throw new Exception("mySpeedtd1 1 failed");
+ if ((int)s.mySpeedtd1 != 10) throw new Exception("mySpeedtd1 2 failed");
+
+ s.mySpeedtd1 = lightning;
+ if (s.mySpeedtd1 != lightning) throw new Exception("mySpeedtd1 3 failed");
+ if ((int)s.mySpeedtd1 != 31) throw new Exception("mySpeedtd1 4 failed");
+ }
+ {
+ if (enum_thorough.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new Exception("namedanonTest 1 failed");
+ }
+ {
+ twonames val = twonames.TwoNames2;
+ if (enum_thorough.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed");
+ if (enum_thorough.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed");
+ if (enum_thorough.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed");
+ }
+ {
+ TwoNamesStruct t = new TwoNamesStruct();
+ TwoNamesStruct.twonames val = TwoNamesStruct.twonames.TwoNamesStruct1;
+ if (t.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed");
+ if (t.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed");
+ if (t.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed");
+ }
+ {
+ namedanonspace val = namedanonspace.NamedAnonSpace2;
+ if (enum_thorough.namedanonspaceTest1(val) != val) throw new Exception("namedanonspaceTest 1 failed");
+ if (enum_thorough.namedanonspaceTest2(val) != val) throw new Exception("namedanonspaceTest 2 failed");
+ if (enum_thorough.namedanonspaceTest3(val) != val) throw new Exception("namedanonspaceTest 3 failed");
+ if (enum_thorough.namedanonspaceTest4(val) != val) throw new Exception("namedanonspaceTest 4 failed");
+ }
+ {
+ TemplateClassInt t = new TemplateClassInt();
+ TemplateClassInt.scientists galileo = TemplateClassInt.scientists.galileo;
+
+ if (t.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest 1 failed");
+ if (t.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest 2 failed");
+ if (t.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest 3 failed");
+ if (t.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest 4 failed");
+ if (t.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest 5 failed");
+ if (t.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest 6 failed");
+ if (t.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest 7 failed");
+ if (t.scientistsTest8(galileo) != galileo) throw new Exception("scientistsTest 8 failed");
+ if (t.scientistsTest9(galileo) != galileo) throw new Exception("scientistsTest 9 failed");
+// if (t.scientistsTestA(galileo) != galileo) throw new Exception("scientistsTest A failed");
+ if (t.scientistsTestB(galileo) != galileo) throw new Exception("scientistsTest B failed");
+// if (t.scientistsTestC(galileo) != galileo) throw new Exception("scientistsTest C failed");
+ if (t.scientistsTestD(galileo) != galileo) throw new Exception("scientistsTest D failed");
+ if (t.scientistsTestE(galileo) != galileo) throw new Exception("scientistsTest E failed");
+ if (t.scientistsTestF(galileo) != galileo) throw new Exception("scientistsTest F failed");
+ if (t.scientistsTestG(galileo) != galileo) throw new Exception("scientistsTest G failed");
+ if (t.scientistsTestH(galileo) != galileo) throw new Exception("scientistsTest H failed");
+ if (t.scientistsTestI(galileo) != galileo) throw new Exception("scientistsTest I failed");
+ if (t.scientistsTestJ(galileo) != galileo) throw new Exception("scientistsTest J failed");
+
+ if (enum_thorough.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest Global 1 failed");
+ if (enum_thorough.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest Global 2 failed");
+ if (enum_thorough.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest Global 3 failed");
+ if (enum_thorough.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest Global 4 failed");
+ if (enum_thorough.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest Global 5 failed");
+ if (enum_thorough.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest Global 6 failed");
+ if (enum_thorough.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest Global 7 failed");
+ if (enum_thorough.scientistsTest8(galileo) != galileo) throw new Exception("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 Exception("scientistsNameTest 1 failed");
+ if (t.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest 2 failed");
+ if (t.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest 3 failed");
+ if (t.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest 4 failed");
+ if (t.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest 5 failed");
+ if (t.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest 6 failed");
+ if (t.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest 7 failed");
+ if (t.scientistsNameTest8(bell) != bell) throw new Exception("scientistsNameTest 8 failed");
+ if (t.scientistsNameTest9(bell) != bell) throw new Exception("scientistsNameTest 9 failed");
+// if (t.scientistsNameTestA(bell) != bell) throw new Exception("scientistsNameTest A failed");
+ if (t.scientistsNameTestB(bell) != bell) throw new Exception("scientistsNameTest B failed");
+// if (t.scientistsNameTestC(bell) != bell) throw new Exception("scientistsNameTest C failed");
+ if (t.scientistsNameTestD(bell) != bell) throw new Exception("scientistsNameTest D failed");
+ if (t.scientistsNameTestE(bell) != bell) throw new Exception("scientistsNameTest E failed");
+ if (t.scientistsNameTestF(bell) != bell) throw new Exception("scientistsNameTest F failed");
+ if (t.scientistsNameTestG(bell) != bell) throw new Exception("scientistsNameTest G failed");
+ if (t.scientistsNameTestH(bell) != bell) throw new Exception("scientistsNameTest H failed");
+ if (t.scientistsNameTestI(bell) != bell) throw new Exception("scientistsNameTest I failed");
+
+ if (t.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest 1 failed");
+ if (t.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest 2 failed");
+ if (t.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest 3 failed");
+ if (t.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest 4 failed");
+ if (t.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest 5 failed");
+ if (t.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest 6 failed");
+ if (t.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest 7 failed");
+
+ if (t.scientistsOtherTest1(galileo) != galileo) throw new Exception("scientistsOtherTest 1 failed");
+ if (t.scientistsOtherTest2(galileo) != galileo) throw new Exception("scientistsOtherTest 2 failed");
+ if (t.scientistsOtherTest3(galileo) != galileo) throw new Exception("scientistsOtherTest 3 failed");
+ if (t.scientistsOtherTest4(galileo) != galileo) throw new Exception("scientistsOtherTest 4 failed");
+ if (t.scientistsOtherTest5(galileo) != galileo) throw new Exception("scientistsOtherTest 5 failed");
+ if (t.scientistsOtherTest6(galileo) != galileo) throw new Exception("scientistsOtherTest 6 failed");
+ if (t.scientistsOtherTest7(galileo) != galileo) throw new Exception("scientistsOtherTest 7 failed");
+
+ if (enum_thorough.scientistsNameTest1(bell) != bell) throw new Exception("scientistsNameTest Global 1 failed");
+ if (enum_thorough.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest Global 2 failed");
+ if (enum_thorough.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest Global 3 failed");
+ if (enum_thorough.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest Global 4 failed");
+ if (enum_thorough.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest Global 5 failed");
+ if (enum_thorough.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest Global 6 failed");
+ if (enum_thorough.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest Global 7 failed");
+
+ if (enum_thorough.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 1 failed");
+ if (enum_thorough.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 2 failed");
+ if (enum_thorough.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 3 failed");
+ if (enum_thorough.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 4 failed");
+ if (enum_thorough.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 5 failed");
+ if (enum_thorough.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 6 failed");
+ if (enum_thorough.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 7 failed");
+
+ if (enum_thorough.scientistsNameSpaceTest8(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 8 failed");
+ if (enum_thorough.scientistsNameSpaceTest9(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 9 failed");
+ if (enum_thorough.scientistsNameSpaceTestA(bell) != bell) throw new Exception("scientistsNameSpaceTest Global A failed");
+ if (enum_thorough.scientistsNameSpaceTestB(bell) != bell) throw new Exception("scientistsNameSpaceTest Global B failed");
+ if (enum_thorough.scientistsNameSpaceTestC(bell) != bell) throw new Exception("scientistsNameSpaceTest Global C failed");
+ if (enum_thorough.scientistsNameSpaceTestD(bell) != bell) throw new Exception("scientistsNameSpaceTest Global D failed");
+ if (enum_thorough.scientistsNameSpaceTestE(bell) != bell) throw new Exception("scientistsNameSpaceTest Global E failed");
+
+ if (enum_thorough.scientistsNameSpaceTestF(bell) != bell) throw new Exception("scientistsNameSpaceTest Global F failed");
+ if (enum_thorough.scientistsNameSpaceTestG(bell) != bell) throw new Exception("scientistsNameSpaceTest Global G failed");
+ if (enum_thorough.scientistsNameSpaceTestH(bell) != bell) throw new Exception("scientistsNameSpaceTest Global H failed");
+ if (enum_thorough.scientistsNameSpaceTestI(bell) != bell) throw new Exception("scientistsNameSpaceTest Global I failed");
+ if (enum_thorough.scientistsNameSpaceTestJ(bell) != bell) throw new Exception("scientistsNameSpaceTest Global J failed");
+ if (enum_thorough.scientistsNameSpaceTestK(bell) != bell) throw new Exception("scientistsNameSpaceTest Global K failed");
+ if (enum_thorough.scientistsNameSpaceTestL(bell) != bell) throw new Exception("scientistsNameSpaceTest Global L failed");
+ }
+ {
+ newname val = newname.argh;
+ if (enum_thorough.renameTest1(val) != val) throw new Exception("renameTest Global 1 failed");
+ if (enum_thorough.renameTest2(val) != val) throw new Exception("renameTest Global 2 failed");
+ }
+ {
+ NewNameStruct n = new NewNameStruct();
+ if (n.renameTest1(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest 1 failed");
+ if (n.renameTest2(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest 2 failed");
+ if (n.renameTest3(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new Exception("renameTest 3 failed");
+ if (n.renameTest4(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest 4 failed");
+ if (n.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest 5 failed");
+ if (n.renameTest6(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new Exception("renameTest 6 failed");
+ }
+ {
+ if (enum_thorough.renameTest3(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest Global 3 failed");
+ if (enum_thorough.renameTest4(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new Exception("renameTest Global 4 failed");
+ if (enum_thorough.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest Global 5 failed");
+ if (enum_thorough.renameTest6(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest Global 6 failed");
+ if (enum_thorough.renameTest7(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new Exception("renameTest Global 7 failed");
+ }
+ {
+ TreesClass t = new TreesClass();
+ TreesClass.trees pine = TreesClass.trees.pine;
+
+ if (t.treesTest1(pine) != pine) throw new Exception("treesTest 1 failed");
+ if (t.treesTest2(pine) != pine) throw new Exception("treesTest 2 failed");
+ if (t.treesTest3(pine) != pine) throw new Exception("treesTest 3 failed");
+ if (t.treesTest4(pine) != pine) throw new Exception("treesTest 4 failed");
+ if (t.treesTest5(pine) != pine) throw new Exception("treesTest 5 failed");
+ if (t.treesTest6(pine) != pine) throw new Exception("treesTest 6 failed");
+ if (t.treesTest7(pine) != pine) throw new Exception("treesTest 7 failed");
+ if (t.treesTest8(pine) != pine) throw new Exception("treesTest 8 failed");
+ if (t.treesTest9(pine) != pine) throw new Exception("treesTest 9 failed");
+ if (t.treesTestA(pine) != pine) throw new Exception("treesTest A failed");
+ if (t.treesTestB(pine) != pine) throw new Exception("treesTest B failed");
+ if (t.treesTestC(pine) != pine) throw new Exception("treesTest C failed");
+ if (t.treesTestD(pine) != pine) throw new Exception("treesTest D failed");
+ if (t.treesTestE(pine) != pine) throw new Exception("treesTest E failed");
+ if (t.treesTestF(pine) != pine) throw new Exception("treesTest F failed");
+ if (t.treesTestG(pine) != pine) throw new Exception("treesTest G failed");
+ if (t.treesTestH(pine) != pine) throw new Exception("treesTest H failed");
+ if (t.treesTestI(pine) != pine) throw new Exception("treesTest I failed");
+ if (t.treesTestJ(pine) != pine) throw new Exception("treesTest J failed");
+ if (t.treesTestK(pine) != pine) throw new Exception("treesTest K failed");
+ if (t.treesTestL(pine) != pine) throw new Exception("treesTest L failed");
+ if (t.treesTestM(pine) != pine) throw new Exception("treesTest M failed");
+ if (t.treesTestN(pine) != pine) throw new Exception("treesTest N failed");
+ if (t.treesTestO(pine) != pine) throw new Exception("treesTest O failed");
+
+ if (enum_thorough.treesTest1(pine) != pine) throw new Exception("treesTest Global 1 failed");
+ if (enum_thorough.treesTest2(pine) != pine) throw new Exception("treesTest Global 2 failed");
+ if (enum_thorough.treesTest3(pine) != pine) throw new Exception("treesTest Global 3 failed");
+ if (enum_thorough.treesTest4(pine) != pine) throw new Exception("treesTest Global 4 failed");
+ if (enum_thorough.treesTest5(pine) != pine) throw new Exception("treesTest Global 5 failed");
+ if (enum_thorough.treesTest6(pine) != pine) throw new Exception("treesTest Global 6 failed");
+ if (enum_thorough.treesTest7(pine) != pine) throw new Exception("treesTest Global 7 failed");
+ if (enum_thorough.treesTest8(pine) != pine) throw new Exception("treesTest Global 8 failed");
+ if (enum_thorough.treesTest9(pine) != pine) throw new Exception("treesTest Global 9 failed");
+ if (enum_thorough.treesTestA(pine) != pine) throw new Exception("treesTest Global A failed");
+ if (enum_thorough.treesTestB(pine) != pine) throw new Exception("treesTest Global B failed");
+ if (enum_thorough.treesTestC(pine) != pine) throw new Exception("treesTest Global C failed");
+ if (enum_thorough.treesTestD(pine) != pine) throw new Exception("treesTest Global D failed");
+ if (enum_thorough.treesTestE(pine) != pine) throw new Exception("treesTest Global E failed");
+ if (enum_thorough.treesTestF(pine) != pine) throw new Exception("treesTest Global F failed");
+ if (enum_thorough.treesTestG(pine) != pine) throw new Exception("treesTest Global G failed");
+ if (enum_thorough.treesTestH(pine) != pine) throw new Exception("treesTest Global H failed");
+ if (enum_thorough.treesTestI(pine) != pine) throw new Exception("treesTest Global I failed");
+ if (enum_thorough.treesTestJ(pine) != pine) throw new Exception("treesTest Global J failed");
+ if (enum_thorough.treesTestK(pine) != pine) throw new Exception("treesTest Global K failed");
+ if (enum_thorough.treesTestL(pine) != pine) throw new Exception("treesTest Global L failed");
+ if (enum_thorough.treesTestM(pine) != pine) throw new Exception("treesTest Global M failed");
+// if (enum_thorough.treesTestN(pine) != pine) throw new Exception("treesTest Global N failed");
+ if (enum_thorough.treesTestO(pine) != pine) throw new Exception("treesTest Global O failed");
+ if (enum_thorough.treesTestP(pine) != pine) throw new Exception("treesTest Global P failed");
+ if (enum_thorough.treesTestQ(pine) != pine) throw new Exception("treesTest Global Q failed");
+ if (enum_thorough.treesTestR(pine) != pine) throw new Exception("treesTest Global R failed");
+ }
+ {
+ HairStruct h = new HairStruct();
+ HairStruct.hair ginger = HairStruct.hair.ginger;
+
+ if (h.hairTest1(ginger) != ginger) throw new Exception("hairTest 1 failed");
+ if (h.hairTest2(ginger) != ginger) throw new Exception("hairTest 2 failed");
+ if (h.hairTest3(ginger) != ginger) throw new Exception("hairTest 3 failed");
+ if (h.hairTest4(ginger) != ginger) throw new Exception("hairTest 4 failed");
+ if (h.hairTest5(ginger) != ginger) throw new Exception("hairTest 5 failed");
+ if (h.hairTest6(ginger) != ginger) throw new Exception("hairTest 6 failed");
+ if (h.hairTest7(ginger) != ginger) throw new Exception("hairTest 7 failed");
+ if (h.hairTest8(ginger) != ginger) throw new Exception("hairTest 8 failed");
+ if (h.hairTest9(ginger) != ginger) throw new Exception("hairTest 9 failed");
+ if (h.hairTestA(ginger) != ginger) throw new Exception("hairTest A failed");
+ if (h.hairTestB(ginger) != ginger) throw new Exception("hairTest B failed");
+
+ colour red = colour.red;
+ if (h.colourTest1(red) != red) throw new Exception("colourTest HairStruct 1 failed");
+ if (h.colourTest2(red) != red) throw new Exception("colourTest HairStruct 2 failed");
+ if (h.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new Exception("namedanonTest HairStruct 1 failed");
+ if (h.namedanonspaceTest1(namedanonspace.NamedAnonSpace2) != namedanonspace.NamedAnonSpace2) throw new Exception("namedanonspaceTest HairStruct 1 failed");
+
+ TreesClass.trees fir = TreesClass.trees.fir;
+ if (h.treesGlobalTest1(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 1 failed");
+ if (h.treesGlobalTest2(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 2 failed");
+ if (h.treesGlobalTest3(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 3 failed");
+ if (h.treesGlobalTest4(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 4 failed");
+ }
+ {
+ HairStruct.hair blonde = HairStruct.hair.blonde;
+ if (enum_thorough.hairTest1(blonde) != blonde) throw new Exception("hairTest Global 1 failed");
+ if (enum_thorough.hairTest2(blonde) != blonde) throw new Exception("hairTest Global 2 failed");
+ if (enum_thorough.hairTest3(blonde) != blonde) throw new Exception("hairTest Global 3 failed");
+ if (enum_thorough.hairTest4(blonde) != blonde) throw new Exception("hairTest Global 4 failed");
+ if (enum_thorough.hairTest5(blonde) != blonde) throw new Exception("hairTest Global 5 failed");
+ if (enum_thorough.hairTest6(blonde) != blonde) throw new Exception("hairTest Global 6 failed");
+ if (enum_thorough.hairTest7(blonde) != blonde) throw new Exception("hairTest Global 7 failed");
+ if (enum_thorough.hairTest8(blonde) != blonde) throw new Exception("hairTest Global 8 failed");
+ if (enum_thorough.hairTest9(blonde) != blonde) throw new Exception("hairTest Global 9 failed");
+ if (enum_thorough.hairTestA(blonde) != blonde) throw new Exception("hairTest Global A failed");
+ if (enum_thorough.hairTestB(blonde) != blonde) throw new Exception("hairTest Global B failed");
+ if (enum_thorough.hairTestC(blonde) != blonde) throw new Exception("hairTest Global C failed");
+
+ if (enum_thorough.hairTestA1(blonde) != blonde) throw new Exception("hairTest Global A1 failed");
+ if (enum_thorough.hairTestA2(blonde) != blonde) throw new Exception("hairTest Global A2 failed");
+ if (enum_thorough.hairTestA3(blonde) != blonde) throw new Exception("hairTest Global A3 failed");
+ if (enum_thorough.hairTestA4(blonde) != blonde) throw new Exception("hairTest Global A4 failed");
+ if (enum_thorough.hairTestA5(blonde) != blonde) throw new Exception("hairTest Global A5 failed");
+ if (enum_thorough.hairTestA6(blonde) != blonde) throw new Exception("hairTest Global A6 failed");
+ if (enum_thorough.hairTestA7(blonde) != blonde) throw new Exception("hairTest Global A7 failed");
+ if (enum_thorough.hairTestA8(blonde) != blonde) throw new Exception("hairTest Global A8 failed");
+ if (enum_thorough.hairTestA9(blonde) != blonde) throw new Exception("hairTest Global A9 failed");
+ if (enum_thorough.hairTestAA(blonde) != blonde) throw new Exception("hairTest Global AA failed");
+ if (enum_thorough.hairTestAB(blonde) != blonde) throw new Exception("hairTest Global AB failed");
+ if (enum_thorough.hairTestAC(blonde) != blonde) throw new Exception("hairTest Global AC failed");
+
+ if (enum_thorough.hairTestB1(blonde) != blonde) throw new Exception("hairTest Global B1 failed");
+ if (enum_thorough.hairTestB2(blonde) != blonde) throw new Exception("hairTest Global B2 failed");
+ if (enum_thorough.hairTestB3(blonde) != blonde) throw new Exception("hairTest Global B3 failed");
+ if (enum_thorough.hairTestB4(blonde) != blonde) throw new Exception("hairTest Global B4 failed");
+ if (enum_thorough.hairTestB5(blonde) != blonde) throw new Exception("hairTest Global B5 failed");
+ if (enum_thorough.hairTestB6(blonde) != blonde) throw new Exception("hairTest Global B6 failed");
+ if (enum_thorough.hairTestB7(blonde) != blonde) throw new Exception("hairTest Global B7 failed");
+ if (enum_thorough.hairTestB8(blonde) != blonde) throw new Exception("hairTest Global B8 failed");
+ if (enum_thorough.hairTestB9(blonde) != blonde) throw new Exception("hairTest Global B9 failed");
+ if (enum_thorough.hairTestBA(blonde) != blonde) throw new Exception("hairTest Global BA failed");
+ if (enum_thorough.hairTestBB(blonde) != blonde) throw new Exception("hairTest Global BB failed");
+ if (enum_thorough.hairTestBC(blonde) != blonde) throw new Exception("hairTest Global BC failed");
+
+ if (enum_thorough.hairTestC1(blonde) != blonde) throw new Exception("hairTest Global C1 failed");
+ if (enum_thorough.hairTestC2(blonde) != blonde) throw new Exception("hairTest Global C2 failed");
+ if (enum_thorough.hairTestC3(blonde) != blonde) throw new Exception("hairTest Global C3 failed");
+ if (enum_thorough.hairTestC4(blonde) != blonde) throw new Exception("hairTest Global C4 failed");
+ if (enum_thorough.hairTestC5(blonde) != blonde) throw new Exception("hairTest Global C5 failed");
+ if (enum_thorough.hairTestC6(blonde) != blonde) throw new Exception("hairTest Global C6 failed");
+ if (enum_thorough.hairTestC7(blonde) != blonde) throw new Exception("hairTest Global C7 failed");
+ if (enum_thorough.hairTestC8(blonde) != blonde) throw new Exception("hairTest Global C8 failed");
+ if (enum_thorough.hairTestC9(blonde) != blonde) throw new Exception("hairTest Global C9 failed");
+ if (enum_thorough.hairTestCA(blonde) != blonde) throw new Exception("hairTest Global CA failed");
+ if (enum_thorough.hairTestCB(blonde) != blonde) throw new Exception("hairTest Global CB failed");
+ if (enum_thorough.hairTestCC(blonde) != blonde) throw new Exception("hairTest Global CC failed");
+ }
+ {
+ FirStruct f = new FirStruct();
+ HairStruct.hair blonde = HairStruct.hair.blonde;
+
+ if (f.hairTestFir1(blonde) != blonde) throw new Exception("hairTestFir 1 failed");
+ if (f.hairTestFir2(blonde) != blonde) throw new Exception("hairTestFir 2 failed");
+ if (f.hairTestFir3(blonde) != blonde) throw new Exception("hairTestFir 3 failed");
+ if (f.hairTestFir4(blonde) != blonde) throw new Exception("hairTestFir 4 failed");
+ if (f.hairTestFir5(blonde) != blonde) throw new Exception("hairTestFir 5 failed");
+ if (f.hairTestFir6(blonde) != blonde) throw new Exception("hairTestFir 6 failed");
+ if (f.hairTestFir7(blonde) != blonde) throw new Exception("hairTestFir 7 failed");
+ if (f.hairTestFir8(blonde) != blonde) throw new Exception("hairTestFir 8 failed");
+ if (f.hairTestFir9(blonde) != blonde) throw new Exception("hairTestFir 9 failed");
+ if (f.hairTestFirA(blonde) != blonde) throw new Exception("hairTestFir A failed");
+ }
+ {
+ enum_thorough.GlobalInstance = enum_thorough.globalinstance2;
+ if (enum_thorough.GlobalInstance != enum_thorough.globalinstance2) throw new Exception("GlobalInstance 1 failed");
+
+ Instances i = new Instances();
+ i.MemberInstance = Instances.memberinstance3;
+ if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
+ }
+ // ignore enum item tests start
+ {
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero) != 0) throw new Exception("ignoreATest 0 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three) != 3) throw new Exception("ignoreATest 3 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten) != 10) throw new Exception("ignoreATest 10 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven) != 11) throw new Exception("ignoreATest 11 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen) != 13) throw new Exception("ignoreATest 13 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen) != 14) throw new Exception("ignoreATest 14 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty) != 20) throw new Exception("ignoreATest 20 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty) != 30) throw new Exception("ignoreATest 30 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two) != 32) throw new Exception("ignoreATest 32 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three) != 33) throw new Exception("ignoreATest 33 failed");
+ }
+ {
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven) != 11) throw new Exception("ignoreBTest 11 failed");
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve) != 12) throw new Exception("ignoreBTest 12 failed");
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one) != 31) throw new Exception("ignoreBTest 31 failed");
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two) != 32) throw new Exception("ignoreBTest 32 failed");
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one) != 41) throw new Exception("ignoreBTest 41 failed");
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two) != 42) throw new Exception("ignoreBTest 42 failed");
+ }
+ {
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten) != 10) throw new Exception("ignoreCTest 10 failed");
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve) != 12) throw new Exception("ignoreCTest 12 failed");
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty) != 30) throw new Exception("ignoreCTest 30 failed");
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two) != 32) throw new Exception("ignoreCTest 32 failed");
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty) != 40) throw new Exception("ignoreCTest 40 failed");
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two) != 42) throw new Exception("ignoreCTest 42 failed");
+ }
+ {
+ if ((int)enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one) != 21) throw new Exception("ignoreDTest 21 failed");
+ if ((int)enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two) != 22) throw new Exception("ignoreDTest 22 failed");
+ }
+ {
+ if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero) != 0) throw new Exception("ignoreETest 0 failed");
+ if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one) != 21) throw new Exception("ignoreETest 21 failed");
+ if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two) != 22) throw new Exception("ignoreETest 22 failed");
+ }
+ // ignore enum item tests end
+ {
+ if ((int)enum_thorough.repeatTest(repeat.one) != 1) throw new Exception("repeatTest 1 failed");
+ if ((int)enum_thorough.repeatTest(repeat.initial) != 1) throw new Exception("repeatTest 2 failed");
+ if ((int)enum_thorough.repeatTest(repeat.two) != 2) throw new Exception("repeatTest 3 failed");
+ if ((int)enum_thorough.repeatTest(repeat.three) != 3) throw new Exception("repeatTest 4 failed");
+ if ((int)enum_thorough.repeatTest(repeat.llast) != 3) throw new Exception("repeatTest 5 failed");
+ if ((int)enum_thorough.repeatTest(repeat.end) != 3) throw new Exception("repeatTest 6 failed");
+ }
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/enum_thorough_simple_runme.cs b/trunk/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
new file mode 100644
index 000000000..d5bba1b7d
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
@@ -0,0 +1,410 @@
+using System;
+using enum_thorough_simpleNamespace;
+
+public class runme {
+ static void Main() {
+ {
+ // Anonymous enums
+ int i = enum_thorough_simple.AnonEnum1;
+ if (enum_thorough_simple.ReallyAnInteger != 200) throw new Exception("Test Anon 1 failed");
+ i += enum_thorough_simple.AnonSpaceEnum1;
+ i += 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.myColour = red;
+ }
+ {
+ SpeedClass s = new SpeedClass();
+ int speed = SpeedClass.slow;
+ if (s.speedTest1(speed) != speed) throw new Exception("speedTest 1 failed");
+ if (s.speedTest2(speed) != speed) throw new Exception("speedTest 2 failed");
+ if (s.speedTest3(speed) != speed) throw new Exception("speedTest 3 failed");
+ if (s.speedTest4(speed) != speed) throw new Exception("speedTest 4 failed");
+ if (s.speedTest5(speed) != speed) throw new Exception("speedTest 5 failed");
+ if (s.speedTest6(speed) != speed) throw new Exception("speedTest 6 failed");
+ if (s.speedTest7(speed) != speed) throw new Exception("speedTest 7 failed");
+ if (s.speedTest8(speed) != speed) throw new Exception("speedTest 8 failed");
+
+ if (enum_thorough_simple.speedTest1(speed) != speed) throw new Exception("speedTest Global 1 failed");
+ if (enum_thorough_simple.speedTest2(speed) != speed) throw new Exception("speedTest Global 2 failed");
+ if (enum_thorough_simple.speedTest3(speed) != speed) throw new Exception("speedTest Global 3 failed");
+ if (enum_thorough_simple.speedTest4(speed) != speed) throw new Exception("speedTest Global 4 failed");
+ if (enum_thorough_simple.speedTest5(speed) != speed) throw new Exception("speedTest Global 5 failed");
+ }
+ {
+ SpeedClass s = new SpeedClass();
+ int slow = SpeedClass.slow;
+ int lightning = SpeedClass.lightning;
+
+ if (s.mySpeedtd1 != slow) throw new Exception("mySpeedtd1 1 failed");
+ if (s.mySpeedtd1 != 10) throw new Exception("mySpeedtd1 2 failed");
+
+ s.mySpeedtd1 = lightning;
+ if (s.mySpeedtd1 != lightning) throw new Exception("mySpeedtd1 3 failed");
+ if (s.mySpeedtd1 != 31) throw new Exception("mySpeedtd1 4 failed");
+ }
+ {
+ if (enum_thorough_simple.namedanonTest1(enum_thorough_simple.NamedAnon2) != enum_thorough_simple.NamedAnon2) throw new Exception("namedanonTest 1 failed");
+ }
+ {
+ int val = enum_thorough_simple.TwoNames2;
+ if (enum_thorough_simple.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed");
+ if (enum_thorough_simple.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed");
+ if (enum_thorough_simple.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed");
+ }
+ {
+ TwoNamesStruct t = new TwoNamesStruct();
+ int val = TwoNamesStruct.TwoNamesStruct1;
+ if (t.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed");
+ if (t.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed");
+ if (t.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed");
+ }
+ {
+ int val = enum_thorough_simple.NamedAnonSpace2;
+ if (enum_thorough_simple.namedanonspaceTest1(val) != val) throw new Exception("namedanonspaceTest 1 failed");
+ if (enum_thorough_simple.namedanonspaceTest2(val) != val) throw new Exception("namedanonspaceTest 2 failed");
+ if (enum_thorough_simple.namedanonspaceTest3(val) != val) throw new Exception("namedanonspaceTest 3 failed");
+ if (enum_thorough_simple.namedanonspaceTest4(val) != val) throw new Exception("namedanonspaceTest 4 failed");
+ }
+ {
+ TemplateClassInt t = new TemplateClassInt();
+ int galileo = TemplateClassInt.galileo;
+
+ if (t.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest 1 failed");
+ if (t.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest 2 failed");
+ if (t.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest 3 failed");
+ if (t.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest 4 failed");
+ if (t.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest 5 failed");
+ if (t.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest 6 failed");
+ if (t.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest 7 failed");
+ if (t.scientistsTest8(galileo) != galileo) throw new Exception("scientistsTest 8 failed");
+ if (t.scientistsTest9(galileo) != galileo) throw new Exception("scientistsTest 9 failed");
+// if (t.scientistsTestA(galileo) != galileo) throw new Exception("scientistsTest A failed");
+ if (t.scientistsTestB(galileo) != galileo) throw new Exception("scientistsTest B failed");
+// if (t.scientistsTestC(galileo) != galileo) throw new Exception("scientistsTest C failed");
+ if (t.scientistsTestD(galileo) != galileo) throw new Exception("scientistsTest D failed");
+ if (t.scientistsTestE(galileo) != galileo) throw new Exception("scientistsTest E failed");
+ if (t.scientistsTestF(galileo) != galileo) throw new Exception("scientistsTest F failed");
+ if (t.scientistsTestG(galileo) != galileo) throw new Exception("scientistsTest G failed");
+ if (t.scientistsTestH(galileo) != galileo) throw new Exception("scientistsTest H failed");
+ if (t.scientistsTestI(galileo) != galileo) throw new Exception("scientistsTest I failed");
+ if (t.scientistsTestJ(galileo) != galileo) throw new Exception("scientistsTest J failed");
+
+ if (enum_thorough_simple.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest Global 1 failed");
+ if (enum_thorough_simple.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest Global 2 failed");
+ if (enum_thorough_simple.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest Global 3 failed");
+ if (enum_thorough_simple.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest Global 4 failed");
+ if (enum_thorough_simple.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest Global 5 failed");
+ if (enum_thorough_simple.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest Global 6 failed");
+ if (enum_thorough_simple.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest Global 7 failed");
+ if (enum_thorough_simple.scientistsTest8(galileo) != galileo) throw new Exception("scientistsTest Global 8 failed");
+ }
+ {
+ TClassInt t = new TClassInt();
+ int bell = TClassInt.bell;
+ int galileo = TemplateClassInt.galileo;
+ if (t.scientistsNameTest1(bell) != bell) throw new Exception("scientistsNameTest 1 failed");
+ if (t.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest 2 failed");
+ if (t.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest 3 failed");
+ if (t.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest 4 failed");
+ if (t.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest 5 failed");
+ if (t.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest 6 failed");
+ if (t.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest 7 failed");
+ if (t.scientistsNameTest8(bell) != bell) throw new Exception("scientistsNameTest 8 failed");
+ if (t.scientistsNameTest9(bell) != bell) throw new Exception("scientistsNameTest 9 failed");
+// if (t.scientistsNameTestA(bell) != bell) throw new Exception("scientistsNameTest A failed");
+ if (t.scientistsNameTestB(bell) != bell) throw new Exception("scientistsNameTest B failed");
+// if (t.scientistsNameTestC(bell) != bell) throw new Exception("scientistsNameTest C failed");
+ if (t.scientistsNameTestD(bell) != bell) throw new Exception("scientistsNameTest D failed");
+ if (t.scientistsNameTestE(bell) != bell) throw new Exception("scientistsNameTest E failed");
+ if (t.scientistsNameTestF(bell) != bell) throw new Exception("scientistsNameTest F failed");
+ if (t.scientistsNameTestG(bell) != bell) throw new Exception("scientistsNameTest G failed");
+ if (t.scientistsNameTestH(bell) != bell) throw new Exception("scientistsNameTest H failed");
+ if (t.scientistsNameTestI(bell) != bell) throw new Exception("scientistsNameTest I failed");
+
+ if (t.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest 1 failed");
+ if (t.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest 2 failed");
+ if (t.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest 3 failed");
+ if (t.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest 4 failed");
+ if (t.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest 5 failed");
+ if (t.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest 6 failed");
+ if (t.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest 7 failed");
+
+ if (t.scientistsOtherTest1(galileo) != galileo) throw new Exception("scientistsOtherTest 1 failed");
+ if (t.scientistsOtherTest2(galileo) != galileo) throw new Exception("scientistsOtherTest 2 failed");
+ if (t.scientistsOtherTest3(galileo) != galileo) throw new Exception("scientistsOtherTest 3 failed");
+ if (t.scientistsOtherTest4(galileo) != galileo) throw new Exception("scientistsOtherTest 4 failed");
+ if (t.scientistsOtherTest5(galileo) != galileo) throw new Exception("scientistsOtherTest 5 failed");
+ if (t.scientistsOtherTest6(galileo) != galileo) throw new Exception("scientistsOtherTest 6 failed");
+ if (t.scientistsOtherTest7(galileo) != galileo) throw new Exception("scientistsOtherTest 7 failed");
+
+ if (enum_thorough_simple.scientistsNameTest1(bell) != bell) throw new Exception("scientistsNameTest Global 1 failed");
+ if (enum_thorough_simple.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest Global 2 failed");
+ if (enum_thorough_simple.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest Global 3 failed");
+ if (enum_thorough_simple.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest Global 4 failed");
+ if (enum_thorough_simple.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest Global 5 failed");
+ if (enum_thorough_simple.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest Global 6 failed");
+ if (enum_thorough_simple.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest Global 7 failed");
+
+ if (enum_thorough_simple.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 1 failed");
+ if (enum_thorough_simple.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 2 failed");
+ if (enum_thorough_simple.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 3 failed");
+ if (enum_thorough_simple.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 4 failed");
+ if (enum_thorough_simple.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 5 failed");
+ if (enum_thorough_simple.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 6 failed");
+ if (enum_thorough_simple.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 7 failed");
+
+ if (enum_thorough_simple.scientistsNameSpaceTest8(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 8 failed");
+ if (enum_thorough_simple.scientistsNameSpaceTest9(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 9 failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestA(bell) != bell) throw new Exception("scientistsNameSpaceTest Global A failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestB(bell) != bell) throw new Exception("scientistsNameSpaceTest Global B failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestC(bell) != bell) throw new Exception("scientistsNameSpaceTest Global C failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestD(bell) != bell) throw new Exception("scientistsNameSpaceTest Global D failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestE(bell) != bell) throw new Exception("scientistsNameSpaceTest Global E failed");
+
+ if (enum_thorough_simple.scientistsNameSpaceTestF(bell) != bell) throw new Exception("scientistsNameSpaceTest Global F failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestG(bell) != bell) throw new Exception("scientistsNameSpaceTest Global G failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestH(bell) != bell) throw new Exception("scientistsNameSpaceTest Global H failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestI(bell) != bell) throw new Exception("scientistsNameSpaceTest Global I failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestJ(bell) != bell) throw new Exception("scientistsNameSpaceTest Global J failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestK(bell) != bell) throw new Exception("scientistsNameSpaceTest Global K failed");
+ if (enum_thorough_simple.scientistsNameSpaceTestL(bell) != bell) throw new Exception("scientistsNameSpaceTest Global L failed");
+ }
+ {
+ int val = enum_thorough_simple.argh;
+ if (enum_thorough_simple.renameTest1(val) != val) throw new Exception("renameTest Global 1 failed");
+ if (enum_thorough_simple.renameTest2(val) != val) throw new Exception("renameTest Global 2 failed");
+ }
+ {
+ NewNameStruct n = new NewNameStruct();
+ if (n.renameTest1(NewNameStruct.bang) != NewNameStruct.bang) throw new Exception("renameTest 1 failed");
+ if (n.renameTest2(NewNameStruct.bang) != NewNameStruct.bang) throw new Exception("renameTest 2 failed");
+ if (n.renameTest3(NewNameStruct.simple1) != NewNameStruct.simple1) throw new Exception("renameTest 3 failed");
+ if (n.renameTest4(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new Exception("renameTest 4 failed");
+ if (n.renameTest5(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new Exception("renameTest 5 failed");
+ if (n.renameTest6(NewNameStruct.singlename1) != NewNameStruct.singlename1) throw new Exception("renameTest 6 failed");
+ }
+ {
+ if (enum_thorough_simple.renameTest3(NewNameStruct.bang) != NewNameStruct.bang) throw new Exception("renameTest Global 3 failed");
+ if (enum_thorough_simple.renameTest4(NewNameStruct.simple1) != NewNameStruct.simple1) throw new Exception("renameTest Global 4 failed");
+ if (enum_thorough_simple.renameTest5(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new Exception("renameTest Global 5 failed");
+ if (enum_thorough_simple.renameTest6(NewNameStruct.doublename1) != NewNameStruct.doublename1) throw new Exception("renameTest Global 6 failed");
+ if (enum_thorough_simple.renameTest7(NewNameStruct.singlename1) != NewNameStruct.singlename1) throw new Exception("renameTest Global 7 failed");
+ }
+ {
+ TreesClass t = new TreesClass();
+ int pine = TreesClass.pine;
+
+ if (t.treesTest1(pine) != pine) throw new Exception("treesTest 1 failed");
+ if (t.treesTest2(pine) != pine) throw new Exception("treesTest 2 failed");
+ if (t.treesTest3(pine) != pine) throw new Exception("treesTest 3 failed");
+ if (t.treesTest4(pine) != pine) throw new Exception("treesTest 4 failed");
+ if (t.treesTest5(pine) != pine) throw new Exception("treesTest 5 failed");
+ if (t.treesTest6(pine) != pine) throw new Exception("treesTest 6 failed");
+ if (t.treesTest7(pine) != pine) throw new Exception("treesTest 7 failed");
+ if (t.treesTest8(pine) != pine) throw new Exception("treesTest 8 failed");
+ if (t.treesTest9(pine) != pine) throw new Exception("treesTest 9 failed");
+ if (t.treesTestA(pine) != pine) throw new Exception("treesTest A failed");
+ if (t.treesTestB(pine) != pine) throw new Exception("treesTest B failed");
+ if (t.treesTestC(pine) != pine) throw new Exception("treesTest C failed");
+ if (t.treesTestD(pine) != pine) throw new Exception("treesTest D failed");
+ if (t.treesTestE(pine) != pine) throw new Exception("treesTest E failed");
+ if (t.treesTestF(pine) != pine) throw new Exception("treesTest F failed");
+ if (t.treesTestG(pine) != pine) throw new Exception("treesTest G failed");
+ if (t.treesTestH(pine) != pine) throw new Exception("treesTest H failed");
+ if (t.treesTestI(pine) != pine) throw new Exception("treesTest I failed");
+ if (t.treesTestJ(pine) != pine) throw new Exception("treesTest J failed");
+ if (t.treesTestK(pine) != pine) throw new Exception("treesTest K failed");
+ if (t.treesTestL(pine) != pine) throw new Exception("treesTest L failed");
+ if (t.treesTestM(pine) != pine) throw new Exception("treesTest M failed");
+ if (t.treesTestN(pine) != pine) throw new Exception("treesTest N failed");
+ if (t.treesTestO(pine) != pine) throw new Exception("treesTest O failed");
+
+ if (enum_thorough_simple.treesTest1(pine) != pine) throw new Exception("treesTest Global 1 failed");
+ if (enum_thorough_simple.treesTest2(pine) != pine) throw new Exception("treesTest Global 2 failed");
+ if (enum_thorough_simple.treesTest3(pine) != pine) throw new Exception("treesTest Global 3 failed");
+ if (enum_thorough_simple.treesTest4(pine) != pine) throw new Exception("treesTest Global 4 failed");
+ if (enum_thorough_simple.treesTest5(pine) != pine) throw new Exception("treesTest Global 5 failed");
+ if (enum_thorough_simple.treesTest6(pine) != pine) throw new Exception("treesTest Global 6 failed");
+ if (enum_thorough_simple.treesTest7(pine) != pine) throw new Exception("treesTest Global 7 failed");
+ if (enum_thorough_simple.treesTest8(pine) != pine) throw new Exception("treesTest Global 8 failed");
+ if (enum_thorough_simple.treesTest9(pine) != pine) throw new Exception("treesTest Global 9 failed");
+ if (enum_thorough_simple.treesTestA(pine) != pine) throw new Exception("treesTest Global A failed");
+ if (enum_thorough_simple.treesTestB(pine) != pine) throw new Exception("treesTest Global B failed");
+ if (enum_thorough_simple.treesTestC(pine) != pine) throw new Exception("treesTest Global C failed");
+ if (enum_thorough_simple.treesTestD(pine) != pine) throw new Exception("treesTest Global D failed");
+ if (enum_thorough_simple.treesTestE(pine) != pine) throw new Exception("treesTest Global E failed");
+ if (enum_thorough_simple.treesTestF(pine) != pine) throw new Exception("treesTest Global F failed");
+ if (enum_thorough_simple.treesTestG(pine) != pine) throw new Exception("treesTest Global G failed");
+ if (enum_thorough_simple.treesTestH(pine) != pine) throw new Exception("treesTest Global H failed");
+ if (enum_thorough_simple.treesTestI(pine) != pine) throw new Exception("treesTest Global I failed");
+ if (enum_thorough_simple.treesTestJ(pine) != pine) throw new Exception("treesTest Global J failed");
+ if (enum_thorough_simple.treesTestK(pine) != pine) throw new Exception("treesTest Global K failed");
+ if (enum_thorough_simple.treesTestL(pine) != pine) throw new Exception("treesTest Global L failed");
+ if (enum_thorough_simple.treesTestM(pine) != pine) throw new Exception("treesTest Global M failed");
+// if (enum_thorough_simple.treesTestN(pine) != pine) throw new Exception("treesTest Global N failed");
+ if (enum_thorough_simple.treesTestO(pine) != pine) throw new Exception("treesTest Global O failed");
+ if (enum_thorough_simple.treesTestP(pine) != pine) throw new Exception("treesTest Global P failed");
+ if (enum_thorough_simple.treesTestQ(pine) != pine) throw new Exception("treesTest Global Q failed");
+ if (enum_thorough_simple.treesTestR(pine) != pine) throw new Exception("treesTest Global R failed");
+ }
+ {
+ HairStruct h = new HairStruct();
+ int ginger = HairStruct.ginger;
+
+ if (h.hairTest1(ginger) != ginger) throw new Exception("hairTest 1 failed");
+ if (h.hairTest2(ginger) != ginger) throw new Exception("hairTest 2 failed");
+ if (h.hairTest3(ginger) != ginger) throw new Exception("hairTest 3 failed");
+ if (h.hairTest4(ginger) != ginger) throw new Exception("hairTest 4 failed");
+ if (h.hairTest5(ginger) != ginger) throw new Exception("hairTest 5 failed");
+ if (h.hairTest6(ginger) != ginger) throw new Exception("hairTest 6 failed");
+ if (h.hairTest7(ginger) != ginger) throw new Exception("hairTest 7 failed");
+ if (h.hairTest8(ginger) != ginger) throw new Exception("hairTest 8 failed");
+ if (h.hairTest9(ginger) != ginger) throw new Exception("hairTest 9 failed");
+ if (h.hairTestA(ginger) != ginger) throw new Exception("hairTest A failed");
+ if (h.hairTestB(ginger) != ginger) throw new Exception("hairTest B failed");
+
+ int red = enum_thorough_simple.red;
+ if (h.colourTest1(red) != red) throw new Exception("colourTest HairStruct 1 failed");
+ if (h.colourTest2(red) != red) throw new Exception("colourTest HairStruct 2 failed");
+ if (h.namedanonTest1(enum_thorough_simple.NamedAnon2) != enum_thorough_simple.NamedAnon2) throw new Exception("namedanonTest HairStruct 1 failed");
+ if (h.namedanonspaceTest1(enum_thorough_simple.NamedAnonSpace2) != enum_thorough_simple.NamedAnonSpace2) throw new Exception("namedanonspaceTest HairStruct 1 failed");
+
+ int fir = TreesClass.fir;
+ if (h.treesGlobalTest1(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 1 failed");
+ if (h.treesGlobalTest2(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 2 failed");
+ if (h.treesGlobalTest3(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 3 failed");
+ if (h.treesGlobalTest4(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 4 failed");
+ }
+ {
+ int blonde = HairStruct.blonde;
+ if (enum_thorough_simple.hairTest1(blonde) != blonde) throw new Exception("hairTest Global 1 failed");
+ if (enum_thorough_simple.hairTest2(blonde) != blonde) throw new Exception("hairTest Global 2 failed");
+ if (enum_thorough_simple.hairTest3(blonde) != blonde) throw new Exception("hairTest Global 3 failed");
+ if (enum_thorough_simple.hairTest4(blonde) != blonde) throw new Exception("hairTest Global 4 failed");
+ if (enum_thorough_simple.hairTest5(blonde) != blonde) throw new Exception("hairTest Global 5 failed");
+ if (enum_thorough_simple.hairTest6(blonde) != blonde) throw new Exception("hairTest Global 6 failed");
+ if (enum_thorough_simple.hairTest7(blonde) != blonde) throw new Exception("hairTest Global 7 failed");
+ if (enum_thorough_simple.hairTest8(blonde) != blonde) throw new Exception("hairTest Global 8 failed");
+ if (enum_thorough_simple.hairTest9(blonde) != blonde) throw new Exception("hairTest Global 9 failed");
+ if (enum_thorough_simple.hairTestA(blonde) != blonde) throw new Exception("hairTest Global A failed");
+ if (enum_thorough_simple.hairTestB(blonde) != blonde) throw new Exception("hairTest Global B failed");
+ if (enum_thorough_simple.hairTestC(blonde) != blonde) throw new Exception("hairTest Global C failed");
+
+ if (enum_thorough_simple.hairTestA1(blonde) != blonde) throw new Exception("hairTest Global A1 failed");
+ if (enum_thorough_simple.hairTestA2(blonde) != blonde) throw new Exception("hairTest Global A2 failed");
+ if (enum_thorough_simple.hairTestA3(blonde) != blonde) throw new Exception("hairTest Global A3 failed");
+ if (enum_thorough_simple.hairTestA4(blonde) != blonde) throw new Exception("hairTest Global A4 failed");
+ if (enum_thorough_simple.hairTestA5(blonde) != blonde) throw new Exception("hairTest Global A5 failed");
+ if (enum_thorough_simple.hairTestA6(blonde) != blonde) throw new Exception("hairTest Global A6 failed");
+ if (enum_thorough_simple.hairTestA7(blonde) != blonde) throw new Exception("hairTest Global A7 failed");
+ if (enum_thorough_simple.hairTestA8(blonde) != blonde) throw new Exception("hairTest Global A8 failed");
+ if (enum_thorough_simple.hairTestA9(blonde) != blonde) throw new Exception("hairTest Global A9 failed");
+ if (enum_thorough_simple.hairTestAA(blonde) != blonde) throw new Exception("hairTest Global AA failed");
+ if (enum_thorough_simple.hairTestAB(blonde) != blonde) throw new Exception("hairTest Global AB failed");
+ if (enum_thorough_simple.hairTestAC(blonde) != blonde) throw new Exception("hairTest Global AC failed");
+
+ if (enum_thorough_simple.hairTestB1(blonde) != blonde) throw new Exception("hairTest Global B1 failed");
+ if (enum_thorough_simple.hairTestB2(blonde) != blonde) throw new Exception("hairTest Global B2 failed");
+ if (enum_thorough_simple.hairTestB3(blonde) != blonde) throw new Exception("hairTest Global B3 failed");
+ if (enum_thorough_simple.hairTestB4(blonde) != blonde) throw new Exception("hairTest Global B4 failed");
+ if (enum_thorough_simple.hairTestB5(blonde) != blonde) throw new Exception("hairTest Global B5 failed");
+ if (enum_thorough_simple.hairTestB6(blonde) != blonde) throw new Exception("hairTest Global B6 failed");
+ if (enum_thorough_simple.hairTestB7(blonde) != blonde) throw new Exception("hairTest Global B7 failed");
+ if (enum_thorough_simple.hairTestB8(blonde) != blonde) throw new Exception("hairTest Global B8 failed");
+ if (enum_thorough_simple.hairTestB9(blonde) != blonde) throw new Exception("hairTest Global B9 failed");
+ if (enum_thorough_simple.hairTestBA(blonde) != blonde) throw new Exception("hairTest Global BA failed");
+ if (enum_thorough_simple.hairTestBB(blonde) != blonde) throw new Exception("hairTest Global BB failed");
+ if (enum_thorough_simple.hairTestBC(blonde) != blonde) throw new Exception("hairTest Global BC failed");
+
+ if (enum_thorough_simple.hairTestC1(blonde) != blonde) throw new Exception("hairTest Global C1 failed");
+ if (enum_thorough_simple.hairTestC2(blonde) != blonde) throw new Exception("hairTest Global C2 failed");
+ if (enum_thorough_simple.hairTestC3(blonde) != blonde) throw new Exception("hairTest Global C3 failed");
+ if (enum_thorough_simple.hairTestC4(blonde) != blonde) throw new Exception("hairTest Global C4 failed");
+ if (enum_thorough_simple.hairTestC5(blonde) != blonde) throw new Exception("hairTest Global C5 failed");
+ if (enum_thorough_simple.hairTestC6(blonde) != blonde) throw new Exception("hairTest Global C6 failed");
+ if (enum_thorough_simple.hairTestC7(blonde) != blonde) throw new Exception("hairTest Global C7 failed");
+ if (enum_thorough_simple.hairTestC8(blonde) != blonde) throw new Exception("hairTest Global C8 failed");
+ if (enum_thorough_simple.hairTestC9(blonde) != blonde) throw new Exception("hairTest Global C9 failed");
+ if (enum_thorough_simple.hairTestCA(blonde) != blonde) throw new Exception("hairTest Global CA failed");
+ if (enum_thorough_simple.hairTestCB(blonde) != blonde) throw new Exception("hairTest Global CB failed");
+ if (enum_thorough_simple.hairTestCC(blonde) != blonde) throw new Exception("hairTest Global CC failed");
+ }
+ {
+ FirStruct f = new FirStruct();
+ int blonde = HairStruct.blonde;
+
+ if (f.hairTestFir1(blonde) != blonde) throw new Exception("hairTestFir 1 failed");
+ if (f.hairTestFir2(blonde) != blonde) throw new Exception("hairTestFir 2 failed");
+ if (f.hairTestFir3(blonde) != blonde) throw new Exception("hairTestFir 3 failed");
+ if (f.hairTestFir4(blonde) != blonde) throw new Exception("hairTestFir 4 failed");
+ if (f.hairTestFir5(blonde) != blonde) throw new Exception("hairTestFir 5 failed");
+ if (f.hairTestFir6(blonde) != blonde) throw new Exception("hairTestFir 6 failed");
+ if (f.hairTestFir7(blonde) != blonde) throw new Exception("hairTestFir 7 failed");
+ if (f.hairTestFir8(blonde) != blonde) throw new Exception("hairTestFir 8 failed");
+ if (f.hairTestFir9(blonde) != blonde) throw new Exception("hairTestFir 9 failed");
+ if (f.hairTestFirA(blonde) != blonde) throw new Exception("hairTestFir A failed");
+ }
+ {
+ enum_thorough_simple.GlobalInstance = enum_thorough_simple.globalinstance2;
+ if (enum_thorough_simple.GlobalInstance != enum_thorough_simple.globalinstance2) throw new Exception("GlobalInstance 1 failed");
+
+ Instances i = new Instances();
+ i.MemberInstance = Instances.memberinstance3;
+ if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
+ }
+ // ignore enum item tests start
+ {
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_zero) != 0) throw new Exception("ignoreATest 0 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_three) != 3) throw new Exception("ignoreATest 3 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_ten) != 10) throw new Exception("ignoreATest 10 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_eleven) != 11) throw new Exception("ignoreATest 11 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirteen) != 13) throw new Exception("ignoreATest 13 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_fourteen) != 14) throw new Exception("ignoreATest 14 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_twenty) != 20) throw new Exception("ignoreATest 20 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty) != 30) throw new Exception("ignoreATest 30 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_two) != 32) throw new Exception("ignoreATest 32 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_three) != 33) throw new Exception("ignoreATest 33 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_eleven) != 11) throw new Exception("ignoreBTest 11 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_twelve) != 12) throw new Exception("ignoreBTest 12 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_one) != 31) throw new Exception("ignoreBTest 31 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_two) != 32) throw new Exception("ignoreBTest 32 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_one) != 41) throw new Exception("ignoreBTest 41 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_two) != 42) throw new Exception("ignoreBTest 42 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_ten) != 10) throw new Exception("ignoreCTest 10 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_twelve) != 12) throw new Exception("ignoreCTest 12 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty) != 30) throw new Exception("ignoreCTest 30 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty_two) != 32) throw new Exception("ignoreCTest 32 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty) != 40) throw new Exception("ignoreCTest 40 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty_two) != 42) throw new Exception("ignoreCTest 42 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_one) != 21) throw new Exception("ignoreDTest 21 failed");
+ if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_two) != 22) throw new Exception("ignoreDTest 22 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_zero) != 0) throw new Exception("ignoreETest 0 failed");
+ if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_one) != 21) throw new Exception("ignoreETest 21 failed");
+ if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_two) != 22) throw new Exception("ignoreETest 22 failed");
+ }
+ // ignore enum item tests end
+ {
+ if (enum_thorough_simple.repeatTest(enum_thorough_simple.one) != 1) throw new Exception("repeatTest 1 failed");
+ if (enum_thorough_simple.repeatTest(enum_thorough_simple.initial) != 1) throw new Exception("repeatTest 2 failed");
+ if (enum_thorough_simple.repeatTest(enum_thorough_simple.two) != 2) throw new Exception("repeatTest 3 failed");
+ if (enum_thorough_simple.repeatTest(enum_thorough_simple.three) != 3) throw new Exception("repeatTest 4 failed");
+ if (enum_thorough_simple.repeatTest(enum_thorough_simple.llast) != 3) throw new Exception("repeatTest 5 failed");
+ if (enum_thorough_simple.repeatTest(enum_thorough_simple.end) != 3) throw new Exception("repeatTest 6 failed");
+ }
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs b/trunk/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
new file mode 100644
index 000000000..3606d1137
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
@@ -0,0 +1,410 @@
+using System;
+using enum_thorough_typesafeNamespace;
+
+public class runme {
+ static void Main() {
+ {
+ // Anonymous enums
+ int i = enum_thorough_typesafe.AnonEnum1;
+ if (enum_thorough_typesafe.ReallyAnInteger != 200) throw new Exception("Test Anon 1 failed");
+ i += enum_thorough_typesafe.AnonSpaceEnum1;
+ i += AnonStruct.AnonStructEnum1;
+ }
+ {
+ colour red = colour.red;
+ enum_thorough_typesafe.colourTest1(red);
+ enum_thorough_typesafe.colourTest2(red);
+ enum_thorough_typesafe.colourTest3(red);
+ enum_thorough_typesafe.colourTest4(red);
+ enum_thorough_typesafe.myColour = red;
+ }
+ {
+ SpeedClass s = new SpeedClass();
+ SpeedClass.speed speed = SpeedClass.speed.slow;
+ if (s.speedTest1(speed) != speed) throw new Exception("speedTest 1 failed");
+ if (s.speedTest2(speed) != speed) throw new Exception("speedTest 2 failed");
+ if (s.speedTest3(speed) != speed) throw new Exception("speedTest 3 failed");
+ if (s.speedTest4(speed) != speed) throw new Exception("speedTest 4 failed");
+ if (s.speedTest5(speed) != speed) throw new Exception("speedTest 5 failed");
+ if (s.speedTest6(speed) != speed) throw new Exception("speedTest 6 failed");
+ if (s.speedTest7(speed) != speed) throw new Exception("speedTest 7 failed");
+ if (s.speedTest8(speed) != speed) throw new Exception("speedTest 8 failed");
+
+ if (enum_thorough_typesafe.speedTest1(speed) != speed) throw new Exception("speedTest Global 1 failed");
+ if (enum_thorough_typesafe.speedTest2(speed) != speed) throw new Exception("speedTest Global 2 failed");
+ if (enum_thorough_typesafe.speedTest3(speed) != speed) throw new Exception("speedTest Global 3 failed");
+ if (enum_thorough_typesafe.speedTest4(speed) != speed) throw new Exception("speedTest Global 4 failed");
+ if (enum_thorough_typesafe.speedTest5(speed) != speed) throw new Exception("speedTest Global 5 failed");
+ }
+ {
+ SpeedClass s = new SpeedClass();
+ SpeedClass.speed slow = SpeedClass.speed.slow;
+ SpeedClass.speed lightning = SpeedClass.speed.lightning;
+
+ if (s.mySpeedtd1 != slow) throw new Exception("mySpeedtd1 1 failed");
+ if (s.mySpeedtd1.swigValue != 10) throw new Exception("mySpeedtd1 2 failed");
+
+ s.mySpeedtd1 = lightning;
+ if (s.mySpeedtd1 != lightning) throw new Exception("mySpeedtd1 3 failed");
+ if (s.mySpeedtd1.swigValue != 31) throw new Exception("mySpeedtd1 4 failed");
+ }
+ {
+ if (enum_thorough_typesafe.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new Exception("namedanonTest 1 failed");
+ }
+ {
+ twonames val = twonames.TwoNames2;
+ if (enum_thorough_typesafe.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed");
+ if (enum_thorough_typesafe.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed");
+ if (enum_thorough_typesafe.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed");
+ }
+ {
+ TwoNamesStruct t = new TwoNamesStruct();
+ TwoNamesStruct.twonames val = TwoNamesStruct.twonames.TwoNamesStruct1;
+ if (t.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed");
+ if (t.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed");
+ if (t.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed");
+ }
+ {
+ namedanonspace val = namedanonspace.NamedAnonSpace2;
+ if (enum_thorough_typesafe.namedanonspaceTest1(val) != val) throw new Exception("namedanonspaceTest 1 failed");
+ if (enum_thorough_typesafe.namedanonspaceTest2(val) != val) throw new Exception("namedanonspaceTest 2 failed");
+ if (enum_thorough_typesafe.namedanonspaceTest3(val) != val) throw new Exception("namedanonspaceTest 3 failed");
+ if (enum_thorough_typesafe.namedanonspaceTest4(val) != val) throw new Exception("namedanonspaceTest 4 failed");
+ }
+ {
+ TemplateClassInt t = new TemplateClassInt();
+ TemplateClassInt.scientists galileo = TemplateClassInt.scientists.galileo;
+
+ if (t.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest 1 failed");
+ if (t.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest 2 failed");
+ if (t.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest 3 failed");
+ if (t.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest 4 failed");
+ if (t.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest 5 failed");
+ if (t.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest 6 failed");
+ if (t.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest 7 failed");
+ if (t.scientistsTest8(galileo) != galileo) throw new Exception("scientistsTest 8 failed");
+ if (t.scientistsTest9(galileo) != galileo) throw new Exception("scientistsTest 9 failed");
+// if (t.scientistsTestA(galileo) != galileo) throw new Exception("scientistsTest A failed");
+ if (t.scientistsTestB(galileo) != galileo) throw new Exception("scientistsTest B failed");
+// if (t.scientistsTestC(galileo) != galileo) throw new Exception("scientistsTest C failed");
+ if (t.scientistsTestD(galileo) != galileo) throw new Exception("scientistsTest D failed");
+ if (t.scientistsTestE(galileo) != galileo) throw new Exception("scientistsTest E failed");
+ if (t.scientistsTestF(galileo) != galileo) throw new Exception("scientistsTest F failed");
+ if (t.scientistsTestG(galileo) != galileo) throw new Exception("scientistsTest G failed");
+ if (t.scientistsTestH(galileo) != galileo) throw new Exception("scientistsTest H failed");
+ if (t.scientistsTestI(galileo) != galileo) throw new Exception("scientistsTest I failed");
+ if (t.scientistsTestJ(galileo) != galileo) throw new Exception("scientistsTest J failed");
+
+ if (enum_thorough_typesafe.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest Global 1 failed");
+ if (enum_thorough_typesafe.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest Global 2 failed");
+ if (enum_thorough_typesafe.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest Global 3 failed");
+ if (enum_thorough_typesafe.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest Global 4 failed");
+ if (enum_thorough_typesafe.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest Global 5 failed");
+ if (enum_thorough_typesafe.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest Global 6 failed");
+ if (enum_thorough_typesafe.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest Global 7 failed");
+ if (enum_thorough_typesafe.scientistsTest8(galileo) != galileo) throw new Exception("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 Exception("scientistsNameTest 1 failed");
+ if (t.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest 2 failed");
+ if (t.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest 3 failed");
+ if (t.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest 4 failed");
+ if (t.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest 5 failed");
+ if (t.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest 6 failed");
+ if (t.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest 7 failed");
+ if (t.scientistsNameTest8(bell) != bell) throw new Exception("scientistsNameTest 8 failed");
+ if (t.scientistsNameTest9(bell) != bell) throw new Exception("scientistsNameTest 9 failed");
+// if (t.scientistsNameTestA(bell) != bell) throw new Exception("scientistsNameTest A failed");
+ if (t.scientistsNameTestB(bell) != bell) throw new Exception("scientistsNameTest B failed");
+// if (t.scientistsNameTestC(bell) != bell) throw new Exception("scientistsNameTest C failed");
+ if (t.scientistsNameTestD(bell) != bell) throw new Exception("scientistsNameTest D failed");
+ if (t.scientistsNameTestE(bell) != bell) throw new Exception("scientistsNameTest E failed");
+ if (t.scientistsNameTestF(bell) != bell) throw new Exception("scientistsNameTest F failed");
+ if (t.scientistsNameTestG(bell) != bell) throw new Exception("scientistsNameTest G failed");
+ if (t.scientistsNameTestH(bell) != bell) throw new Exception("scientistsNameTest H failed");
+ if (t.scientistsNameTestI(bell) != bell) throw new Exception("scientistsNameTest I failed");
+
+ if (t.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest 1 failed");
+ if (t.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest 2 failed");
+ if (t.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest 3 failed");
+ if (t.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest 4 failed");
+ if (t.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest 5 failed");
+ if (t.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest 6 failed");
+ if (t.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest 7 failed");
+
+ if (t.scientistsOtherTest1(galileo) != galileo) throw new Exception("scientistsOtherTest 1 failed");
+ if (t.scientistsOtherTest2(galileo) != galileo) throw new Exception("scientistsOtherTest 2 failed");
+ if (t.scientistsOtherTest3(galileo) != galileo) throw new Exception("scientistsOtherTest 3 failed");
+ if (t.scientistsOtherTest4(galileo) != galileo) throw new Exception("scientistsOtherTest 4 failed");
+ if (t.scientistsOtherTest5(galileo) != galileo) throw new Exception("scientistsOtherTest 5 failed");
+ if (t.scientistsOtherTest6(galileo) != galileo) throw new Exception("scientistsOtherTest 6 failed");
+ if (t.scientistsOtherTest7(galileo) != galileo) throw new Exception("scientistsOtherTest 7 failed");
+
+ if (enum_thorough_typesafe.scientistsNameTest1(bell) != bell) throw new Exception("scientistsNameTest Global 1 failed");
+ if (enum_thorough_typesafe.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest Global 2 failed");
+ if (enum_thorough_typesafe.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest Global 3 failed");
+ if (enum_thorough_typesafe.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest Global 4 failed");
+ if (enum_thorough_typesafe.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest Global 5 failed");
+ if (enum_thorough_typesafe.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest Global 6 failed");
+ if (enum_thorough_typesafe.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest Global 7 failed");
+
+ if (enum_thorough_typesafe.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 1 failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 2 failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 3 failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 4 failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 5 failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 6 failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 7 failed");
+
+ if (enum_thorough_typesafe.scientistsNameSpaceTest8(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 8 failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTest9(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 9 failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestA(bell) != bell) throw new Exception("scientistsNameSpaceTest Global A failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestB(bell) != bell) throw new Exception("scientistsNameSpaceTest Global B failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestC(bell) != bell) throw new Exception("scientistsNameSpaceTest Global C failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestD(bell) != bell) throw new Exception("scientistsNameSpaceTest Global D failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestE(bell) != bell) throw new Exception("scientistsNameSpaceTest Global E failed");
+
+ if (enum_thorough_typesafe.scientistsNameSpaceTestF(bell) != bell) throw new Exception("scientistsNameSpaceTest Global F failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestG(bell) != bell) throw new Exception("scientistsNameSpaceTest Global G failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestH(bell) != bell) throw new Exception("scientistsNameSpaceTest Global H failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestI(bell) != bell) throw new Exception("scientistsNameSpaceTest Global I failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestJ(bell) != bell) throw new Exception("scientistsNameSpaceTest Global J failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestK(bell) != bell) throw new Exception("scientistsNameSpaceTest Global K failed");
+ if (enum_thorough_typesafe.scientistsNameSpaceTestL(bell) != bell) throw new Exception("scientistsNameSpaceTest Global L failed");
+ }
+ {
+ newname val = newname.argh;
+ if (enum_thorough_typesafe.renameTest1(val) != val) throw new Exception("renameTest Global 1 failed");
+ if (enum_thorough_typesafe.renameTest2(val) != val) throw new Exception("renameTest Global 2 failed");
+ }
+ {
+ NewNameStruct n = new NewNameStruct();
+ if (n.renameTest1(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest 1 failed");
+ if (n.renameTest2(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest 2 failed");
+ if (n.renameTest3(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new Exception("renameTest 3 failed");
+ if (n.renameTest4(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest 4 failed");
+ if (n.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest 5 failed");
+ if (n.renameTest6(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new Exception("renameTest 6 failed");
+ }
+ {
+ if (enum_thorough_typesafe.renameTest3(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest Global 3 failed");
+ if (enum_thorough_typesafe.renameTest4(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new Exception("renameTest Global 4 failed");
+ if (enum_thorough_typesafe.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest Global 5 failed");
+ if (enum_thorough_typesafe.renameTest6(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest Global 6 failed");
+ if (enum_thorough_typesafe.renameTest7(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new Exception("renameTest Global 7 failed");
+ }
+ {
+ TreesClass t = new TreesClass();
+ TreesClass.trees pine = TreesClass.trees.pine;
+
+ if (t.treesTest1(pine) != pine) throw new Exception("treesTest 1 failed");
+ if (t.treesTest2(pine) != pine) throw new Exception("treesTest 2 failed");
+ if (t.treesTest3(pine) != pine) throw new Exception("treesTest 3 failed");
+ if (t.treesTest4(pine) != pine) throw new Exception("treesTest 4 failed");
+ if (t.treesTest5(pine) != pine) throw new Exception("treesTest 5 failed");
+ if (t.treesTest6(pine) != pine) throw new Exception("treesTest 6 failed");
+ if (t.treesTest7(pine) != pine) throw new Exception("treesTest 7 failed");
+ if (t.treesTest8(pine) != pine) throw new Exception("treesTest 8 failed");
+ if (t.treesTest9(pine) != pine) throw new Exception("treesTest 9 failed");
+ if (t.treesTestA(pine) != pine) throw new Exception("treesTest A failed");
+ if (t.treesTestB(pine) != pine) throw new Exception("treesTest B failed");
+ if (t.treesTestC(pine) != pine) throw new Exception("treesTest C failed");
+ if (t.treesTestD(pine) != pine) throw new Exception("treesTest D failed");
+ if (t.treesTestE(pine) != pine) throw new Exception("treesTest E failed");
+ if (t.treesTestF(pine) != pine) throw new Exception("treesTest F failed");
+ if (t.treesTestG(pine) != pine) throw new Exception("treesTest G failed");
+ if (t.treesTestH(pine) != pine) throw new Exception("treesTest H failed");
+ if (t.treesTestI(pine) != pine) throw new Exception("treesTest I failed");
+ if (t.treesTestJ(pine) != pine) throw new Exception("treesTest J failed");
+ if (t.treesTestK(pine) != pine) throw new Exception("treesTest K failed");
+ if (t.treesTestL(pine) != pine) throw new Exception("treesTest L failed");
+ if (t.treesTestM(pine) != pine) throw new Exception("treesTest M failed");
+ if (t.treesTestN(pine) != pine) throw new Exception("treesTest N failed");
+ if (t.treesTestO(pine) != pine) throw new Exception("treesTest O failed");
+
+ if (enum_thorough_typesafe.treesTest1(pine) != pine) throw new Exception("treesTest Global 1 failed");
+ if (enum_thorough_typesafe.treesTest2(pine) != pine) throw new Exception("treesTest Global 2 failed");
+ if (enum_thorough_typesafe.treesTest3(pine) != pine) throw new Exception("treesTest Global 3 failed");
+ if (enum_thorough_typesafe.treesTest4(pine) != pine) throw new Exception("treesTest Global 4 failed");
+ if (enum_thorough_typesafe.treesTest5(pine) != pine) throw new Exception("treesTest Global 5 failed");
+ if (enum_thorough_typesafe.treesTest6(pine) != pine) throw new Exception("treesTest Global 6 failed");
+ if (enum_thorough_typesafe.treesTest7(pine) != pine) throw new Exception("treesTest Global 7 failed");
+ if (enum_thorough_typesafe.treesTest8(pine) != pine) throw new Exception("treesTest Global 8 failed");
+ if (enum_thorough_typesafe.treesTest9(pine) != pine) throw new Exception("treesTest Global 9 failed");
+ if (enum_thorough_typesafe.treesTestA(pine) != pine) throw new Exception("treesTest Global A failed");
+ if (enum_thorough_typesafe.treesTestB(pine) != pine) throw new Exception("treesTest Global B failed");
+ if (enum_thorough_typesafe.treesTestC(pine) != pine) throw new Exception("treesTest Global C failed");
+ if (enum_thorough_typesafe.treesTestD(pine) != pine) throw new Exception("treesTest Global D failed");
+ if (enum_thorough_typesafe.treesTestE(pine) != pine) throw new Exception("treesTest Global E failed");
+ if (enum_thorough_typesafe.treesTestF(pine) != pine) throw new Exception("treesTest Global F failed");
+ if (enum_thorough_typesafe.treesTestG(pine) != pine) throw new Exception("treesTest Global G failed");
+ if (enum_thorough_typesafe.treesTestH(pine) != pine) throw new Exception("treesTest Global H failed");
+ if (enum_thorough_typesafe.treesTestI(pine) != pine) throw new Exception("treesTest Global I failed");
+ if (enum_thorough_typesafe.treesTestJ(pine) != pine) throw new Exception("treesTest Global J failed");
+ if (enum_thorough_typesafe.treesTestK(pine) != pine) throw new Exception("treesTest Global K failed");
+ if (enum_thorough_typesafe.treesTestL(pine) != pine) throw new Exception("treesTest Global L failed");
+ if (enum_thorough_typesafe.treesTestM(pine) != pine) throw new Exception("treesTest Global M failed");
+// if (enum_thorough_typesafe.treesTestN(pine) != pine) throw new Exception("treesTest Global N failed");
+ if (enum_thorough_typesafe.treesTestO(pine) != pine) throw new Exception("treesTest Global O failed");
+ if (enum_thorough_typesafe.treesTestP(pine) != pine) throw new Exception("treesTest Global P failed");
+ if (enum_thorough_typesafe.treesTestQ(pine) != pine) throw new Exception("treesTest Global Q failed");
+ if (enum_thorough_typesafe.treesTestR(pine) != pine) throw new Exception("treesTest Global R failed");
+ }
+ {
+ HairStruct h = new HairStruct();
+ HairStruct.hair ginger = HairStruct.hair.ginger;
+
+ if (h.hairTest1(ginger) != ginger) throw new Exception("hairTest 1 failed");
+ if (h.hairTest2(ginger) != ginger) throw new Exception("hairTest 2 failed");
+ if (h.hairTest3(ginger) != ginger) throw new Exception("hairTest 3 failed");
+ if (h.hairTest4(ginger) != ginger) throw new Exception("hairTest 4 failed");
+ if (h.hairTest5(ginger) != ginger) throw new Exception("hairTest 5 failed");
+ if (h.hairTest6(ginger) != ginger) throw new Exception("hairTest 6 failed");
+ if (h.hairTest7(ginger) != ginger) throw new Exception("hairTest 7 failed");
+ if (h.hairTest8(ginger) != ginger) throw new Exception("hairTest 8 failed");
+ if (h.hairTest9(ginger) != ginger) throw new Exception("hairTest 9 failed");
+ if (h.hairTestA(ginger) != ginger) throw new Exception("hairTest A failed");
+ if (h.hairTestB(ginger) != ginger) throw new Exception("hairTest B failed");
+
+ colour red = colour.red;
+ if (h.colourTest1(red) != red) throw new Exception("colourTest HairStruct 1 failed");
+ if (h.colourTest2(red) != red) throw new Exception("colourTest HairStruct 2 failed");
+ if (h.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new Exception("namedanonTest HairStruct 1 failed");
+ if (h.namedanonspaceTest1(namedanonspace.NamedAnonSpace2) != namedanonspace.NamedAnonSpace2) throw new Exception("namedanonspaceTest HairStruct 1 failed");
+
+ TreesClass.trees fir = TreesClass.trees.fir;
+ if (h.treesGlobalTest1(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 1 failed");
+ if (h.treesGlobalTest2(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 2 failed");
+ if (h.treesGlobalTest3(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 3 failed");
+ if (h.treesGlobalTest4(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 4 failed");
+ }
+ {
+ HairStruct.hair blonde = HairStruct.hair.blonde;
+ if (enum_thorough_typesafe.hairTest1(blonde) != blonde) throw new Exception("hairTest Global 1 failed");
+ if (enum_thorough_typesafe.hairTest2(blonde) != blonde) throw new Exception("hairTest Global 2 failed");
+ if (enum_thorough_typesafe.hairTest3(blonde) != blonde) throw new Exception("hairTest Global 3 failed");
+ if (enum_thorough_typesafe.hairTest4(blonde) != blonde) throw new Exception("hairTest Global 4 failed");
+ if (enum_thorough_typesafe.hairTest5(blonde) != blonde) throw new Exception("hairTest Global 5 failed");
+ if (enum_thorough_typesafe.hairTest6(blonde) != blonde) throw new Exception("hairTest Global 6 failed");
+ if (enum_thorough_typesafe.hairTest7(blonde) != blonde) throw new Exception("hairTest Global 7 failed");
+ if (enum_thorough_typesafe.hairTest8(blonde) != blonde) throw new Exception("hairTest Global 8 failed");
+ if (enum_thorough_typesafe.hairTest9(blonde) != blonde) throw new Exception("hairTest Global 9 failed");
+ if (enum_thorough_typesafe.hairTestA(blonde) != blonde) throw new Exception("hairTest Global A failed");
+ if (enum_thorough_typesafe.hairTestB(blonde) != blonde) throw new Exception("hairTest Global B failed");
+ if (enum_thorough_typesafe.hairTestC(blonde) != blonde) throw new Exception("hairTest Global C failed");
+
+ if (enum_thorough_typesafe.hairTestA1(blonde) != blonde) throw new Exception("hairTest Global A1 failed");
+ if (enum_thorough_typesafe.hairTestA2(blonde) != blonde) throw new Exception("hairTest Global A2 failed");
+ if (enum_thorough_typesafe.hairTestA3(blonde) != blonde) throw new Exception("hairTest Global A3 failed");
+ if (enum_thorough_typesafe.hairTestA4(blonde) != blonde) throw new Exception("hairTest Global A4 failed");
+ if (enum_thorough_typesafe.hairTestA5(blonde) != blonde) throw new Exception("hairTest Global A5 failed");
+ if (enum_thorough_typesafe.hairTestA6(blonde) != blonde) throw new Exception("hairTest Global A6 failed");
+ if (enum_thorough_typesafe.hairTestA7(blonde) != blonde) throw new Exception("hairTest Global A7 failed");
+ if (enum_thorough_typesafe.hairTestA8(blonde) != blonde) throw new Exception("hairTest Global A8 failed");
+ if (enum_thorough_typesafe.hairTestA9(blonde) != blonde) throw new Exception("hairTest Global A9 failed");
+ if (enum_thorough_typesafe.hairTestAA(blonde) != blonde) throw new Exception("hairTest Global AA failed");
+ if (enum_thorough_typesafe.hairTestAB(blonde) != blonde) throw new Exception("hairTest Global AB failed");
+ if (enum_thorough_typesafe.hairTestAC(blonde) != blonde) throw new Exception("hairTest Global AC failed");
+
+ if (enum_thorough_typesafe.hairTestB1(blonde) != blonde) throw new Exception("hairTest Global B1 failed");
+ if (enum_thorough_typesafe.hairTestB2(blonde) != blonde) throw new Exception("hairTest Global B2 failed");
+ if (enum_thorough_typesafe.hairTestB3(blonde) != blonde) throw new Exception("hairTest Global B3 failed");
+ if (enum_thorough_typesafe.hairTestB4(blonde) != blonde) throw new Exception("hairTest Global B4 failed");
+ if (enum_thorough_typesafe.hairTestB5(blonde) != blonde) throw new Exception("hairTest Global B5 failed");
+ if (enum_thorough_typesafe.hairTestB6(blonde) != blonde) throw new Exception("hairTest Global B6 failed");
+ if (enum_thorough_typesafe.hairTestB7(blonde) != blonde) throw new Exception("hairTest Global B7 failed");
+ if (enum_thorough_typesafe.hairTestB8(blonde) != blonde) throw new Exception("hairTest Global B8 failed");
+ if (enum_thorough_typesafe.hairTestB9(blonde) != blonde) throw new Exception("hairTest Global B9 failed");
+ if (enum_thorough_typesafe.hairTestBA(blonde) != blonde) throw new Exception("hairTest Global BA failed");
+ if (enum_thorough_typesafe.hairTestBB(blonde) != blonde) throw new Exception("hairTest Global BB failed");
+ if (enum_thorough_typesafe.hairTestBC(blonde) != blonde) throw new Exception("hairTest Global BC failed");
+
+ if (enum_thorough_typesafe.hairTestC1(blonde) != blonde) throw new Exception("hairTest Global C1 failed");
+ if (enum_thorough_typesafe.hairTestC2(blonde) != blonde) throw new Exception("hairTest Global C2 failed");
+ if (enum_thorough_typesafe.hairTestC3(blonde) != blonde) throw new Exception("hairTest Global C3 failed");
+ if (enum_thorough_typesafe.hairTestC4(blonde) != blonde) throw new Exception("hairTest Global C4 failed");
+ if (enum_thorough_typesafe.hairTestC5(blonde) != blonde) throw new Exception("hairTest Global C5 failed");
+ if (enum_thorough_typesafe.hairTestC6(blonde) != blonde) throw new Exception("hairTest Global C6 failed");
+ if (enum_thorough_typesafe.hairTestC7(blonde) != blonde) throw new Exception("hairTest Global C7 failed");
+ if (enum_thorough_typesafe.hairTestC8(blonde) != blonde) throw new Exception("hairTest Global C8 failed");
+ if (enum_thorough_typesafe.hairTestC9(blonde) != blonde) throw new Exception("hairTest Global C9 failed");
+ if (enum_thorough_typesafe.hairTestCA(blonde) != blonde) throw new Exception("hairTest Global CA failed");
+ if (enum_thorough_typesafe.hairTestCB(blonde) != blonde) throw new Exception("hairTest Global CB failed");
+ if (enum_thorough_typesafe.hairTestCC(blonde) != blonde) throw new Exception("hairTest Global CC failed");
+ }
+ {
+ FirStruct f = new FirStruct();
+ HairStruct.hair blonde = HairStruct.hair.blonde;
+
+ if (f.hairTestFir1(blonde) != blonde) throw new Exception("hairTestFir 1 failed");
+ if (f.hairTestFir2(blonde) != blonde) throw new Exception("hairTestFir 2 failed");
+ if (f.hairTestFir3(blonde) != blonde) throw new Exception("hairTestFir 3 failed");
+ if (f.hairTestFir4(blonde) != blonde) throw new Exception("hairTestFir 4 failed");
+ if (f.hairTestFir5(blonde) != blonde) throw new Exception("hairTestFir 5 failed");
+ if (f.hairTestFir6(blonde) != blonde) throw new Exception("hairTestFir 6 failed");
+ if (f.hairTestFir7(blonde) != blonde) throw new Exception("hairTestFir 7 failed");
+ if (f.hairTestFir8(blonde) != blonde) throw new Exception("hairTestFir 8 failed");
+ if (f.hairTestFir9(blonde) != blonde) throw new Exception("hairTestFir 9 failed");
+ if (f.hairTestFirA(blonde) != blonde) throw new Exception("hairTestFir A failed");
+ }
+ {
+ enum_thorough_typesafe.GlobalInstance = enum_thorough_typesafe.globalinstance2;
+ if (enum_thorough_typesafe.GlobalInstance != enum_thorough_typesafe.globalinstance2) throw new Exception("GlobalInstance 1 failed");
+
+ Instances i = new Instances();
+ i.MemberInstance = Instances.memberinstance3;
+ if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
+ }
+ // ignore enum item tests start
+ {
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue != 0) throw new Exception("ignoreATest 0 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue != 3) throw new Exception("ignoreATest 3 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue != 10) throw new Exception("ignoreATest 10 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue != 11) throw new Exception("ignoreATest 11 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue != 13) throw new Exception("ignoreATest 13 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue != 14) throw new Exception("ignoreATest 14 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue != 20) throw new Exception("ignoreATest 20 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue != 30) throw new Exception("ignoreATest 30 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue != 32) throw new Exception("ignoreATest 32 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue != 33) throw new Exception("ignoreATest 33 failed");
+ }
+ {
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue != 11) throw new Exception("ignoreBTest 11 failed");
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue != 12) throw new Exception("ignoreBTest 12 failed");
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue != 31) throw new Exception("ignoreBTest 31 failed");
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue != 32) throw new Exception("ignoreBTest 32 failed");
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue != 41) throw new Exception("ignoreBTest 41 failed");
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue != 42) throw new Exception("ignoreBTest 42 failed");
+ }
+ {
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue != 10) throw new Exception("ignoreCTest 10 failed");
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue != 12) throw new Exception("ignoreCTest 12 failed");
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue != 30) throw new Exception("ignoreCTest 30 failed");
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue != 32) throw new Exception("ignoreCTest 32 failed");
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue != 40) throw new Exception("ignoreCTest 40 failed");
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue != 42) throw new Exception("ignoreCTest 42 failed");
+ }
+ {
+ if (enum_thorough_typesafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue != 21) throw new Exception("ignoreDTest 21 failed");
+ if (enum_thorough_typesafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue != 22) throw new Exception("ignoreDTest 22 failed");
+ }
+ {
+ if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue != 0) throw new Exception("ignoreETest 0 failed");
+ if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue != 21) throw new Exception("ignoreETest 21 failed");
+ if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue != 22) throw new Exception("ignoreETest 22 failed");
+ }
+ // ignore enum item tests end
+ {
+ if (enum_thorough_typesafe.repeatTest(repeat.one).swigValue != 1) throw new Exception("repeatTest 1 failed");
+ if (enum_thorough_typesafe.repeatTest(repeat.initial).swigValue != 1) throw new Exception("repeatTest 2 failed");
+ if (enum_thorough_typesafe.repeatTest(repeat.two).swigValue != 2) throw new Exception("repeatTest 3 failed");
+ if (enum_thorough_typesafe.repeatTest(repeat.three).swigValue != 3) throw new Exception("repeatTest 4 failed");
+ if (enum_thorough_typesafe.repeatTest(repeat.llast).swigValue != 3) throw new Exception("repeatTest 5 failed");
+ if (enum_thorough_typesafe.repeatTest(repeat.end).swigValue != 3) throw new Exception("repeatTest 6 failed");
+ }
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/exception_order_runme.cs b/trunk/Examples/test-suite/csharp/exception_order_runme.cs
new file mode 100644
index 000000000..16b32983f
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/exception_order_runme.cs
@@ -0,0 +1,48 @@
+using System;
+using exception_orderNamespace;
+
+public class runme {
+ static void Main() {
+ A a = new A();
+
+ try {
+ a.foo();
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "C++ E1 exception thrown")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ try {
+ a.bar();
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "C++ E2 exception thrown")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ try {
+ a.foobar();
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "postcatch unknown")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ try {
+ a.barfoo(1);
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "C++ E1 exception thrown")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+
+ try {
+ a.barfoo(2);
+ throw new Exception("missed exception");
+ } catch (ApplicationException e) {
+ if (e.Message != "C++ E2 * exception thrown")
+ throw new ApplicationException("bad exception order: " + e.Message);
+ }
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/imports_runme.cs b/trunk/Examples/test-suite/csharp/imports_runme.cs
new file mode 100644
index 000000000..579dc8afb
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/imports_runme.cs
@@ -0,0 +1,18 @@
+using System;
+using importsNamespace;
+
+public class runme
+{
+ static void Main() {
+ B b = new B();
+ b.hello(); //call member function in A which is in a different SWIG generated library.
+ b.bye();
+
+ if (b.member_virtual_test(A.MemberEnum.memberenum1) != A.MemberEnum.memberenum2)
+ throw new Exception("Test 1 failed");
+ if (b.global_virtual_test(GlobalEnum.globalenum1) != GlobalEnum.globalenum2)
+ throw new Exception("Test 2 failed");
+
+ imports_b.global_test(A.MemberEnum.memberenum1);
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/inherit_target_language_runme.cs b/trunk/Examples/test-suite/csharp/inherit_target_language_runme.cs
new file mode 100644
index 000000000..2f9e2a75d
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/inherit_target_language_runme.cs
@@ -0,0 +1,24 @@
+using System;
+using inherit_target_languageNamespace;
+
+public class inherit_target_language_runme {
+ public static void Main() {
+ 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();
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/intermediary_classname_runme.cs b/trunk/Examples/test-suite/csharp/intermediary_classname_runme.cs
new file mode 100644
index 000000000..0ae8fba75
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/intermediary_classname_runme.cs
@@ -0,0 +1,21 @@
+
+/***********************************************************************************************
+ NOTE: This is a custom testcase and should be run using make intermediary_classname.customtest
+ ***********************************************************************************************/
+
+using System;
+using intermediary_classnameNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ // test the renamed module class is correctly named
+ double d = intermediary_classnameModule.maxdouble(10.0, 20.0);
+ if (d!=20.0) throw new Exception("Test failed");
+
+ // test the renamed intermediary class is correctly named
+ IntPtr ptr = intermediary_classname.new_vecdouble(10);
+ intermediary_classname.delete_vecdouble(new System.Runtime.InteropServices.HandleRef(null,ptr));
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/li_attribute_runme.cs b/trunk/Examples/test-suite/csharp/li_attribute_runme.cs
new file mode 100644
index 000000000..46f982637
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/li_attribute_runme.cs
@@ -0,0 +1,78 @@
+// Ported from Python li_attribute_runme.py
+
+using System;
+using li_attributeNamespace;
+
+public class li_attribute_runme {
+
+ public static void Main() {
+ A aa = new A(1,2,3);
+
+ if (aa.a != 1)
+ throw new ApplicationException("error");
+ aa.a = 3;
+ if (aa.a != 3)
+ throw new ApplicationException("error");
+
+ if (aa.b != 2)
+ throw new ApplicationException("error");
+ aa.b = 5;
+ if (aa.b != 5)
+ throw new ApplicationException("error");
+
+ if (aa.d != aa.b)
+ throw new ApplicationException("error");
+
+ if (aa.c != 3)
+ throw new ApplicationException("error");
+ //aa.c = 5;
+ //if (aa.c != 3)
+ // throw new ApplicationException("error");
+
+ Param_i pi = new Param_i(7);
+ if (pi.value != 7)
+ throw new ApplicationException("error");
+
+ pi.value=3;
+ if (pi.value != 3)
+ throw new ApplicationException("error");
+
+ B b = new B(aa);
+
+ if (b.a.c != 3)
+ throw new ApplicationException("error");
+
+ // class/struct attribute with get/set methods using return/pass by reference
+ MyFoo myFoo = new MyFoo();
+ myFoo.x = 8;
+ MyClass myClass = new MyClass();
+ myClass.Foo = myFoo;
+ if (myClass.Foo.x != 8)
+ throw new ApplicationException("error");
+
+ // class/struct attribute with get/set methods using return/pass by value
+ MyClassVal myClassVal = new MyClassVal();
+ if (myClassVal.ReadWriteFoo.x != -1)
+ throw new ApplicationException("error");
+ if (myClassVal.ReadOnlyFoo.x != -1)
+ throw new ApplicationException("error");
+ myClassVal.ReadWriteFoo = myFoo;
+ if (myClassVal.ReadWriteFoo.x != 8)
+ throw new ApplicationException("error");
+ if (myClassVal.ReadOnlyFoo.x != 8)
+ throw new ApplicationException("error");
+
+ // string attribute with get/set methods using return/pass by value
+ MyStringyClass myStringClass = new MyStringyClass("initial string");
+ if (myStringClass.ReadWriteString != "initial string")
+ throw new ApplicationException("error");
+ if (myStringClass.ReadOnlyString != "initial string")
+ throw new ApplicationException("error");
+ myStringClass.ReadWriteString = "changed string";
+ if (myStringClass.ReadWriteString != "changed string")
+ throw new ApplicationException("error");
+ if (myStringClass.ReadOnlyString != "changed string")
+ throw new ApplicationException("error");
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/li_boost_shared_ptr_bits_runme.cs b/trunk/Examples/test-suite/csharp/li_boost_shared_ptr_bits_runme.cs
new file mode 100644
index 000000000..2b8c84e1b
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/li_boost_shared_ptr_bits_runme.cs
@@ -0,0 +1,17 @@
+using System;
+using li_boost_shared_ptr_bitsNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ VectorIntHolder v = new VectorIntHolder();
+ v.Add(new IntHolder(11));
+ v.Add(new IntHolder(22));
+ v.Add(new IntHolder(33));
+
+ int sum = li_boost_shared_ptr_bits.sum(v);
+ if (sum != 66)
+ throw new ApplicationException("sum is wrong");
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/li_boost_shared_ptr_runme.cs b/trunk/Examples/test-suite/csharp/li_boost_shared_ptr_runme.cs
new file mode 100644
index 000000000..6ded989b5
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/li_boost_shared_ptr_runme.cs
@@ -0,0 +1,589 @@
+using System;
+using li_boost_shared_ptrNamespace;
+
+public class runme
+{
+ // Debugging flag
+ public static bool debug = false;
+
+ static void Main()
+ {
+ if (debug)
+ Console.WriteLine("Started");
+
+ li_boost_shared_ptr.debug_shared=debug;
+
+ // Change loop count to run for a long time to monitor memory
+ const int loopCount = 1; //50000;
+ for (int i=0; i<loopCount; i++) {
+ new runme().runtest();
+ System.GC.Collect();
+ System.GC.WaitForPendingFinalizers();
+ if (i%100 == 0) {
+ System.Threading.Thread.Sleep(1); // give some time to the lower priority finalizer thread
+ }
+ }
+
+ if (debug)
+ Console.WriteLine("Nearly finished");
+
+ int countdown = 100;
+ while (true) {
+ System.GC.Collect();
+ System.GC.WaitForPendingFinalizers();
+ System.Threading.Thread.Sleep(10);
+ if (--countdown == 0)
+ break;
+ if (Klass.getTotal_count() == 1) // Expect 1 instance - the one global variable (GlobalValue)
+ break;
+ };
+ if (Klass.getTotal_count() != 1)
+ throw new ApplicationException("Klass.total_count=" + Klass.getTotal_count());
+
+ int wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count();
+ if (wrapper_count != li_boost_shared_ptr.NOT_COUNTING)
+ if (wrapper_count != 1) // Expect 1 instance - the one global variable (GlobalSmartValue)
+ throw new ApplicationException("shared_ptr wrapper count=" + wrapper_count);
+
+ if (debug)
+ Console.WriteLine("Finished");
+ }
+
+ private void runtest() {
+ // simple shared_ptr usage - created in C++
+ {
+ Klass k = new Klass("me oh my");
+ String val = k.getValue();
+ verifyValue("me oh my", val);
+ verifyCount(1, k);
+ }
+
+ // simple shared_ptr usage - not created in C++
+ {
+ Klass k = li_boost_shared_ptr.factorycreate();
+ String val = k.getValue();
+ verifyValue("factorycreate", val);
+ verifyCount(1, k);
+ }
+
+ // pass by shared_ptr
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.smartpointertest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my smartpointertest", val);
+ verifyCount(2, k);
+ verifyCount(2, kret);
+ }
+
+ // pass by shared_ptr pointer
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.smartpointerpointertest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my smartpointerpointertest", val);
+ verifyCount(2, k);
+ verifyCount(2, kret);
+ }
+
+ // pass by shared_ptr reference
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.smartpointerreftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my smartpointerreftest", val);
+ verifyCount(2, k);
+ verifyCount(2, kret);
+ }
+
+ // pass by shared_ptr pointer reference
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.smartpointerpointerreftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my smartpointerpointerreftest", val);
+ verifyCount(2, k);
+ verifyCount(2, kret);
+ }
+
+ // const pass by shared_ptr
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.constsmartpointertest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my", val);
+ verifyCount(2, k);
+ verifyCount(2, kret);
+ }
+
+ // const pass by shared_ptr pointer
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.constsmartpointerpointertest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my", val);
+ verifyCount(2, k);
+ verifyCount(2, kret);
+ }
+
+ // const pass by shared_ptr reference
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.constsmartpointerreftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my", val);
+ verifyCount(2, k);
+ verifyCount(2, kret);
+ }
+
+ // pass by value
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.valuetest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my valuetest", val);
+ verifyCount(1, k);
+ verifyCount(1, kret);
+ }
+
+ // pass by pointer
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.pointertest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my pointertest", val);
+ verifyCount(1, k);
+ verifyCount(1, kret);
+ }
+
+ // pass by reference
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.reftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my reftest", val);
+ verifyCount(1, k);
+ verifyCount(1, kret);
+ }
+
+ // pass by pointer reference
+ {
+ Klass k = new Klass("me oh my");
+ Klass kret = li_boost_shared_ptr.pointerreftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my pointerreftest", val);
+ verifyCount(1, k);
+ verifyCount(1, kret);
+ }
+
+ // null tests
+ {
+ Klass k = null;
+
+ // TODO: add in const versions too
+ if (li_boost_shared_ptr.smartpointertest(k) != null)
+ throw new ApplicationException("return was not null");
+
+ if (li_boost_shared_ptr.smartpointerpointertest(k) != null)
+ throw new ApplicationException("return was not null");
+
+ if (li_boost_shared_ptr.smartpointerreftest(k) != null)
+ throw new ApplicationException("return was not null");
+
+ if (li_boost_shared_ptr.smartpointerpointerreftest(k) != null)
+ throw new ApplicationException("return was not null");
+
+ if (li_boost_shared_ptr.nullsmartpointerpointertest(null) != "null pointer")
+ throw new ApplicationException("not null smartpointer pointer");
+
+ try { li_boost_shared_ptr.valuetest(k); throw new ApplicationException("Failed to catch null pointer"); } catch (ArgumentNullException) {}
+
+ if (li_boost_shared_ptr.pointertest(k) != null)
+ throw new ApplicationException("return was not null");
+
+ try { li_boost_shared_ptr.reftest(k); throw new ApplicationException("Failed to catch null pointer"); } catch (ArgumentNullException) {}
+ }
+
+ // $owner
+ {
+ Klass k = li_boost_shared_ptr.pointerownertest();
+ String val = k.getValue();
+ verifyValue("pointerownertest", val);
+ verifyCount(1, k);
+ }
+ {
+ Klass k = li_boost_shared_ptr.smartpointerpointerownertest();
+ String val = k.getValue();
+ verifyValue("smartpointerpointerownertest", val);
+ verifyCount(1, k);
+ }
+
+ ////////////////////////////////// Derived classes ////////////////////////////////////////
+ // derived pass by shared_ptr
+ {
+ KlassDerived k = new KlassDerived("me oh my");
+ KlassDerived kret = li_boost_shared_ptr.derivedsmartptrtest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my derivedsmartptrtest-Derived", val);
+ verifyCount(4, k); // includes two extra references for upcasts in the proxy classes
+ verifyCount(4, kret);
+ }
+ // derived pass by shared_ptr pointer
+ {
+ KlassDerived k = new KlassDerived("me oh my");
+ KlassDerived kret = li_boost_shared_ptr.derivedsmartptrpointertest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my derivedsmartptrpointertest-Derived", val);
+ verifyCount(4, k); // includes two extra references for upcasts in the proxy classes
+ verifyCount(4, kret);
+ }
+ // derived pass by shared_ptr ref
+ {
+ KlassDerived k = new KlassDerived("me oh my");
+ KlassDerived kret = li_boost_shared_ptr.derivedsmartptrreftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my derivedsmartptrreftest-Derived", val);
+ verifyCount(4, k); // includes two extra references for upcasts in the proxy classes
+ verifyCount(4, kret);
+ }
+ // derived pass by shared_ptr pointer ref
+ {
+ KlassDerived k = new KlassDerived("me oh my");
+ KlassDerived kret = li_boost_shared_ptr.derivedsmartptrpointerreftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my derivedsmartptrpointerreftest-Derived", val);
+ verifyCount(4, k); // includes two extra references for upcasts in the proxy classes
+ verifyCount(4, kret);
+ }
+ // derived pass by pointer
+ {
+ KlassDerived k = new KlassDerived("me oh my");
+ KlassDerived kret = li_boost_shared_ptr.derivedpointertest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my derivedpointertest-Derived", val);
+ verifyCount(2, k); // includes an extra reference for the upcast in the proxy class
+ verifyCount(2, kret);
+ }
+ // derived pass by ref
+ {
+ KlassDerived k = new KlassDerived("me oh my");
+ KlassDerived kret = li_boost_shared_ptr.derivedreftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my derivedreftest-Derived", val);
+ verifyCount(2, k); // includes an extra reference for the upcast in the proxy class
+ verifyCount(2, kret);
+ }
+
+ ////////////////////////////////// Derived and base class mixed ////////////////////////////////////////
+ // pass by shared_ptr (mixed)
+ {
+ Klass k = new KlassDerived("me oh my");
+ Klass kret = li_boost_shared_ptr.smartpointertest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my smartpointertest-Derived", val);
+ verifyCount(3, k); // an extra reference for the upcast in the proxy class
+ verifyCount(3, kret);
+ }
+
+ // pass by shared_ptr pointer (mixed)
+ {
+ Klass k = new KlassDerived("me oh my");
+ Klass kret = li_boost_shared_ptr.smartpointerpointertest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my smartpointerpointertest-Derived", val);
+ verifyCount(3, k); // an extra reference for the upcast in the proxy class
+ verifyCount(3, kret);
+ }
+
+ // pass by shared_ptr reference (mixed)
+ {
+ Klass k = new KlassDerived("me oh my");
+ Klass kret = li_boost_shared_ptr.smartpointerreftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my smartpointerreftest-Derived", val);
+ verifyCount(3, k); // an extra reference for the upcast in the proxy class
+ verifyCount(3, kret);
+ }
+
+ // pass by shared_ptr pointer reference (mixed)
+ {
+ Klass k = new KlassDerived("me oh my");
+ Klass kret = li_boost_shared_ptr.smartpointerpointerreftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my smartpointerpointerreftest-Derived", val);
+ verifyCount(3, k); // an extra reference for the upcast in the proxy class
+ verifyCount(3, kret);
+ }
+
+ // pass by value (mixed)
+ {
+ Klass k = new KlassDerived("me oh my");
+ Klass kret = li_boost_shared_ptr.valuetest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my valuetest", val); // note slicing
+ verifyCount(2, k); // an extra reference for the upcast in the proxy class
+ verifyCount(1, kret);
+ }
+
+ // pass by pointer (mixed)
+ {
+ Klass k = new KlassDerived("me oh my");
+ Klass kret = li_boost_shared_ptr.pointertest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my pointertest-Derived", val);
+ verifyCount(2, k); // an extra reference for the upcast in the proxy class
+ verifyCount(1, kret);
+ }
+
+ // pass by ref (mixed)
+ {
+ Klass k = new KlassDerived("me oh my");
+ Klass kret = li_boost_shared_ptr.reftest(k);
+ String val = kret.getValue();
+ verifyValue("me oh my reftest-Derived", val);
+ verifyCount(2, k); // an extra reference for the upcast in the proxy class
+ verifyCount(1, kret);
+ }
+
+ // 3rd derived class
+ {
+ Klass k = new Klass3rdDerived("me oh my");
+ String val = k.getValue();
+ verifyValue("me oh my-3rdDerived", val);
+ verifyCount(3, k); // 3 classes in inheritance chain == 3 swigCPtr values
+ val = li_boost_shared_ptr.test3rdupcast(k);
+ verifyValue("me oh my-3rdDerived", val);
+ verifyCount(3, k);
+ }
+
+ ////////////////////////////////// Member variables ////////////////////////////////////////
+ // smart pointer by value
+ {
+ MemberVariables m = new MemberVariables();
+ Klass k = new Klass("smart member value");
+ m.SmartMemberValue = k;
+ String val = k.getValue();
+ verifyValue("smart member value", val);
+ verifyCount(2, k);
+
+ Klass kmember = m.SmartMemberValue;
+ val = kmember.getValue();
+ verifyValue("smart member value", val);
+ verifyCount(3, kmember);
+ verifyCount(3, k);
+
+ m.Dispose();
+ verifyCount(2, kmember);
+ verifyCount(2, k);
+ }
+ // smart pointer by pointer
+ {
+ MemberVariables m = new MemberVariables();
+ Klass k = new Klass("smart member pointer");
+ m.SmartMemberPointer = k;
+ String val = k.getValue();
+ verifyValue("smart member pointer", val);
+ verifyCount(1, k);
+
+ Klass kmember = m.SmartMemberPointer;
+ val = kmember.getValue();
+ verifyValue("smart member pointer", val);
+ verifyCount(2, kmember);
+ verifyCount(2, k);
+
+ m.Dispose();
+ verifyCount(2, kmember);
+ verifyCount(2, k);
+ }
+ // smart pointer by reference
+ {
+ MemberVariables m = new MemberVariables();
+ Klass k = new Klass("smart member reference");
+ m.SmartMemberReference = k;
+ String val = k.getValue();
+ verifyValue("smart member reference", val);
+ verifyCount(2, k);
+
+ Klass kmember = m.SmartMemberReference;
+ val = kmember.getValue();
+ verifyValue("smart member reference", val);
+ verifyCount(3, kmember);
+ verifyCount(3, k);
+
+ // The C++ reference refers to SmartMemberValue...
+ Klass kmemberVal = m.SmartMemberValue;
+ val = kmember.getValue();
+ verifyValue("smart member reference", val);
+ verifyCount(4, kmemberVal);
+ verifyCount(4, kmember);
+ verifyCount(4, k);
+
+ m.Dispose();
+ verifyCount(3, kmember);
+ verifyCount(3, k);
+ }
+ // plain by value
+ {
+ MemberVariables m = new MemberVariables();
+ Klass k = new Klass("plain member value");
+ m.MemberValue = k;
+ String val = k.getValue();
+ verifyValue("plain member value", val);
+ verifyCount(1, k);
+
+ Klass kmember = m.MemberValue;
+ val = kmember.getValue();
+ verifyValue("plain member value", val);
+ verifyCount(1, kmember);
+ verifyCount(1, k);
+
+ m.Dispose();
+ verifyCount(1, kmember);
+ verifyCount(1, k);
+ }
+ // plain by pointer
+ {
+ MemberVariables m = new MemberVariables();
+ Klass k = new Klass("plain member pointer");
+ m.MemberPointer = k;
+ String val = k.getValue();
+ verifyValue("plain member pointer", val);
+ verifyCount(1, k);
+
+ Klass kmember = m.MemberPointer;
+ val = kmember.getValue();
+ verifyValue("plain member pointer", val);
+ verifyCount(1, kmember);
+ verifyCount(1, k);
+
+ m.Dispose();
+ verifyCount(1, kmember);
+ verifyCount(1, k);
+ }
+ // plain by reference
+ {
+ MemberVariables m = new MemberVariables();
+ Klass k = new Klass("plain member reference");
+ m.MemberReference = k;
+ String val = k.getValue();
+ verifyValue("plain member reference", val);
+ verifyCount(1, k);
+
+ Klass kmember = m.MemberReference;
+ val = kmember.getValue();
+ verifyValue("plain member reference", val);
+ verifyCount(1, kmember);
+ verifyCount(1, k);
+
+ m.Dispose();
+ verifyCount(1, kmember);
+ verifyCount(1, k);
+ }
+
+ // null member variables
+ {
+ MemberVariables m = new MemberVariables();
+
+ // shared_ptr by value
+ Klass k = m.SmartMemberValue;
+ if (k != null)
+ throw new ApplicationException("expected null");
+ m.SmartMemberValue = null;
+ k = m.SmartMemberValue;
+ if (k != null)
+ throw new ApplicationException("expected null");
+ verifyCount(0, k);
+
+ // plain by value
+ try { m.MemberValue = null; throw new ApplicationException("Failed to catch null pointer"); } catch (ArgumentNullException) {}
+ }
+
+ ////////////////////////////////// Global variables ////////////////////////////////////////
+ // smart pointer
+ {
+ Klass kglobal = li_boost_shared_ptr.GlobalSmartValue;
+ if (kglobal != null)
+ throw new ApplicationException("expected null");
+
+ Klass k = new Klass("smart global value");
+ li_boost_shared_ptr.GlobalSmartValue = k;
+ verifyCount(2, k);
+
+ kglobal = li_boost_shared_ptr.GlobalSmartValue;
+ String val = kglobal.getValue();
+ verifyValue("smart global value", val);
+ verifyCount(3, kglobal);
+ verifyCount(3, k);
+ verifyValue("smart global value", li_boost_shared_ptr.GlobalSmartValue.getValue());
+ li_boost_shared_ptr.GlobalSmartValue = null;
+ }
+ // plain value
+ {
+ Klass kglobal;
+
+ Klass k = new Klass("global value");
+ li_boost_shared_ptr.GlobalValue = k;
+ verifyCount(1, k);
+
+ kglobal = li_boost_shared_ptr.GlobalValue;
+ String val = kglobal.getValue();
+ verifyValue("global value", val);
+ verifyCount(1, kglobal);
+ verifyCount(1, k);
+ verifyValue("global value", li_boost_shared_ptr.GlobalValue.getValue());
+
+ try { li_boost_shared_ptr.GlobalValue = null; throw new ApplicationException("Failed to catch null pointer"); } catch (ArgumentNullException) {}
+ }
+ // plain pointer
+ {
+ Klass kglobal = li_boost_shared_ptr.GlobalPointer;
+ if (kglobal != null)
+ throw new ApplicationException("expected null");
+
+ Klass k = new Klass("global pointer");
+ li_boost_shared_ptr.GlobalPointer = k;
+ verifyCount(1, k);
+
+ kglobal = li_boost_shared_ptr.GlobalPointer;
+ String val = kglobal.getValue();
+ verifyValue("global pointer", val);
+ verifyCount(1, kglobal);
+ verifyCount(1, k);
+ li_boost_shared_ptr.GlobalPointer = null;
+ }
+ // plain reference
+ {
+ Klass kglobal;
+
+ Klass k = new Klass("global reference");
+ li_boost_shared_ptr.GlobalReference = k;
+ verifyCount(1, k);
+
+ kglobal = li_boost_shared_ptr.GlobalReference;
+ String val = kglobal.getValue();
+ verifyValue("global reference", val);
+ verifyCount(1, kglobal);
+ verifyCount(1, k);
+
+ try { li_boost_shared_ptr.GlobalReference = null; throw new ApplicationException("Failed to catch null pointer"); } catch (ArgumentNullException) {}
+ }
+
+ ////////////////////////////////// Templates ////////////////////////////////////////
+ {
+ PairIntDouble pid = new PairIntDouble(10, 20.2);
+ if (pid.baseVal1 != 20 || pid.baseVal2 != 40.4)
+ throw new ApplicationException("Base values wrong");
+ if (pid.val1 != 10 || pid.val2 != 20.2)
+ throw new ApplicationException("Derived Values wrong");
+ }
+ }
+ private void verifyValue(String expected, String got) {
+ if (expected != got)
+ throw new Exception("verify value failed. Expected: " + expected + " Got: " + got);
+ }
+ private void verifyCount(int expected, Klass k) {
+ int got = li_boost_shared_ptr.use_count(k);
+ if (expected != got)
+ throw new Exception("verify use_count failed. Expected: " + expected + " Got: " + got);
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/li_std_combinations_runme.cs b/trunk/Examples/test-suite/csharp/li_std_combinations_runme.cs
new file mode 100644
index 000000000..ced9d17a3
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/li_std_combinations_runme.cs
@@ -0,0 +1,31 @@
+using System;
+using li_std_combinationsNamespace;
+
+public class li_std_combinations_runme {
+ public static void Main() {
+ VectorPairIntString vpis = new VectorPairIntString();
+ vpis.Add(new PairIntString(123, "one hundred and twenty three"));
+
+ VectorString vs = new VectorString();
+ vs.Add("hi");
+ PairIntVectorString pivs = new PairIntVectorString(456, vs);
+ if (pivs.second[0] != "hi")
+ throw new ApplicationException("PairIntVectorString");
+
+ VectorVectorString vvs = new VectorVectorString();
+ vvs.Add(vs);
+
+ PairIntPairIntString pipis = new PairIntPairIntString(12, new PairIntString(3, "4"));
+ if (pipis.first != 12)
+ throw new ApplicationException("PairIntPairIntString");
+
+ PairDoubleString pds = new PairDoubleString(12.34, "okay");
+ VectorPairDoubleString vpds = new VectorPairDoubleString();
+ vpds.Add(pds);
+
+ // Check SWIG_STD_VECTOR_ENHANCED macro - it provides the Contains method
+ if (!vpds.Contains(pds))
+ throw new ApplicationException("VectorPairDoubleString");
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/li_std_except_runme.cs b/trunk/Examples/test-suite/csharp/li_std_except_runme.cs
new file mode 100644
index 000000000..86ab44892
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/li_std_except_runme.cs
@@ -0,0 +1,24 @@
+// This test tests all the methods in the C# collection wrapper
+
+using System;
+using li_std_exceptNamespace;
+
+public class li_std_except_runme {
+
+ public static void Main() {
+ Test test = new Test();
+ try { test.throw_bad_exception(); throw new Exception("throw_bad_exception failed"); } catch (ApplicationException) {}
+ try { test.throw_domain_error(); throw new Exception("throw_domain_error failed"); } catch (ApplicationException) {}
+ try { test.throw_exception(); throw new Exception("throw_exception failed"); } catch (ApplicationException) {}
+ try { test.throw_invalid_argument(); throw new Exception("throw_invalid_argument failed"); } catch (ArgumentException) {}
+ try { test.throw_length_error(); throw new Exception("throw_length_error failed"); } catch (IndexOutOfRangeException) {}
+ try { test.throw_logic_error(); throw new Exception("throw_logic_error failed"); } catch (ApplicationException) {}
+ try { test.throw_out_of_range(); throw new Exception("throw_out_of_range failed"); } catch (ArgumentOutOfRangeException) {}
+ try { test.throw_overflow_error(); throw new Exception("throw_overflow_error failed"); } catch (OverflowException) {}
+ try { test.throw_range_error(); throw new Exception("throw_range_error failed"); } catch (IndexOutOfRangeException) {}
+ try { test.throw_runtime_error(); throw new Exception("throw_runtime_error failed"); } catch (ApplicationException) {}
+ try { test.throw_underflow_error(); throw new Exception("throw_underflow_error failed"); } catch (OverflowException) {}
+ }
+
+}
+
diff --git a/trunk/Examples/test-suite/csharp/li_std_map_runme.cs b/trunk/Examples/test-suite/csharp/li_std_map_runme.cs
new file mode 100644
index 000000000..b0a5a78e4
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/li_std_map_runme.cs
@@ -0,0 +1,238 @@
+/* -----------------------------------------------------------------------------
+ * li_std_map_runme.cs
+ *
+ * SWIG C# tester for std_map.i
+ * This class tests all the functionality of the std_map.i wrapper.
+ * Upon successful testing, the main function doesn't print out anything.
+ * If any error is found - it will be printed on the screen.
+ * ----------------------------------------------------------------------------- */
+
+using System;
+using System.Collections.Generic;
+using li_std_mapNamespace;
+
+public class li_std_map_runme {
+
+ private static readonly int collectionSize = 20;
+ private static readonly int midCollection = collectionSize / 2;
+
+ public static void Main()
+ {
+ // Set up an int int map
+ StringIntMap simap = new StringIntMap();
+ for (int i = 0; i < collectionSize; i++)
+ {
+ int val = i * 18;
+ simap.Add(i.ToString(), val);
+ }
+
+ // Count property test
+ if (simap.Count != collectionSize)
+ throw new Exception("Count test failed");
+
+ // IsReadOnly property test
+ if (simap.IsReadOnly)
+ throw new Exception("IsReadOnly test failed");
+
+ // Item indexing test
+ simap["0"] = 200;
+ if (simap["0"] != 200)
+ throw new Exception("Item property test failed");
+ simap["0"] = 0 * 18;
+
+ // ContainsKey() test
+ for (int i = 0; i < collectionSize; i++)
+ {
+ if (!simap.ContainsKey(i.ToString()))
+ throw new Exception("ContainsKey test " + i + " failed");
+ }
+
+ // ContainsKey() test
+ for (int i = 0; i < collectionSize; i++)
+ {
+ if (!simap.Contains(new KeyValuePair<string, int>(i.ToString(), i * 18)))
+ throw new Exception("Contains test " + i + " failed");
+ }
+
+ // TryGetValue() test
+ int value;
+ bool rc = simap.TryGetValue("3", out value);
+ if (rc != true || value != (3 * 18))
+ throw new Exception("TryGetValue test 1 failed");
+
+ rc = simap.TryGetValue("-1", out value);
+ if (rc != false)
+ throw new Exception("TryGetValue test 2 failed");
+
+ // Keys and Values test
+ {
+ IList<string> keys = new List<string>(simap.Keys);
+ IList<int> values = new List<int>(simap.Values);
+ if (keys.Count != collectionSize)
+ throw new Exception("Keys count test failed");
+
+ if (values.Count != collectionSize)
+ throw new Exception("Values count test failed");
+
+ for (int i = 0; i < keys.Count; i++)
+ {
+ if (simap[keys[i]] != values[i])
+ throw new Exception("Keys and values test failed for index " + i);
+ }
+ }
+
+ // Add and Remove test
+ for (int i = 100; i < 103; i++)
+ {
+ simap.Add(i.ToString(), i * 18);
+ if (!simap.ContainsKey(i.ToString()) || simap[i.ToString()] != (i * 18))
+ throw new Exception("Add test failed for index " + i);
+
+ simap.Remove(i.ToString());
+ if (simap.ContainsKey(i.ToString()))
+ throw new Exception("Remove test failed for index " + i);
+ }
+
+ for (int i = 200; i < 203; i++)
+ {
+ simap.Add(new KeyValuePair<string, int>(i.ToString(), i * 18));
+ if (!simap.ContainsKey(i.ToString()) || simap[i.ToString()] != (i * 18))
+ throw new Exception("Add explicit test failed for index " + i);
+
+ simap.Remove(new KeyValuePair<string, int>(i.ToString(), i * 18));
+ if (simap.ContainsKey(i.ToString()))
+ throw new Exception("Remove explicit test failed for index " + i);
+ }
+
+ // Duplicate key test
+ try
+ {
+ simap.Add("3", 0);
+ throw new Exception("Adding duplicate key test failed");
+ }
+ catch (ArgumentException)
+ {
+ }
+
+ // CopyTo() test
+ {
+ KeyValuePair<string, int>[] outputarray = new KeyValuePair<string, int>[collectionSize];
+ simap.CopyTo(outputarray);
+ foreach (KeyValuePair<string, int> val in outputarray)
+ {
+ if (simap[val.Key] != val.Value)
+ throw new Exception("CopyTo (1) test failed, index:" + val.Key);
+ }
+ }
+ {
+ KeyValuePair<string, int>[] outputarray = new KeyValuePair<string, int>[midCollection + collectionSize];
+ simap.CopyTo(outputarray, midCollection);
+ for (int i = midCollection; i < midCollection + collectionSize; i++)
+ {
+ KeyValuePair<string, int> val = outputarray[i];
+ if (simap[val.Key] != val.Value)
+ throw new Exception("CopyTo (2) test failed, index:" + val.Key);
+ }
+ }
+ {
+ KeyValuePair<string, int>[] outputarray = new KeyValuePair<string, int>[collectionSize - 1];
+ try
+ {
+ simap.CopyTo(outputarray);
+ throw new Exception("CopyTo (4) test failed");
+ }
+ catch (ArgumentException)
+ {
+ }
+ }
+
+ // Clear test
+ simap.Clear();
+ if (simap.Count != 0)
+ throw new Exception("Clear test failed");
+
+ // Test wrapped methods
+ for (int i = 1; i <= 5; i++)
+ {
+ simap[i.ToString()] = i;
+ }
+ double avg = li_std_map.valueAverage(simap);
+ if (avg != 3.0)
+ throw new Exception("Wrapped method valueAverage test failed. Got " + avg);
+
+ string keyStringified = li_std_map.stringifyKeys(simap);
+ if (keyStringified != " 1 2 3 4 5")
+ throw new Exception("Wrapped method stringifyKeys test failed. Got " + keyStringified);
+
+ // Test a map with a new complex type (Struct)
+ {
+ IntStructMap ismap = new IntStructMap();
+ for (int i = 0; i < 10; i++)
+ {
+ ismap.Add(i, new Struct(i * 10.1));
+ }
+
+ if (ismap.Count != 10)
+ throw new Exception("Count test on complex type map failed");
+
+ foreach (KeyValuePair<int, Struct> p in ismap)
+ {
+ if ((p.Key * 10.1) != p.Value.num)
+ throw new Exception("Iteration test on complex type map failed for index " + p.Key);
+ }
+ }
+
+ // Test a map of pointers
+ {
+ IntStructPtrMap ispmap = new IntStructPtrMap();
+ for (int i = 0; i < 10; i++)
+ {
+ ispmap.Add(i, new Struct(i * 10.1));
+ }
+
+ if (ispmap.Count != 10)
+ throw new Exception("Count test on complex type pointer map failed");
+
+ foreach (KeyValuePair<int, Struct> p in ispmap)
+ {
+ if ((p.Key * 10.1) != p.Value.num)
+ throw new Exception("Iteration test on complex type pointer map failed for index " + p.Key);
+ }
+ }
+ {
+ IntStructConstPtrMap iscpmap = new IntStructConstPtrMap();
+ for (int i = 0; i < 10; i++)
+ {
+ iscpmap.Add(i, new Struct(i * 10.1));
+ }
+
+ if (iscpmap.Count != 10)
+ throw new Exception("Count test on complex type const pointer map failed");
+
+ foreach (KeyValuePair<int, Struct> p in iscpmap)
+ {
+ if ((p.Key * 10.1) != p.Value.num)
+ throw new Exception("Iteration test on complex type const pointer map failed for index " + p.Key);
+ }
+ }
+
+ // Test complex type as key (Struct)
+ {
+ StructIntMap limap = new StructIntMap();
+ Struct s7 = new Struct(7);
+ Struct s8 = new Struct(8);
+ limap[s7] = 8;
+ if (limap[s7] != 8)
+ throw new Exception("Assignment test on complex key map failed");
+
+ if (!limap.ContainsKey(s7))
+ throw new Exception("Key test (1) on complex key map failed");
+
+ if (limap.ContainsKey(s8))
+ throw new Exception("Key test (2) on complex key map failed");
+ }
+
+ // All done
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/li_std_string_runme.cs b/trunk/Examples/test-suite/csharp/li_std_string_runme.cs
new file mode 100644
index 000000000..4c9d71384
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/li_std_string_runme.cs
@@ -0,0 +1,100 @@
+using System;
+using li_std_stringNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ // Checking expected use of %typemap(in) std::string {}
+ li_std_string.test_value("Fee");
+
+ // Checking expected result of %typemap(out) std::string {}
+ if (li_std_string.test_value("Fi") != "Fi")
+ throw new Exception("Test 1 failed");
+
+ // Verify type-checking for %typemap(in) std::string {}
+ try {
+ li_std_string.test_value(null);
+ throw new Exception("Test 2 failed");
+ } catch (ArgumentNullException) {
+ }
+
+ // Checking expected use of %typemap(in) const std::string & {}
+ li_std_string.test_const_reference("Fo");
+
+ // Checking expected result of %typemap(out) const std::string& {}
+ if (li_std_string.test_const_reference("Fum") != "Fum")
+ throw new Exception("Test 3 failed");
+
+ // Verify type-checking for %typemap(in) const std::string & {}
+ try {
+ li_std_string.test_const_reference(null);
+ throw new Exception("Test 4 failed");
+ } catch (ArgumentNullException) {
+ }
+
+ //
+ // Input and output typemaps for pointers and non-const references to
+ // std::string are *not* supported; the following tests confirm
+ // that none of these cases are slipping through.
+ //
+
+ SWIGTYPE_p_std__string stringPtr = null;
+
+ stringPtr = li_std_string.test_pointer_out();
+
+ li_std_string.test_pointer(stringPtr);
+
+ stringPtr = li_std_string.test_const_pointer_out();
+
+ li_std_string.test_const_pointer(stringPtr);
+
+ stringPtr = li_std_string.test_reference_out();
+
+ li_std_string.test_reference(stringPtr);
+
+ // Check throw exception specification
+ try {
+ li_std_string.test_throw();
+ throw new Exception("Test 5 failed");
+ } catch (ApplicationException e) {
+ if (e.Message != "test_throw message")
+ throw new Exception("Test 5 string check: " + e.Message);
+ }
+ try {
+ li_std_string.test_const_reference_throw();
+ throw new Exception("Test 6 failed");
+ } catch (ApplicationException e) {
+ if (e.Message != "test_const_reference_throw message")
+ throw new Exception("Test 6 string check: " + e.Message);
+ }
+
+ // Global variables
+ const string s = "initial string";
+ if (li_std_string.GlobalString2 != "global string 2")
+ throw new Exception("GlobalString2 test 1");
+ li_std_string.GlobalString2 = s;
+ if (li_std_string.GlobalString2 != s)
+ throw new Exception("GlobalString2 test 2");
+ if (li_std_string.ConstGlobalString != "const global string")
+ throw new Exception("ConstGlobalString test");
+
+ // Member variables
+ Structure myStructure = new Structure();
+ if (myStructure.MemberString2 != "member string 2")
+ throw new Exception("MemberString2 test 1");
+ myStructure.MemberString2 = s;
+ if (myStructure.MemberString2 != s)
+ throw new Exception("MemberString2 test 2");
+ if (myStructure.ConstMemberString != "const member string")
+ throw new Exception("ConstMemberString test");
+
+ if (Structure.StaticMemberString2 != "static member string 2")
+ throw new Exception("StaticMemberString2 test 1");
+ Structure.StaticMemberString2 = s;
+ if (Structure.StaticMemberString2 != s)
+ throw new Exception("StaticMemberString2 test 2");
+ if (Structure.ConstStaticMemberString != "const static member string")
+ throw new Exception("ConstStaticMemberString test");
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/li_std_vector_runme.cs b/trunk/Examples/test-suite/csharp/li_std_vector_runme.cs
new file mode 100644
index 000000000..617116d5a
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/li_std_vector_runme.cs
@@ -0,0 +1,638 @@
+// This test tests all the methods in the C# collection wrapper
+
+using System;
+using li_std_vectorNamespace;
+
+public class li_std_vector_runme {
+
+ private static readonly int collectionSize = 20;
+ private static readonly int midCollection = collectionSize/2;
+
+ public static DoubleVector myDoubleVector;
+ public static RealVector myRealVector;
+
+ public static void Main() {
+ // Setup collection
+ DoubleVector vect = new DoubleVector();
+ for (int i=0; i<collectionSize; i++) {
+ double num = i*10.1;
+ vect.Add(num);
+ }
+
+ // Count property test
+ if (vect.Count != collectionSize)
+ throw new Exception("Count test failed");
+
+ // IsFixedSize property test
+ if (vect.IsFixedSize)
+ throw new Exception("IsFixedSize test failed");
+
+ // IsReadOnly property test
+ if (vect.IsReadOnly)
+ throw new Exception("IsReadOnly test failed");
+
+ // Item indexing
+ vect[0] = 200.1;
+ if (vect[0] != 200.1)
+ throw new Exception("Item property test failed");
+ vect[0] = 0*10.1;
+ try {
+ vect[-1] = 777.1;
+ throw new Exception("Item out of range (1) test failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ vect[vect.Count] = 777.1;
+ throw new Exception("Item out of range (2) test failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+
+ // CopyTo() test
+ {
+ double[] outputarray = new double[collectionSize];
+ vect.CopyTo(outputarray);
+ int index = 0;
+ foreach(double val in outputarray) {
+ if (vect[index] != val)
+ throw new Exception("CopyTo (1) test failed, index:" + index);
+ index++;
+ }
+ }
+ {
+ double[] outputarray = new double[midCollection+collectionSize];
+ vect.CopyTo(outputarray, midCollection);
+ int index = midCollection;
+ foreach(double val in vect) {
+ if (outputarray[index] != val)
+ throw new Exception("CopyTo (2) test failed, index:" + index);
+ index++;
+ }
+ }
+ {
+ double[] outputarray = new double[3];
+ vect.CopyTo(10, outputarray, 1, 2);
+ if (outputarray[0] != 0.0 || outputarray[1] != vect[10] || outputarray[2] != vect[11])
+ throw new Exception("CopyTo (3) test failed");
+ }
+ {
+ double[] outputarray = new double[collectionSize-1];
+ try {
+ vect.CopyTo(outputarray);
+ throw new Exception("CopyTo (4) test failed");
+ } catch (ArgumentException) {
+ }
+ }
+#if SWIG_DOTNET_1
+ {
+ // runtime check that 2D arrays fail
+ double[,] outputarray = new double[collectionSize,collectionSize];
+ try {
+ vect.CopyTo(outputarray);
+ throw new Exception("CopyTo (5a) test failed");
+ } catch (ArgumentException) {
+ }
+ }
+#endif
+ {
+ StructVector inputvector = new StructVector();
+ int arrayLen = 10;
+ for (int i=0; i<arrayLen; i++) {
+ inputvector.Add(new Struct(i/10.0));
+ }
+ Struct[] outputarray = new Struct[arrayLen];
+ inputvector.CopyTo(outputarray);
+ for(int i=0; i<arrayLen; i++) {
+ if (outputarray[i].num != inputvector[i].num)
+ throw new Exception("CopyTo (6) test failed, i:" + i);
+ }
+ foreach (Struct s in inputvector) {
+ s.num += 20.0;
+ }
+ for(int i=0; i<arrayLen; i++) {
+ if (outputarray[i].num + 20.0 != inputvector[i].num )
+ throw new Exception("CopyTo (7) test failed (only a shallow copy was made), i:" + i);
+ }
+ }
+ {
+ try {
+ vect.CopyTo(null);
+ throw new Exception("CopyTo (8) test failed");
+ } catch (ArgumentNullException) {
+ }
+ }
+
+ // Contains() test
+ if (!vect.Contains(0*10.1))
+ throw new Exception("Contains test 1 failed");
+ if (!vect.Contains(10*10.1))
+ throw new Exception("Contains test 2 failed");
+ if (!vect.Contains(19*10.1))
+ throw new Exception("Contains test 3 failed");
+ if (vect.Contains(20*10.1))
+ throw new Exception("Contains test 4 failed");
+
+ {
+ // ICollection constructor
+ double[] doubleArray = new double[] { 0.0, 11.1, 22.2, 33.3, 44.4, 55.5, 33.3 };
+ DoubleVector dv = new DoubleVector(doubleArray);
+ if (doubleArray.Length != dv.Count)
+ throw new Exception("ICollection constructor length check failed: " + doubleArray.Length + "-" + dv.Count);
+ for (int i=0; i<doubleArray.Length; i++) {
+ if (doubleArray[i] != dv[i])
+ throw new Exception("ICollection constructor failed, index:" + i);
+ }
+ {
+ Struct[] structArray = new Struct[] { new Struct(0.0), new Struct(11.1), new Struct(22.2), new Struct(33.3) };
+ StructVector sv = new StructVector(structArray);
+ for (int i=0; i<structArray.Length; i++) {
+ structArray[i].num += 200.0;
+ }
+ for (int i=0; i<structArray.Length; i++) {
+ if (structArray[i].num != sv[i].num + 200.0)
+ throw new Exception("ICollection constructor not a deep copy, index:" + i);
+ }
+ }
+ try {
+ new DoubleVector((System.Collections.ICollection)null);
+ throw new Exception("ICollection constructor null test failed");
+ } catch (ArgumentNullException) {
+ }
+ {
+ // Collection initializer test, requires C# 3.0
+// myDoubleVector = new DoubleVector() { 123.4, 567.8, 901.2 };
+ }
+
+ // IndexOf() test
+ for (int i=0; i<collectionSize; i++) {
+ if (vect.IndexOf(i*10.1) != i)
+ throw new Exception("IndexOf test " + i + " failed");
+ }
+ if (vect.IndexOf(200.1) != -1)
+ throw new Exception("IndexOf non-existent test failed");
+ if (dv.IndexOf(33.3) != 3)
+ throw new Exception("IndexOf position test failed");
+
+ // LastIndexOf() test
+ for (int i=0; i<collectionSize; i++) {
+ if (vect.LastIndexOf(i*10.1) != i)
+ throw new Exception("LastIndexOf test " + i + " failed");
+ }
+ if (vect.LastIndexOf(200.1) != -1)
+ throw new Exception("LastIndexOf non-existent test failed");
+ if (dv.LastIndexOf(33.3) != 6)
+ throw new Exception("LastIndexOf position test failed");
+
+ // Copy constructor test
+ DoubleVector dvCopy = new DoubleVector(dv);
+ for (int i=0; i<doubleArray.Length; i++) {
+ if (doubleArray[i] != dvCopy[i])
+ throw new Exception("Copy constructor failed, index:" + i);
+ }
+ }
+ {
+ // Repeat() test
+ try {
+ myDoubleVector = DoubleVector.Repeat(77.7, -1);
+ throw new Exception("Repeat negative count test failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ DoubleVector dv = DoubleVector.Repeat(77.7, 5);
+ if (dv.Count != 5)
+ throw new Exception("Repeat count test failed");
+
+ // Also tests enumerator
+ {
+ System.Collections.IEnumerator myEnumerator = dv.GetEnumerator();
+ while ( myEnumerator.MoveNext() ) {
+ if ((double)myEnumerator.Current != 77.7)
+ throw new Exception("Repeat (1) test failed");
+ }
+ }
+#if !SWIG_DOTNET_1
+ {
+ System.Collections.Generic.IEnumerator<double> myEnumerator = dv.GetEnumerator();
+ while ( myEnumerator.MoveNext() ) {
+ if (myEnumerator.Current != 77.7)
+ throw new Exception("Repeat (2) test failed");
+ }
+ }
+#endif
+ }
+
+ {
+ // InsertRange() test
+ DoubleVector dvect = new DoubleVector();
+ for (int i=0; i<5; i++) {
+ dvect.Add(1000.0*i);
+ }
+ vect.InsertRange(midCollection, dvect);
+ if (vect.Count != collectionSize+dvect.Count)
+ throw new Exception("InsertRange test size failed");
+
+ for (int i=0; i<midCollection; i++) {
+ if (vect.IndexOf(i*10.1) != i)
+ throw new Exception("InsertRange (1) test " + i + " failed");
+ }
+ for (int i=0; i<dvect.Count; i++) {
+ if (vect[i+midCollection] != dvect[i])
+ throw new Exception("InsertRange (2) test " + i + " failed");
+ }
+ for (int i=midCollection; i<collectionSize; i++) {
+ if (vect.IndexOf(i*10.1) != i+dvect.Count)
+ throw new Exception("InsertRange (3) test " + i + " failed");
+ }
+ try {
+ vect.InsertRange(0, null);
+ throw new Exception("InsertRange (4) test failed");
+ } catch (ArgumentNullException) {
+ }
+
+ // RemoveRange() test
+ vect.RemoveRange(0, 0);
+ vect.RemoveRange(midCollection, dvect.Count);
+ if (vect.Count != collectionSize)
+ throw new Exception("RemoveRange test size failed");
+ for (int i=0; i<collectionSize; i++) {
+ if (vect.IndexOf(i*10.1) != i)
+ throw new Exception("RemoveRange test " + i + " failed");
+ }
+ try {
+ vect.RemoveRange(-1, 0);
+ throw new Exception("RemoveRange index out of range (1) test failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ vect.RemoveRange(0, -1);
+ throw new Exception("RemoveRange count out of range (2) test failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ vect.RemoveRange(collectionSize+1, 0);
+ throw new Exception("RemoveRange index and count out of range (1) test failed");
+ } catch (ArgumentException) {
+ }
+ try {
+ vect.RemoveRange(0, collectionSize+1);
+ throw new Exception("RemoveRange index and count out of range (2) test failed");
+ } catch (ArgumentException) {
+ }
+
+ // AddRange() test
+ vect.AddRange(dvect);
+ if (vect.Count != collectionSize+dvect.Count)
+ throw new Exception("AddRange test size failed");
+ for (int i=0; i<collectionSize; i++) {
+ if (vect.IndexOf(i*10.1) != i)
+ throw new Exception("AddRange (1) test " + i + " failed");
+ }
+ for (int i=0; i<dvect.Count; i++) {
+ if (vect[i+collectionSize] != dvect[i])
+ throw new Exception("AddRange (2) test " + i + " failed");
+ }
+ try {
+ vect.AddRange(null);
+ throw new Exception("AddRange (3) test failed");
+ } catch (ArgumentNullException) {
+ }
+ vect.RemoveRange(collectionSize, dvect.Count);
+
+ // GetRange() test
+ int rangeSize = 5;
+ DoubleVector returnedVec = vect.GetRange(0, 0);
+ returnedVec = vect.GetRange(midCollection, rangeSize);
+ if (returnedVec.Count != rangeSize)
+ throw new Exception("GetRange test size failed");
+ for (int i=0; i<rangeSize; i++) {
+ if (returnedVec.IndexOf((i+midCollection)*10.1) != i)
+ throw new Exception("GetRange test " + i + " failed");
+ }
+ try {
+ vect.GetRange(-1, 0);
+ throw new Exception("GetRange index out of range (1) test failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ vect.GetRange(0, -1);
+ throw new Exception("GetRange count out of range (2) test failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ vect.GetRange(collectionSize+1, 0);
+ throw new Exception("GetRange index and count out of range (1) test failed");
+ } catch (ArgumentException) {
+ }
+ try {
+ vect.GetRange(0, collectionSize+1);
+ throw new Exception("GetRange index and count out of range (2) test failed");
+ } catch (ArgumentException) {
+ }
+ {
+ StructVector inputvector = new StructVector();
+ int arrayLen = 10;
+ for (int i=0; i<arrayLen; i++) {
+ inputvector.Add(new Struct(i/10.0));
+ }
+ StructVector outputvector = inputvector.GetRange(0,arrayLen);
+ for(int i=0; i<arrayLen; i++) {
+ if (outputvector[i].num != inputvector[i].num)
+ throw new Exception("GetRange (1) test failed, i:" + i);
+ }
+ foreach (Struct s in inputvector) {
+ s.num += 20.0;
+ }
+ for(int i=0; i<arrayLen; i++) {
+ if (outputvector[i].num + 20.0 != inputvector[i].num )
+ throw new Exception("GetRange (2) test failed (only a shallow copy was made), i:" + i);
+ }
+ }
+ }
+
+ // Insert() test
+ int pos = 0;
+ int count = vect.Count;
+ vect.Insert(pos, -5.1);
+ count++;
+ if (vect.Count != count || vect[pos] != -5.1)
+ throw new Exception("Insert at beginning test failed");
+
+ pos = midCollection;
+ vect.Insert(pos, 85.1);
+ count++;
+ if (vect.Count != count || vect[pos] != 85.1)
+ throw new Exception("Insert at " + pos + " test failed");
+
+ pos = vect.Count;
+ vect.Insert(pos, 195.1);
+ count++;
+ if (vect.Count != count || vect[pos] != 195.1)
+ throw new Exception("Insert at end test failed");
+
+ pos = vect.Count+1;
+ try {
+ vect.Insert(pos, 222.1); // should throw
+ throw new Exception("Insert after end (1) test failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ if (vect.Count != count)
+ throw new Exception("Insert after end (2) test failed");
+
+ pos = -1;
+ try {
+ vect.Insert(pos, 333.1); // should throw
+ throw new Exception("Insert before start (1) test failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ if (vect.Count != count)
+ throw new Exception("Insert before start (2) test failed");
+
+ // Remove() test
+ vect.Remove(195.1);
+ count--;
+ vect.Remove(-5.1);
+ count--;
+ vect.Remove(85.1);
+ count--;
+ vect.Remove(9999.1); // element does not exist, should quietly do nothing
+ if (vect.Count != count)
+ throw new Exception("Remove count check test failed");
+ for (int i=0; i<collectionSize; i++) {
+ if (vect[i] != i*10.1)
+ throw new Exception("Remove test failed, index:" + i);
+ }
+
+ // RemoveAt() test
+ vect.Insert(0, -4.1);
+ vect.Insert(midCollection, 84.1);
+ vect.Insert(vect.Count, 194.1);
+ vect.RemoveAt(vect.Count-1);
+ vect.RemoveAt(midCollection);
+ vect.RemoveAt(0);
+ try {
+ vect.RemoveAt(-1);
+ throw new Exception("RemoveAt test (1) failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ vect.RemoveAt(vect.Count);
+ throw new Exception("RemoveAt test (2) failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ for (int i=0; i<collectionSize; i++) {
+ if (vect[i] != i*10.1)
+ throw new Exception("RemoveAt test (3) failed, index:" + i);
+ }
+
+ {
+ // Capacity test
+ try {
+ myDoubleVector = new DoubleVector(-1);
+ throw new Exception("constructor setting capacity (1) test failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+
+ DoubleVector dv = new DoubleVector(10);
+ if (dv.Capacity != 10 || dv.Count != 0)
+ throw new Exception("constructor setting capacity (2) test failed");
+ dv.Capacity = 20;
+ if (dv.Capacity != 20)
+ throw new Exception("capacity test (1) failed");
+ dv.Add(1.11);
+ try {
+ dv.Capacity = dv.Count-1;
+ throw new Exception("capacity test (2) failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+
+ // SetRange() test
+ for (int i=dv.Count; i<collectionSize; i++) {
+ dv.Add(0.0);
+ }
+ dv.SetRange(0, vect);
+ if (dv.Count != collectionSize)
+ throw new Exception("SetRange count check test failed");
+ for (int i=0; i<collectionSize; i++) {
+ if (vect[i] != dv[i])
+ throw new Exception("SetRange test (1) failed, index:" + i);
+ }
+ try {
+ dv.SetRange(-1, vect);
+ throw new Exception("SetRange test (2) failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ dv.SetRange(1, vect);
+ throw new Exception("SetRange test (3) failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ vect.SetRange(0, null);
+ throw new Exception("SetRange (4) test failed");
+ } catch (ArgumentNullException) {
+ }
+
+ // Reverse() test
+ dv.Reverse();
+ for (int i=0; i<collectionSize; i++) {
+ if (vect[i] != dv[collectionSize-i-1])
+ throw new Exception("Reverse test (1) failed, index:" + i);
+ }
+ dv.Reverse(0, collectionSize);
+ for (int i=0; i<collectionSize; i++) {
+ if (vect[i] != dv[i])
+ throw new Exception("Reverse test (2) failed, index:" + i);
+ }
+ dv.Reverse(0, 0); // should do nothing!
+ for (int i=0; i<collectionSize; i++) {
+ if (vect[i] != dv[i])
+ throw new Exception("Reverse test (3) failed, index:" + i);
+ }
+ try {
+ dv.Reverse(-1, 0);
+ throw new Exception("Reverse test (4) failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ dv.Reverse(0, -1);
+ throw new Exception("Reverse test (5) failed");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ dv.Reverse(collectionSize+1, 0);
+ throw new Exception("Reverse test (6) failed");
+ } catch (ArgumentException) {
+ }
+ try {
+ dv.Reverse(0, collectionSize+1);
+ throw new Exception("Reverse test (7) failed");
+ } catch (ArgumentException) {
+ }
+ }
+
+ // foreach test
+ {
+ int index=0;
+ foreach (double s in vect) {
+ if (s != index*10.1)
+ throw new Exception("foreach test failed, index:" + index);
+ index++;
+ }
+ }
+
+ // Clear() test
+ vect.Clear();
+ if (vect.Count != 0)
+ throw new Exception("Clear failed");
+
+ // Finally test the methods being wrapped
+ {
+ IntVector iv = new IntVector();
+ for (int i=0; i<4; i++) {
+ iv.Add(i);
+ }
+
+ double x = li_std_vector.average(iv);
+ x += li_std_vector.average( new IntVector( new int[] {1, 2, 3, 4} ) );
+ myRealVector = li_std_vector.half( new RealVector( new float[] {10F, 10.5F, 11F, 11.5F} ) );
+
+ DoubleVector dvec = new DoubleVector();
+ for (int i=0; i<10; i++) {
+ dvec.Add(i/2.0);
+ }
+ li_std_vector.halve_in_place(dvec);
+ }
+
+ // Dispose()
+ {
+ using (StructVector vs = new StructVector( new Struct[] { new Struct(0.0), new Struct(11.1) } ) )
+ using (DoubleVector vd = new DoubleVector( new double[] { 0.0, 11.1 } ) ) {
+ }
+ }
+
+ // More wrapped methods
+ {
+ RealVector v0 = li_std_vector.vecreal(new RealVector());
+ float flo = 123.456f;
+ v0.Add(flo);
+ flo = v0[0];
+
+ IntVector v1 = li_std_vector.vecintptr(new IntVector());
+ IntPtrVector v2 = li_std_vector.vecintptr(new IntPtrVector());
+ IntConstPtrVector v3 = li_std_vector.vecintconstptr(new IntConstPtrVector());
+
+ v1.Add(123);
+ v2.Clear();
+ v3.Clear();
+
+ StructVector v4 = li_std_vector.vecstruct(new StructVector());
+ StructPtrVector v5 = li_std_vector.vecstructptr(new StructPtrVector());
+ StructConstPtrVector v6 = li_std_vector.vecstructconstptr(new StructConstPtrVector());
+
+ v4.Add(new Struct(123));
+ v5.Add(new Struct(123));
+ v6.Add(new Struct(123));
+ }
+
+ // Test vectors of pointers
+ {
+ StructPtrVector inputvector = new StructPtrVector();
+ int arrayLen = 10;
+ for (int i=0; i<arrayLen; i++) {
+ inputvector.Add(new Struct(i/10.0));
+ }
+ Struct[] outputarray = new Struct[arrayLen];
+ inputvector.CopyTo(outputarray);
+ for(int i=0; i<arrayLen; i++) {
+ if (outputarray[i].num != inputvector[i].num)
+ throw new Exception("StructPtrVector test (1) failed, i:" + i);
+ }
+ foreach (Struct s in inputvector) {
+ s.num += 20.0;
+ }
+ for(int i=0; i<arrayLen; i++) {
+ if (outputarray[i].num != 20.0 + i/10.0)
+ throw new Exception("StructPtrVector test (2) failed (a deep copy was incorrectly made), i:" + i);
+ }
+
+ int rangeSize = 5;
+ int mid = arrayLen/2;
+ StructPtrVector returnedVec = inputvector.GetRange(mid, rangeSize);
+ for (int i=0; i<rangeSize; i++) {
+ if (inputvector[i+mid].num != returnedVec[i].num)
+ throw new Exception("StructPtrVector test (3) failed, i:" + i);
+ }
+ }
+
+ // Test vectors of const pointers
+ {
+ StructConstPtrVector inputvector = new StructConstPtrVector();
+ int arrayLen = 10;
+ for (int i=0; i<arrayLen; i++) {
+ inputvector.Add(new Struct(i/10.0));
+ }
+ Struct[] outputarray = new Struct[arrayLen];
+ inputvector.CopyTo(outputarray);
+ for(int i=0; i<arrayLen; i++) {
+ if (outputarray[i].num != inputvector[i].num)
+ throw new Exception("StructConstPtrVector test (1) failed, i:" + i);
+ }
+ foreach (Struct s in inputvector) {
+ s.num += 20.0;
+ }
+ for(int i=0; i<arrayLen; i++) {
+ if (outputarray[i].num != 20.0 + i/10.0)
+ throw new Exception("StructConstPtrVector test (2) failed (a deep copy was incorrectly made), i:" + i);
+ }
+
+ int rangeSize = 5;
+ int mid = arrayLen/2;
+ StructConstPtrVector returnedVec = inputvector.GetRange(mid, rangeSize);
+ for (int i=0; i<rangeSize; i++) {
+ if (inputvector[i+mid].num != returnedVec[i].num)
+ throw new Exception("StructConstPtrVector test (3) failed, i:" + i);
+ }
+ }
+
+ }
+
+}
+
diff --git a/trunk/Examples/test-suite/csharp/li_std_wstring_runme.cs b/trunk/Examples/test-suite/csharp/li_std_wstring_runme.cs
new file mode 100644
index 000000000..fe663a3e0
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/li_std_wstring_runme.cs
@@ -0,0 +1,76 @@
+using System;
+using li_std_wstringNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ char y='h';
+
+ if (li_std_wstring.test_wcvalue(y) != y)
+ throw new Exception("bad string mapping:" + li_std_wstring.test_wcvalue(y));
+
+ if (li_std_wstring.test_wcvalue_w() != 'W')
+ throw new Exception("bad string mapping:" + li_std_wstring.test_wcvalue_w());
+
+ string x="hello";
+
+ if (li_std_wstring.test_ccvalue(x) != x)
+ throw new Exception("bad string mapping");
+
+ if (li_std_wstring.test_cvalue(x) != x)
+ throw new Exception("bad string mapping");
+
+
+ if (li_std_wstring.test_value(x) != x)
+ throw new Exception("bad string mapping: " + x + li_std_wstring.test_value(x));
+
+ if (li_std_wstring.test_const_reference(x) != x)
+ throw new Exception("bad string mapping");
+
+
+ string s = "he";
+ s = s + "llo";
+
+ if (s != x)
+ throw new Exception("bad string mapping: " + s + x);
+
+ if (li_std_wstring.test_value(s) != x)
+ throw new Exception("bad string mapping");
+
+ if (li_std_wstring.test_const_reference(s) != x)
+ throw new Exception("bad string mapping");
+
+ string a = s;
+
+ if (li_std_wstring.test_value(a) != x)
+ throw new Exception("bad string mapping");
+
+ if (li_std_wstring.test_const_reference(a) != x)
+ throw new Exception("bad string mapping");
+
+ string b = " world";
+
+ if (a + b != "hello world")
+ throw new Exception("bad string mapping");
+
+ if (a + " world" != "hello world")
+ throw new Exception("bad string mapping");
+
+ if ("hello" + b != "hello world")
+ throw new Exception("bad string mapping");
+
+ s = "hello world";
+
+ B myB = new B("hi");
+
+ myB.name = "hello";
+ if (myB.name != "hello")
+ throw new Exception("bad string mapping");
+
+ myB.a = "hello";
+ if (myB.a != "hello")
+ throw new Exception("bad string mapping");
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/li_typemaps_runme.cs b/trunk/Examples/test-suite/csharp/li_typemaps_runme.cs
new file mode 100644
index 000000000..fde6e8b9f
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/li_typemaps_runme.cs
@@ -0,0 +1,101 @@
+
+// Check a few of the INPUT, OUTPUT and INOUT typemaps.
+
+using System;
+using li_typemapsNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ // Check double INPUT typemaps
+ if (li_typemaps.in_double(22.22) != 22.22) exit_test("in_double");
+ if (li_typemaps.inr_double(22.22) != 22.22) exit_test("inr_double");
+
+ // Check double OUTPUT typemaps
+ {
+ double var = 44.44;
+ li_typemaps.out_double(22.22, out var);
+ if (var != 22.22) exit_test("out_double");
+ }
+ {
+ double var = 44.44;
+ li_typemaps.outr_double(22.22, out var);
+ if (var != 22.22) exit_test("outr_double");
+ }
+
+ // Check double INOUT typemaps
+ {
+ double var = 44.44;
+ li_typemaps.inout_double(ref var);
+ if (var != 44.44) exit_test("inout_double");
+ }
+ {
+ double var = 44.44;
+ li_typemaps.inoutr_double(ref var);
+ if (var != 44.44) exit_test("inoutr_double");
+ }
+
+ // Check unsigned long long INPUT typemaps
+ if (li_typemaps.in_ulonglong(20) != 20) exit_test("in_ulonglong");
+ if (li_typemaps.inr_ulonglong(20) != 20) exit_test("inr_ulonglong");
+
+ // Check unsigned long long OUTPUT typemaps
+ {
+ ulong var = 40;
+ li_typemaps.out_ulonglong(20, out var);
+ if (var != 20) exit_test("out_ulonglong");
+ }
+ {
+ ulong var = 40;
+ li_typemaps.outr_ulonglong(20, out var);
+ if (var != 20) exit_test("outr_ulonglong");
+ }
+
+ // Check unsigned long long INOUT typemaps
+ {
+ ulong var = 40;
+ li_typemaps.inout_ulonglong(ref var);
+ if (var != 40) exit_test("inout_ulonglong");
+ }
+ {
+ ulong var = 40;
+ li_typemaps.inoutr_ulonglong(ref var);
+ if (var != 40) exit_test("inoutr_ulonglong");
+ }
+
+ // Check unsigned bool INPUT typemaps
+ if (li_typemaps.in_bool(false) != false) exit_test("in_bool");
+ if (li_typemaps.inr_bool(false) != false) exit_test("inr_bool");
+
+ // Check unsigned bool OUTPUT typemaps
+ {
+ bool var = false;
+ li_typemaps.out_bool(true, out var);
+ if (var != true) exit_test("out_bool");
+ }
+ {
+ bool var = false;
+ li_typemaps.outr_bool(true, out var);
+ if (var != true) exit_test("outr_bool");
+ }
+
+ // Check unsigned bool INOUT typemaps
+ {
+ bool var = false;
+ li_typemaps.inout_bool(ref var);
+ if (var != false) exit_test("inout_bool");
+ }
+ {
+ bool var = false;
+ li_typemaps.inoutr_bool(ref var);
+ if (var != false) exit_test("inoutr_bool");
+ }
+ }
+
+ private static void exit_test(String funcName) {
+ throw new Exception("Test FAILED in function " + funcName);
+ }
+
+}
+
diff --git a/trunk/Examples/test-suite/csharp/long_long_runme.cs b/trunk/Examples/test-suite/csharp/long_long_runme.cs
new file mode 100644
index 000000000..51d91e205
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/long_long_runme.cs
@@ -0,0 +1,41 @@
+
+// This is the long_long runtime testcase. It checks that the long long and
+// unsigned long long types work.
+
+using System;
+using long_longNamespace;
+
+public class long_long_runme {
+
+ public static void Main() {
+
+ check_ll(0L);
+ check_ll(0x7FFFFFFFFFFFFFFFL);
+ check_ll(-10);
+
+ check_ull(0);
+ check_ull(127);
+ check_ull(128);
+ check_ull(9223372036854775807); //0x7FFFFFFFFFFFFFFFL
+ check_ull(18446744073709551615); //0xFFFFFFFFFFFFFFFFL
+ }
+
+ public static void check_ll(long ll) {
+ long_long.ll = ll;
+ long ll_check = long_long.ll;
+ if (ll != ll_check) {
+ string ErrorMessage = "Runtime test using long long failed. ll=" + ll + " ll_check=" + ll_check;
+ throw new Exception(ErrorMessage);
+ }
+ }
+
+ public static void check_ull(ulong ull) {
+ long_long.ull = ull;
+ ulong ull_check = long_long.ull;
+ if (ull != ull_check) {
+ string ErrorMessage = "Runtime test using unsigned long long failed. ull=" + ull + " ull_check=" + ull_check;
+ throw new Exception(ErrorMessage);
+ }
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/member_pointer_runme.cs b/trunk/Examples/test-suite/csharp/member_pointer_runme.cs
new file mode 100644
index 000000000..ad324d474
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/member_pointer_runme.cs
@@ -0,0 +1,47 @@
+using System;
+using member_pointerNamespace;
+
+public class runme {
+ public static SWIGTYPE_m_Shape__f_void__double memberPtr = null;
+ static void Main() {
+ // Get the pointers
+
+ SWIGTYPE_m_Shape__f_void__double area_pt = member_pointer.areapt();
+ SWIGTYPE_m_Shape__f_void__double perim_pt = member_pointer.perimeterpt();
+
+ // Create some objects
+
+ Square s = new Square(10);
+
+ // Do some calculations
+
+ check( "Square area ", 100.0, member_pointer.do_op(s,area_pt) );
+ check( "Square perim", 40.0, member_pointer.do_op(s,perim_pt) );
+
+ memberPtr = member_pointer.areavar;
+ memberPtr = member_pointer.perimetervar;
+
+ // Try the variables
+ check( "Square area ", 100.0, member_pointer.do_op(s,member_pointer.areavar) );
+ check( "Square perim", 40.0, member_pointer.do_op(s,member_pointer.perimetervar) );
+
+ // Modify one of the variables
+ member_pointer.areavar = perim_pt;
+
+ check( "Square perimeter", 40.0, member_pointer.do_op(s,member_pointer.areavar) );
+
+ // Try the constants
+
+ memberPtr = member_pointer.AREAPT;
+ memberPtr = member_pointer.PERIMPT;
+ memberPtr = member_pointer.NULLPT;
+
+ check( "Square area ", 100.0, member_pointer.do_op(s,member_pointer.AREAPT) );
+ check( "Square perim", 40.0, member_pointer.do_op(s,member_pointer.PERIMPT) );
+
+ }
+ private static void check(string what, double expected, double actual) {
+ if (expected != actual)
+ throw new ApplicationException("Failed: " + what + " Expected: " + expected + " Actual: " + actual);
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/nspace_extend_runme.cs b/trunk/Examples/test-suite/csharp/nspace_extend_runme.cs
new file mode 100644
index 000000000..addee7fe5
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/nspace_extend_runme.cs
@@ -0,0 +1,39 @@
+using System;
+
+public class runme
+{
+ static void Main()
+ {
+ {
+ // constructors and destructors
+ nspace_extendNamespace.Outer.Inner1.Color color1 = new nspace_extendNamespace.Outer.Inner1.Color();
+ nspace_extendNamespace.Outer.Inner1.Color color = new nspace_extendNamespace.Outer.Inner1.Color(color1);
+ color1.Dispose();
+ color1 = null;
+
+ // class methods
+ color.colorInstanceMethod(20.0);
+ nspace_extendNamespace.Outer.Inner1.Color.colorStaticMethod(20.0);
+ nspace_extendNamespace.Outer.Inner1.Color created = nspace_extendNamespace.Outer.Inner1.Color.create();
+ created.Dispose();
+ }
+ {
+ // constructors and destructors
+ nspace_extendNamespace.Outer.Inner2.Color color2 = new nspace_extendNamespace.Outer.Inner2.Color();
+ nspace_extendNamespace.Outer.Inner2.Color color = new nspace_extendNamespace.Outer.Inner2.Color(color2);
+ color2.Dispose();
+ color2 = null;
+
+ // class methods
+ color.colorInstanceMethod(20.0);
+ nspace_extendNamespace.Outer.Inner2.Color.colorStaticMethod(20.0);
+ nspace_extendNamespace.Outer.Inner2.Color created = nspace_extendNamespace.Outer.Inner2.Color.create();
+ created.Dispose();
+
+ // Same class different namespaces
+ nspace_extendNamespace.Outer.Inner1.Color col1 = new nspace_extendNamespace.Outer.Inner1.Color();
+ nspace_extendNamespace.Outer.Inner2.Color col2 = nspace_extendNamespace.Outer.Inner2.Color.create();
+ col2.colors(col1, col1, col2, col2, col2);
+ }
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/nspace_runme.cs b/trunk/Examples/test-suite/csharp/nspace_runme.cs
new file mode 100644
index 000000000..9cf593857
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/nspace_runme.cs
@@ -0,0 +1,76 @@
+using System;
+
+public class runme
+{
+ static void Main()
+ {
+ // constructors and destructors
+ nspaceNamespace.Outer.Inner1.Color color1 = new nspaceNamespace.Outer.Inner1.Color();
+ nspaceNamespace.Outer.Inner1.Color color = new nspaceNamespace.Outer.Inner1.Color(color1);
+ color1.Dispose();
+ color1 = null;
+
+ // class methods
+ color.colorInstanceMethod(20.0);
+ nspaceNamespace.Outer.Inner1.Color.colorStaticMethod(20.0);
+ nspaceNamespace.Outer.Inner1.Color created = nspaceNamespace.Outer.Inner1.Color.create();
+ created.Dispose();
+
+ // class enums
+ nspaceNamespace.Outer.SomeClass someClass = new nspaceNamespace.Outer.SomeClass();
+ nspaceNamespace.Outer.Inner1.Color.Channel channel = someClass.GetInner1ColorChannel();
+ if (channel != nspaceNamespace.Outer.Inner1.Color.Channel.Transmission)
+ throw new ApplicationException("Transmission wrong");
+
+ // class anonymous enums
+ int val1 = nspaceNamespace.Outer.Inner1.Color.ColorEnumVal1;
+ int val2 = nspaceNamespace.Outer.Inner1.Color.ColorEnumVal2;
+ if (val1 != 0 || val2 != 0x22)
+ throw new ApplicationException("ColorEnumVal wrong");
+
+ // instance member variables
+ color.instanceMemberVariable = 123;
+ if (color.instanceMemberVariable != 123)
+ throw new ApplicationException("instance member variable failed");
+
+ // static member variables
+ nspaceNamespace.Outer.Inner1.Color.staticMemberVariable = 789;
+ if (nspaceNamespace.Outer.Inner1.Color.staticMemberVariable != 789)
+ throw new ApplicationException("static member variable failed");
+ if (nspaceNamespace.Outer.Inner1.Color.staticConstMemberVariable != 222)
+ throw new ApplicationException("static const member variable failed");
+ if (nspaceNamespace.Outer.Inner1.Color.staticConstEnumMemberVariable != nspaceNamespace.Outer.Inner1.Color.Channel.Transmission)
+ throw new ApplicationException("static const enum member variable failed");
+
+ // check globals in a namespace don't get mangled with the nspaceNamespace option
+ nspaceNamespace.nspace.namespaceFunction(color);
+ nspaceNamespace.nspace.namespaceVar = 111;
+ if (nspaceNamespace.nspace.namespaceVar != 111)
+ throw new ApplicationException("global var failed");
+
+ // Same class different namespaces
+ nspaceNamespace.Outer.Inner1.Color col1 = new nspaceNamespace.Outer.Inner1.Color();
+ nspaceNamespace.Outer.Inner2.Color col2 = nspaceNamespace.Outer.Inner2.Color.create();
+ col2.colors(col1, col1, col2, col2, col2);
+
+ // global enums
+ nspaceNamespace.Outer.Inner1.Channel outerChannel1 = someClass.GetInner1Channel();
+ if (outerChannel1 != nspaceNamespace.Outer.Inner1.Channel.Transmission1)
+ throw new ApplicationException("Transmission1 wrong");
+ nspaceNamespace.Outer.Inner2.Channel outerChannel2 = someClass.GetInner2Channel();
+ if (outerChannel2 != nspaceNamespace.Outer.Inner2.Channel.Transmission2)
+ throw new ApplicationException("Transmission2 wrong");
+
+ // turn feature off / ignoring
+ nspaceNamespace.Outer.nspace ns = new nspaceNamespace.Outer.nspace();
+ ns.Dispose();
+ nspaceNamespace.NoNSpacePlease nons = new nspaceNamespace.NoNSpacePlease();
+ nons.Dispose();
+
+ // Derived class
+ nspaceNamespace.Outer.Inner3.Blue blue3 = new nspaceNamespace.Outer.Inner3.Blue();
+ blue3.blueInstanceMethod();
+ nspaceNamespace.Outer.Inner4.Blue blue4 = new nspaceNamespace.Outer.Inner4.Blue();
+ blue4.blueInstanceMethod();
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/operator_overload_runme.cs b/trunk/Examples/test-suite/csharp/operator_overload_runme.cs
new file mode 100644
index 000000000..294bb7e77
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/operator_overload_runme.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Threading;
+using operator_overloadNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ Op.sanity_check();
+ {
+ Op op = new Op(100);
+ Op opNew = op++;
+ if (op.i != 101) throw new Exception("operator++ postfix failed (op)");
+ if (opNew.i != 100) throw new Exception("operator++ postfix failed (opNew)");
+ }
+ {
+ Op op = new Op(100);
+ Op opNew = op--;
+ if (op.i != 99) throw new Exception("operator-- postfix failed (op)");
+ if (opNew.i != 100) throw new Exception("operator-- postfix failed (opNew)");
+ }
+ {
+ Op op = new Op(100);
+ Op opNew = ++op;
+ if (op.i != 101) throw new Exception("operator++ prefix failed (op)");
+ if (opNew.i != 101) throw new Exception("operator++ prefix failed (opNew)");
+ }
+ {
+ Op op = new Op(100);
+ Op opNew = --op;
+ if (op.i != 99) throw new Exception("operator-- prefix failed (op)");
+ if (opNew.i != 99) throw new Exception("operator-- prefix failed (opNew)");
+ }
+
+ // overloaded operator class
+ Op k = new OpDerived(3);
+ int check_k = k.IntCast();
+ Assert(check_k == 6);
+ }
+
+ public static void Assert(bool b) {
+ if (!b)
+ throw new Exception("Assertion failed");
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/overload_complicated_runme.cs b/trunk/Examples/test-suite/csharp/overload_complicated_runme.cs
new file mode 100644
index 000000000..13741827e
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/overload_complicated_runme.cs
@@ -0,0 +1,55 @@
+using System;
+using overload_complicatedNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ SWIGTYPE_p_int pInt = null;
+
+ // Check the correct constructors are available
+ Pop p = new Pop(pInt);
+
+ p = new Pop(pInt, false);
+
+ // Check overloaded in const only and pointers/references which target languages cannot disambiguate
+ if (p.hip(false) != 701)
+ throw new Exception("Test 1 failed");
+
+ if (p.hip(pInt) != 702)
+ throw new Exception("Test 2 failed");
+
+ // Reverse the order for the above
+ if (p.hop(pInt) != 805)
+ throw new Exception("Test 3 failed");
+
+ if (p.hop(false) != 801)
+ throw new Exception("Test 4 failed");
+
+ // Few more variations and order shuffled
+ if (p.pop(false) != 901)
+ throw new Exception("Test 5 failed");
+
+ if (p.pop(pInt) != 902)
+ throw new Exception("Test 6 failed");
+
+ if (p.pop() != 905)
+ throw new Exception("Test 7 failed");
+
+ // Overload on const only
+ if (p.bop(pInt) != 1001)
+ throw new Exception("Test 8 failed");
+
+ if (p.bip(pInt) != 2001)
+ throw new Exception("Test 9 failed");
+
+ // Globals
+ if (overload_complicated.muzak(false) != 3001)
+ throw new Exception("Test 10 failed");
+
+ if (overload_complicated.muzak(pInt) != 3002)
+ throw new Exception("Test 11 failed");
+ }
+}
+
+
diff --git a/trunk/Examples/test-suite/csharp/overload_template_runme.cs b/trunk/Examples/test-suite/csharp/overload_template_runme.cs
new file mode 100644
index 000000000..e25420169
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/overload_template_runme.cs
@@ -0,0 +1,152 @@
+using System;
+using overload_templateNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ int f = overload_template.foo();
+
+ f += overload_template.maximum(3,4);
+ double b = overload_template.maximum(3.4,5.2);
+ b++; // warning suppression
+
+ // mix 1
+ if (overload_template.mix1("hi") != 101)
+ throw new Exception ("mix1(const char*)");
+
+ if (overload_template.mix1(1.0, 1.0) != 102)
+ throw new Exception ("mix1(double, const double &)");
+
+ if (overload_template.mix1(1.0) != 103)
+ throw new Exception ("mix1(double)");
+
+ // mix 2
+ if (overload_template.mix2("hi") != 101)
+ throw new Exception ("mix2(const char*)");
+
+ if (overload_template.mix2(1.0, 1.0) != 102)
+ throw new Exception ("mix2(double, const double &)");
+
+ if (overload_template.mix2(1.0) != 103)
+ throw new Exception ("mix2(double)");
+
+ // mix 3
+ if (overload_template.mix3("hi") != 101)
+ throw new Exception ("mix3(const char*)");
+
+ if (overload_template.mix3(1.0, 1.0) != 102)
+ throw new Exception ("mix3(double, const double &)");
+
+ if (overload_template.mix3(1.0) != 103)
+ throw new Exception ("mix3(double)");
+
+ // Combination 1
+ if (overload_template.overtparams1(100) != 10)
+ throw new Exception ("overtparams1(int)");
+
+ if (overload_template.overtparams1(100.0, 100) != 20)
+ throw new Exception ("overtparams1(double, int)");
+
+ // Combination 2
+ if (overload_template.overtparams2(100.0, 100) != 40)
+ throw new Exception ("overtparams2(double, int)");
+
+ // Combination 3
+ if (overload_template.overloaded() != 60)
+ throw new Exception ("overloaded()");
+
+ if (overload_template.overloaded(100.0, 100) != 70)
+ throw new Exception ("overloaded(double, int)");
+
+ // Combination 4
+ if (overload_template.overloadedagain("hello") != 80)
+ throw new Exception ("overloadedagain(const char *)");
+
+ if (overload_template.overloadedagain() != 90)
+ throw new Exception ("overloadedagain(double)");
+
+ // specializations
+ if (overload_template.specialization(10) != 202)
+ throw new Exception ("specialization(int)");
+
+ if (overload_template.specialization(10.0) != 203)
+ throw new Exception ("specialization(double)");
+
+ if (overload_template.specialization(10, 10) != 204)
+ throw new Exception ("specialization(int, int)");
+
+ if (overload_template.specialization(10.0, 10.0) != 205)
+ throw new Exception ("specialization(double, double)");
+
+ if (overload_template.specialization("hi", "hi") != 201)
+ throw new Exception ("specialization(const char *, const char *)");
+
+
+ // simple specialization
+ overload_template.xyz();
+ overload_template.xyz_int();
+ overload_template.xyz_double();
+
+
+ // a bit of everything
+ if (overload_template.overload("hi") != 0)
+ throw new Exception ("overload()");
+
+ if (overload_template.overload(1) != 10)
+ throw new Exception ("overload(int t)");
+
+ if (overload_template.overload(1, 1) != 20)
+ throw new Exception ("overload(int t, const int &)");
+
+ if (overload_template.overload(1, "hello") != 30)
+ throw new Exception ("overload(int t, const char *)");
+
+ Klass k = new Klass();
+ if (overload_template.overload(k) != 10)
+ throw new Exception ("overload(Klass t)");
+
+ if (overload_template.overload(k, k) != 20)
+ throw new Exception ("overload(Klass t, const Klass &)");
+
+ if (overload_template.overload(k, "hello") != 30)
+ throw new Exception ("overload(Klass t, const char *)");
+
+ if (overload_template.overload(10.0, "hi") != 40)
+ throw new Exception ("overload(double t, const char *)");
+
+ if (overload_template.overload() != 50)
+ throw new Exception ("overload(const char *)");
+
+
+ // everything put in a namespace
+ if (overload_template.nsoverload("hi") != 1000)
+ throw new Exception ("nsoverload()");
+
+ if (overload_template.nsoverload(1) != 1010)
+ throw new Exception ("nsoverload(int t)");
+
+ if (overload_template.nsoverload(1, 1) != 1020)
+ throw new Exception ("nsoverload(int t, const int &)");
+
+ if (overload_template.nsoverload(1, "hello") != 1030)
+ throw new Exception ("nsoverload(int t, const char *)");
+
+ if (overload_template.nsoverload(k) != 1010)
+ throw new Exception ("nsoverload(Klass t)");
+
+ if (overload_template.nsoverload(k, k) != 1020)
+ throw new Exception ("nsoverload(Klass t, const Klass &)");
+
+ if (overload_template.nsoverload(k, "hello") != 1030)
+ throw new Exception ("nsoverload(Klass t, const char *)");
+
+ if (overload_template.nsoverload(10.0, "hi") != 1040)
+ throw new Exception ("nsoverload(double t, const char *)");
+
+ if (overload_template.nsoverload() != 1050)
+ throw new Exception ("nsoverload(const char *)");
+
+ }
+}
+
diff --git a/trunk/Examples/test-suite/csharp/pointer_reference_runme.cs b/trunk/Examples/test-suite/csharp/pointer_reference_runme.cs
new file mode 100644
index 000000000..d00555199
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/pointer_reference_runme.cs
@@ -0,0 +1,18 @@
+// This test tests all the methods in the C# collection wrapper
+
+using System;
+using pointer_referenceNamespace;
+
+public class pointer_reference_runme {
+
+ public static void Main() {
+ Struct s = pointer_reference.get();
+ if (s.value != 10) throw new Exception("get test failed");
+
+ Struct ss = new Struct(20);
+ pointer_reference.set(ss);
+ if (Struct.instance.value != 20) throw new Exception("set test failed");
+ }
+
+}
+
diff --git a/trunk/Examples/test-suite/csharp/preproc_constants_c_runme.cs b/trunk/Examples/test-suite/csharp/preproc_constants_c_runme.cs
new file mode 100644
index 000000000..76c684d85
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/preproc_constants_c_runme.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Reflection;
+using preproc_constants_cNamespace;
+
+// Same as preproc_constants_c.i testcase, but bool types are int instead
+public class runme {
+ static void Main() {
+ assert( typeof(int) == preproc_constants_c.CONST_INT1.GetType() );
+ assert( typeof(int) == preproc_constants_c.CONST_INT2.GetType() );
+ assert( typeof(uint) == preproc_constants_c.CONST_UINT1.GetType() );
+ assert( typeof(uint) == preproc_constants_c.CONST_UINT2.GetType() );
+ assert( typeof(uint) == preproc_constants_c.CONST_UINT3.GetType() );
+ assert( typeof(uint) == preproc_constants_c.CONST_UINT4.GetType() );
+ assert( typeof(int) == preproc_constants_c.CONST_LONG1.GetType() );
+ assert( typeof(int) == preproc_constants_c.CONST_LONG2.GetType() );
+ assert( typeof(int) == preproc_constants_c.CONST_LONG3.GetType() );
+ assert( typeof(int) == preproc_constants_c.CONST_LONG4.GetType() );
+ assert( typeof(long) == preproc_constants_c.CONST_LLONG1.GetType() );
+ assert( typeof(long) == preproc_constants_c.CONST_LLONG2.GetType() );
+ assert( typeof(long) == preproc_constants_c.CONST_LLONG3.GetType() );
+ assert( typeof(long) == preproc_constants_c.CONST_LLONG4.GetType() );
+ assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG1.GetType() );
+ assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG2.GetType() );
+ assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG3.GetType() );
+ assert( typeof(ulong) == preproc_constants_c.CONST_ULLONG4.GetType() );
+ assert( typeof(double) == preproc_constants_c.CONST_DOUBLE1.GetType() );
+ assert( typeof(double) == preproc_constants_c.CONST_DOUBLE2.GetType() );
+ assert( typeof(double) == preproc_constants_c.CONST_DOUBLE3.GetType() );
+ assert( typeof(double) == preproc_constants_c.CONST_DOUBLE4.GetType() );
+ assert( typeof(double) == preproc_constants_c.CONST_DOUBLE5.GetType() );
+ assert( typeof(double) == preproc_constants_c.CONST_DOUBLE6.GetType() );
+ assert( typeof(int) == preproc_constants_c.CONST_BOOL1.GetType() );
+ assert( typeof(int) == preproc_constants_c.CONST_BOOL2.GetType() );
+ assert( typeof(char) == preproc_constants_c.CONST_CHAR.GetType() );
+ assert( typeof(string) == preproc_constants_c.CONST_STRING1.GetType() );
+ assert( typeof(string) == preproc_constants_c.CONST_STRING2.GetType() );
+
+ assert( typeof(int) == preproc_constants_c.INT_AND_BOOL.GetType() );
+// assert( typeof(int) == preproc_constants_c.INT_AND_CHAR.GetType() );
+ assert( typeof(int) == preproc_constants_c.INT_AND_INT.GetType() );
+ assert( typeof(uint) == preproc_constants_c.INT_AND_UINT.GetType() );
+ assert( typeof(int) == preproc_constants_c.INT_AND_LONG.GetType() );
+ assert( typeof(uint) == preproc_constants_c.INT_AND_ULONG.GetType() );
+ assert( typeof(long) == preproc_constants_c.INT_AND_LLONG.GetType() );
+ assert( typeof(ulong) == preproc_constants_c.INT_AND_ULLONG.GetType() );
+ assert( typeof(int ) == preproc_constants_c.BOOL_AND_BOOL.GetType() );
+
+ assert( typeof(int) == preproc_constants_c.EXPR_MULTIPLY.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_DIVIDE.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_PLUS.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_MINUS.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_LSHIFT.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_RSHIFT.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_LTE.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_GTE.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_INEQUALITY.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_EQUALITY.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_AND.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_XOR.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_OR.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_LAND.GetType() );
+ assert( typeof(int) == preproc_constants_c.EXPR_LOR.GetType() );
+ assert( typeof(double) == preproc_constants_c.EXPR_CONDITIONAL.GetType() );
+
+ }
+ static void assert(bool assertion) {
+ if (!assertion)
+ throw new ApplicationException("test failed");
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/preproc_constants_runme.cs b/trunk/Examples/test-suite/csharp/preproc_constants_runme.cs
new file mode 100644
index 000000000..9fae5914a
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/preproc_constants_runme.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Reflection;
+using preproc_constantsNamespace;
+
+public class runme {
+ static void Main() {
+ assert( typeof(int) == preproc_constants.CONST_INT1.GetType() );
+ assert( typeof(int) == preproc_constants.CONST_INT2.GetType() );
+ assert( typeof(uint) == preproc_constants.CONST_UINT1.GetType() );
+ assert( typeof(uint) == preproc_constants.CONST_UINT2.GetType() );
+ assert( typeof(uint) == preproc_constants.CONST_UINT3.GetType() );
+ assert( typeof(uint) == preproc_constants.CONST_UINT4.GetType() );
+ assert( typeof(int) == preproc_constants.CONST_LONG1.GetType() );
+ assert( typeof(int) == preproc_constants.CONST_LONG2.GetType() );
+ assert( typeof(int) == preproc_constants.CONST_LONG3.GetType() );
+ assert( typeof(int) == preproc_constants.CONST_LONG4.GetType() );
+ assert( typeof(long) == preproc_constants.CONST_LLONG1.GetType() );
+ assert( typeof(long) == preproc_constants.CONST_LLONG2.GetType() );
+ assert( typeof(long) == preproc_constants.CONST_LLONG3.GetType() );
+ assert( typeof(long) == preproc_constants.CONST_LLONG4.GetType() );
+ assert( typeof(ulong) == preproc_constants.CONST_ULLONG1.GetType() );
+ assert( typeof(ulong) == preproc_constants.CONST_ULLONG2.GetType() );
+ assert( typeof(ulong) == preproc_constants.CONST_ULLONG3.GetType() );
+ assert( typeof(ulong) == preproc_constants.CONST_ULLONG4.GetType() );
+ assert( typeof(double) == preproc_constants.CONST_DOUBLE1.GetType() );
+ assert( typeof(double) == preproc_constants.CONST_DOUBLE2.GetType() );
+ assert( typeof(double) == preproc_constants.CONST_DOUBLE3.GetType() );
+ assert( typeof(double) == preproc_constants.CONST_DOUBLE4.GetType() );
+ assert( typeof(double) == preproc_constants.CONST_DOUBLE5.GetType() );
+ assert( typeof(double) == preproc_constants.CONST_DOUBLE6.GetType() );
+ assert( typeof(bool) == preproc_constants.CONST_BOOL1.GetType() );
+ assert( typeof(bool) == preproc_constants.CONST_BOOL2.GetType() );
+ assert( typeof(char) == preproc_constants.CONST_CHAR.GetType() );
+ assert( typeof(string) == preproc_constants.CONST_STRING1.GetType() );
+ assert( typeof(string) == preproc_constants.CONST_STRING2.GetType() );
+
+ assert( typeof(int) == preproc_constants.INT_AND_BOOL.GetType() );
+// assert( typeof(int) == preproc_constants.INT_AND_CHAR.GetType() );
+ assert( typeof(int) == preproc_constants.INT_AND_INT.GetType() );
+ assert( typeof(uint) == preproc_constants.INT_AND_UINT.GetType() );
+ assert( typeof(int) == preproc_constants.INT_AND_LONG.GetType() );
+ assert( typeof(uint) == preproc_constants.INT_AND_ULONG.GetType() );
+ assert( typeof(long) == preproc_constants.INT_AND_LLONG.GetType() );
+ assert( typeof(ulong) == preproc_constants.INT_AND_ULLONG.GetType() );
+ assert( typeof(int ) == preproc_constants.BOOL_AND_BOOL.GetType() );
+
+ assert( typeof(int) == preproc_constants.EXPR_MULTIPLY.GetType() );
+ assert( typeof(int) == preproc_constants.EXPR_DIVIDE.GetType() );
+ assert( typeof(int) == preproc_constants.EXPR_PLUS.GetType() );
+ assert( typeof(int) == preproc_constants.EXPR_MINUS.GetType() );
+ assert( typeof(int) == preproc_constants.EXPR_LSHIFT.GetType() );
+ assert( typeof(int) == preproc_constants.EXPR_RSHIFT.GetType() );
+ assert( typeof(bool) == preproc_constants.EXPR_LTE.GetType() );
+ assert( typeof(bool) == preproc_constants.EXPR_GTE.GetType() );
+ assert( typeof(bool) == preproc_constants.EXPR_INEQUALITY.GetType() );
+ assert( typeof(bool) == preproc_constants.EXPR_EQUALITY.GetType() );
+ assert( typeof(int) == preproc_constants.EXPR_AND.GetType() );
+ assert( typeof(int) == preproc_constants.EXPR_XOR.GetType() );
+ assert( typeof(int) == preproc_constants.EXPR_OR.GetType() );
+ assert( typeof(bool) == preproc_constants.EXPR_LAND.GetType() );
+ assert( typeof(bool) == preproc_constants.EXPR_LOR.GetType() );
+ assert( typeof(double) == preproc_constants.EXPR_CONDITIONAL.GetType() );
+
+ }
+ static void assert(bool assertion) {
+ if (!assertion)
+ throw new ApplicationException("test failed");
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/sizet_runme.cs b/trunk/Examples/test-suite/csharp/sizet_runme.cs
new file mode 100644
index 000000000..4852441ab
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/sizet_runme.cs
@@ -0,0 +1,18 @@
+
+using System;
+using sizetNamespace;
+
+public class sizet_runme {
+
+ public static void Main() {
+ uint s = 2000;
+ s = sizet.test1(s+1);
+ s = sizet.test2(s+1);
+ s = sizet.test3(s+1);
+ s = sizet.test4(s+1);
+ if (s != 2004)
+ throw new Exception("failed");
+ }
+
+}
+
diff --git a/trunk/Examples/test-suite/csharp/sneaky1_runme.cs b/trunk/Examples/test-suite/csharp/sneaky1_runme.cs
new file mode 100644
index 000000000..07e25700d
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/sneaky1_runme.cs
@@ -0,0 +1,20 @@
+using System;
+using sneaky1Namespace;
+
+public class runme
+{
+ static void Main()
+ {
+ if (sneaky1.add(30, 2) != 32)
+ throw new Exception("add test failed");
+
+ if (sneaky1.subtract(20, 2) != 18)
+ throw new Exception("subtract test failed");
+
+ if (sneaky1.mul(20, 2) != 40)
+ throw new Exception("mul test failed");
+
+ if (sneaky1.divide(20, 2) != 10)
+ throw new Exception("div test failed");
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/special_variable_macros_runme.cs b/trunk/Examples/test-suite/csharp/special_variable_macros_runme.cs
new file mode 100644
index 000000000..bd6fd4b04
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/special_variable_macros_runme.cs
@@ -0,0 +1,22 @@
+using System;
+using special_variable_macrosNamespace;
+
+public class runme {
+ static void Main() {
+ Name name = new Name();
+ if (special_variable_macros.testFred(name) != "none")
+ throw new Exception("test failed");
+ if (special_variable_macros.testJack(name) != "$specialname")
+ throw new Exception("test failed");
+ if (special_variable_macros.testJill(name) != "jilly")
+ throw new Exception("test failed");
+ if (special_variable_macros.testMary(name) != "SWIGTYPE_p_NameWrap")
+ throw new Exception("test failed");
+ if (special_variable_macros.testJim(name) != "multiname num")
+ throw new Exception("test failed");
+ if (special_variable_macros.testJohn(new PairIntBool(10, false)) != 123)
+ throw new Exception("test failed");
+ NewName newName = NewName.factory("factoryname");
+ name = newName.getStoredName();
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/threads_runme.cs b/trunk/Examples/test-suite/csharp/threads_runme.cs
new file mode 100644
index 000000000..fa901990c
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/threads_runme.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Threading;
+using threadsNamespace;
+
+public class runme
+{
+ static void Main()
+ {
+ Kerfuffle kerf = new Kerfuffle();
+ const int NUM_THREADS = 8;
+ Thread[] threads = new Thread[NUM_THREADS];
+ TestThread[] testThreads = new TestThread[NUM_THREADS];
+ // invoke the threads
+ for (int i=0; i<NUM_THREADS; i++) {
+ testThreads[i] = new TestThread(kerf, i);
+ threads[i] = new Thread(new ThreadStart(testThreads[i].Run));
+ threads[i].Start();
+ }
+ // wait for the threads to finish
+ for (int i=0; i<NUM_THREADS; i++) {
+ threads[i].Join();
+ }
+ for (int i=0; i<NUM_THREADS; i++) {
+ if (testThreads[i].Failed) throw new Exception("Test Failed");
+ }
+ }
+}
+
+public class TestThread {
+ private int threadId;
+ private Kerfuffle kerf;
+ public bool Failed;
+ public TestThread(Kerfuffle t, int id) {
+ kerf = t;
+ threadId = id;
+ }
+ public void Run() {
+ Failed = false;
+ try {
+ for (int i=0; i<30000; i++) { // run test for a few seconds on a 1GHz machine
+ string given = "This is the test string that should come back. A number: " + i;
+ string received = kerf.StdString(given);
+ if (received != given) {
+ throw new ApplicationException("StdString string does not match. Received:\n[" + received + "].\nExpected:\n{" + given + "}");
+ }
+ }
+ for (int i=0; i<30000; i++) { // run test for a few seconds on a 1GHz machine
+ string given = "This is the test string that should come back. A number: " + i;
+ string received = kerf.CharString(given);
+ if (received != given) {
+ throw new ApplicationException("StdString string does not match. Received:\n[" + received + "].\nExpected:\n{" + given + "}");
+ }
+ }
+ } catch (Exception e) {
+ Console.Error.WriteLine("Test failed (thread " + threadId + "): " + e.Message);
+ Failed = true;
+ }
+ }
+}
+
+
diff --git a/trunk/Examples/test-suite/csharp/throw_exception_runme.cs b/trunk/Examples/test-suite/csharp/throw_exception_runme.cs
new file mode 100644
index 000000000..e2e520086
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/throw_exception_runme.cs
@@ -0,0 +1,24 @@
+using System;
+using throw_exceptionNamespace;
+
+public class runme
+{
+ static void Main() {
+ Foo f = new Foo();
+ try {
+ f.test_int();
+ throw new Exception("Integer exception should have been thrown");
+ } catch (System.Exception) {
+ }
+ try {
+ f.test_msg();
+ throw new Exception("String exception should have been thrown");
+ } catch (System.Exception) {
+ }
+ try {
+ f.test_cls();
+ throw new Exception("Class exception should have been thrown");
+ } catch (System.Exception) {
+ }
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/typemap_namespace_runme.cs b/trunk/Examples/test-suite/csharp/typemap_namespace_runme.cs
new file mode 100644
index 000000000..39f1c6548
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/typemap_namespace_runme.cs
@@ -0,0 +1,16 @@
+// This test tests all the methods in the C# collection wrapper
+
+using System;
+using typemap_namespaceNamespace;
+
+public class typemap_namespace_runme {
+
+ public static void Main() {
+ if (typemap_namespace.test1("hello") != "hello")
+ throw new Exception("test1 failed");
+ if (typemap_namespace.test2("hello") != "hello")
+ throw new Exception("test2 failed");
+ }
+
+}
+
diff --git a/trunk/Examples/test-suite/csharp/typemap_out_optimal_runme.cs b/trunk/Examples/test-suite/csharp/typemap_out_optimal_runme.cs
new file mode 100644
index 000000000..5bc1d14be
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/typemap_out_optimal_runme.cs
@@ -0,0 +1,13 @@
+using System;
+using typemap_out_optimalNamespace;
+
+public class typemap_out_optimal_runme {
+
+ public static XX x = null;
+ public static void Main() {
+ XX.debug = false;
+ x = XX.create();
+ }
+
+}
+
diff --git a/trunk/Examples/test-suite/csharp/varargs_runme.cs b/trunk/Examples/test-suite/csharp/varargs_runme.cs
new file mode 100644
index 000000000..b9fca3294
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/varargs_runme.cs
@@ -0,0 +1,20 @@
+// varargs test
+
+using System;
+using varargsNamespace;
+
+public class varargs_runme {
+
+ public static void Main() {
+
+ if (varargs.test("Hello") != "Hello")
+ throw new Exception("Failed");
+
+ Foo f = new Foo("Greetings");
+ if (f.str != "Greetings")
+ throw new Exception("Failed");
+
+ if (f.test("Hello") != "Hello")
+ throw new Exception("Failed");
+ }
+}
diff --git a/trunk/Examples/test-suite/csharp/virtual_poly_runme.cs b/trunk/Examples/test-suite/csharp/virtual_poly_runme.cs
new file mode 100644
index 000000000..9c1f79613
--- /dev/null
+++ b/trunk/Examples/test-suite/csharp/virtual_poly_runme.cs
@@ -0,0 +1,51 @@
+using System;
+using virtual_polyNamespace;
+
+public class runme {
+ static void Main() {
+
+ NDouble d = new NDouble(3.5);
+ NInt i = new NInt(2);
+
+ //
+ // These two natural 'copy' forms fail because no covariant (polymorphic) return types
+ // are supported in C#.
+ //
+ // NDouble dc = d.copy();
+ // NInt ic = i.copy();
+
+ //
+ // Unlike C++, we have to downcast instead.
+ //
+ NDouble dc = (NDouble)d.copy();
+ NInt ic = (NInt)i.copy();
+
+ NDouble ddc = NDouble.narrow(dc);
+ NInt dic = NInt.narrow(ic);
+ dc = ddc; ic = dic; // warning suppression
+
+ virtual_poly.incr(ic);
+ if ( (i.get() + 1) != ic.get() )
+ throw new Exception("incr test failed");
+
+ //
+ // Checking a pure user downcast
+ //
+ NNumber n1 = d.copy();
+ NNumber n2 = d.nnumber();
+ NDouble dn1 = NDouble.narrow(n1);
+ NDouble dn2 = NDouble.narrow(n2);
+
+ if ( (dn1.get()) != dn2.get() )
+ throw new Exception("copy/narrow test failed");
+
+ //
+ // Checking the ref polymorphic case
+ //
+ NNumber nr = d.ref_this();
+ NDouble dr1 = NDouble.narrow(nr);
+ NDouble dr2 = (NDouble)d.ref_this();
+ if ( dr1.get() != dr2.get() )
+ throw new Exception("copy/narrow test failed");
+ }
+}