diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in index 010ab0bab..597dbd211 100644 --- a/Examples/test-suite/csharp/Makefile.in +++ b/Examples/test-suite/csharp/Makefile.in @@ -14,6 +14,7 @@ top_builddir = @top_builddir@../ CPP_TEST_CASES = \ csharp_exceptions \ + csharp_typemaps \ enum_thorough_simple \ enum_thorough_typesafe diff --git a/Examples/test-suite/csharp/csharp_typemaps_runme.cs b/Examples/test-suite/csharp/csharp_typemaps_runme.cs new file mode 100644 index 000000000..66afb3692 --- /dev/null +++ b/Examples/test-suite/csharp/csharp_typemaps_runme.cs @@ -0,0 +1,108 @@ +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); + myChar = csharp_typemaps.STRINGCONSTANT; + initialLetters.Append(myChar); + if (initialLetters.ToString() != "bhox") + throw new Exception("initial letters failed"); + if (csharp_typemaps.go != "zzz") + throw new Exception("go variable failed"); + + // 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