Merge trunk (up to just after swig 2.0.5 release - rev 13009) to gsoc2008-cherylfoil
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@13017 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
af1c6ac3c3
1811 changed files with 94580 additions and 35569 deletions
|
|
@ -5,28 +5,36 @@
|
|||
LANGUAGE = csharp
|
||||
SCRIPTSUFFIX = _runme.cs
|
||||
INTERPRETER = @CSHARPCILINTERPRETER@
|
||||
INTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
|
||||
CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@"
|
||||
CSHARPCYGPATH_W = @CSHARPCYGPATH_W@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = @top_builddir@/..
|
||||
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
|
||||
|
||||
CUSTOM_TEST_CASES = intermediary_classname
|
||||
exception_partial_info \
|
||||
intermediary_classname \
|
||||
li_boost_intrusive_ptr
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Overridden variables here
|
||||
SWIGOPT += -namespace $*Namespace $(SWIGOPTSPECIAL)
|
||||
SWIGOPT += -namespace $*Namespace
|
||||
|
||||
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:
|
||||
|
|
@ -44,10 +52,6 @@ SWIGOPT += -namespace $*Namespace $(SWIGOPTSPECIAL)
|
|||
+(cd $* && $(swig_and_compile_multi_cpp))
|
||||
+$(run_testcase)
|
||||
|
||||
# Rules for custom tests
|
||||
intermediary_classname.customtest:
|
||||
$(MAKE) intermediary_classname.cpptest SWIGOPTSPECIAL="-dllimport intermediary_classname"
|
||||
|
||||
# Makes a directory for the testcase if it does not exist
|
||||
setup = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
|
|
@ -56,31 +60,31 @@ setup = \
|
|||
echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \
|
||||
fi; \
|
||||
if [ ! -d $* ]; then \
|
||||
mkdir $*; \
|
||||
fi;
|
||||
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.
|
||||
# DYLD_FALLBACK_LIBRARY_PATH is cleared for MacOSX.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
CSHARPFLAGS='-nologo -out:$*_runme.exe' \
|
||||
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` \
|
||||
$*$(CSHARPPATHSEPARATOR)*.cs' csharp_compile && \
|
||||
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" $(RUNTOOL) $(INTERPRETER) $*_runme.exe; ) \
|
||||
else ( \
|
||||
CSHARPFLAGS='-nologo -debug+ $(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" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(INTERPRETER) $(INTERPRETER_FLAGS) $*_runme.exe; \
|
||||
else \
|
||||
cd $* && \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
CSHARPFLAGS='-nologo -t:module -out:$*.netmodule' \
|
||||
CSHARPSRCS='*.cs' csharp_compile; ); \
|
||||
fi;
|
||||
CSHARPFLAGS='-nologo -debug+ $(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;
|
||||
rm -rf $*; \
|
||||
fi
|
||||
|
||||
clean:
|
||||
@rm -f *.exe *.exe.mdb
|
||||
|
|
|
|||
0
Examples/test-suite/csharp/bools_runme.cs
Executable file → Normal file
0
Examples/test-suite/csharp/bools_runme.cs
Executable file → Normal file
66
Examples/test-suite/csharp/catches_runme.cs
Normal file
66
Examples/test-suite/csharp/catches_runme.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -76,6 +76,16 @@ public class char_strings_runme {
|
|||
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;
|
||||
|
|
@ -120,15 +130,26 @@ public class char_strings_runme {
|
|||
|
||||
// char *& tests
|
||||
for (i=0; i<count; i++) {
|
||||
String str = char_strings.GetConstCharPointerRef();
|
||||
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.SetConstCharPointerRef(OTHERLAND_MSG + i, 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.ComponentModel;
|
||||
using csharp_attributesNamespace;
|
||||
|
||||
public class runme
|
||||
|
|
@ -171,6 +172,24 @@ public class runme
|
|||
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);
|
||||
|
|
@ -179,6 +198,8 @@ public class runme
|
|||
if (tgv == null)
|
||||
throw new Exception("No attribute for Cymru");
|
||||
}
|
||||
|
||||
// No runtime test for directorinattributes and directoroutattributes
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -237,3 +258,9 @@ public class ThreadSafeAttribute : Attribute {
|
|||
public ThreadSafeAttribute() {}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
|
||||
public class DirectorIntegerOutAttribute : Attribute {}
|
||||
|
||||
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
|
||||
public class DirectorIntegerInAttribute : Attribute {}
|
||||
|
||||
|
|
|
|||
70
Examples/test-suite/csharp/csharp_lib_arrays_runme.cs
Normal file
70
Examples/test-suite/csharp/csharp_lib_arrays_runme.cs
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +55,43 @@ public class csharp_prepost_runme {
|
|||
throw new Exception("Expecting CustomInt attribute");
|
||||
}
|
||||
}
|
||||
// Dates
|
||||
{
|
||||
// pre post typemap attributes example
|
||||
System.DateTime dateIn = new System.DateTime(2011, 4, 13);
|
||||
System.DateTime dateOut = new System.DateTime();
|
||||
|
||||
// Note in calls below, dateIn remains unchanged and dateOut
|
||||
// is set to a new value by the C++ call
|
||||
csharp_prepostNamespace.Action action = new csharp_prepostNamespace.Action(dateIn, out dateOut);
|
||||
if (dateOut != dateIn)
|
||||
throw new Exception("dates wrong");
|
||||
|
||||
dateIn = new System.DateTime(2012, 7, 14);
|
||||
action.doSomething(dateIn, out dateOut);
|
||||
if (dateOut != dateIn)
|
||||
throw new Exception("dates wrong");
|
||||
|
||||
System.DateTime refDate = new System.DateTime(1999, 12, 31);
|
||||
if (csharp_prepost.ImportantDate != refDate)
|
||||
throw new Exception("dates wrong");
|
||||
|
||||
refDate = new System.DateTime(1999, 12, 31);
|
||||
csharp_prepost.ImportantDate = refDate;
|
||||
System.DateTime importantDate = csharp_prepost.ImportantDate;
|
||||
if (importantDate != refDate)
|
||||
throw new Exception("dates wrong");
|
||||
|
||||
System.DateTime christmasEve = new System.DateTime(2000, 12, 24);
|
||||
csharp_prepost.addYears(ref christmasEve, 10);
|
||||
if (christmasEve != new System.DateTime(2010, 12, 24))
|
||||
throw new Exception("dates wrong");
|
||||
|
||||
Person person = new Person();
|
||||
person.Birthday = christmasEve;
|
||||
if (person.Birthday != christmasEve)
|
||||
throw new Exception("dates wrong");
|
||||
}
|
||||
}
|
||||
private static void Assert(double d1, double d2) {
|
||||
if (d1 != d2)
|
||||
|
|
|
|||
11
Examples/test-suite/csharp/director_alternating_runme.cs
Normal file
11
Examples/test-suite/csharp/director_alternating_runme.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
using System;
|
||||
using director_alternatingNamespace;
|
||||
|
||||
public class director_alternating_runme {
|
||||
public static void Main() {
|
||||
if (director_alternating.getBar().id() != director_alternating.idFromGetBar())
|
||||
throw new Exception("idFromGetBar failed");
|
||||
}
|
||||
}
|
||||
|
||||
0
Examples/test-suite/csharp/director_classic_runme.cs
Executable file → Normal file
0
Examples/test-suite/csharp/director_classic_runme.cs
Executable file → Normal file
32
Examples/test-suite/csharp/director_nspace_runme.cs
Normal file
32
Examples/test-suite/csharp/director_nspace_runme.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
using System;
|
||||
using director_nspaceNamespace;
|
||||
|
||||
public class bools_runme {
|
||||
|
||||
public static void Main() {
|
||||
}
|
||||
}
|
||||
|
||||
class director_nspace_MyBarFoo : director_nspaceNamespace.Bar.Foo {
|
||||
|
||||
public override String ping() {
|
||||
return "director_nspace_MyBarFoo.ping();";
|
||||
}
|
||||
|
||||
public override String pong() {
|
||||
return "director_nspace_MyBarFoo.pong();" + ping();
|
||||
}
|
||||
|
||||
public override String fooBar(director_nspaceNamespace.Bar.FooBar fooBar) {
|
||||
return fooBar.FooBarDo();
|
||||
}
|
||||
|
||||
public override director_nspaceNamespace.Bar.Foo makeFoo() {
|
||||
return new director_nspaceNamespace.Bar.Foo();
|
||||
}
|
||||
|
||||
public override director_nspaceNamespace.Bar.FooBar makeFooBar() {
|
||||
return new director_nspaceNamespace.Bar.FooBar();
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ public class runme
|
|||
Foo f = b.create();
|
||||
FooBar fb = new FooBar();
|
||||
FooBar2 fb2 = new FooBar2();
|
||||
FooBar3 fb3 = new FooBar3();
|
||||
|
||||
String s;
|
||||
s = fb.used();
|
||||
|
|
@ -37,6 +38,21 @@ public class runme
|
|||
s = fb.pong();
|
||||
if ( s != ("Bar::pong();Foo::pong();FooBar::ping();"))
|
||||
throw new Exception("bad FooBar::pong");
|
||||
|
||||
// if (fb3.cheer() != "FooBar3::cheer();")
|
||||
// throw new Exception("bad fb3::cheer");
|
||||
|
||||
if (fb2.callping() != "FooBar2::ping();")
|
||||
throw new Exception("bad fb2.callping");
|
||||
|
||||
if (fb2.callcheer() != "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();")
|
||||
throw new Exception("bad fb2.callcheer");
|
||||
|
||||
if (fb3.callping() != "Bar::ping();")
|
||||
throw new Exception("bad fb3.callping");
|
||||
|
||||
if (fb3.callcheer() != "FooBar3::cheer();")
|
||||
throw new Exception("bad fb3.callcheer");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -69,4 +85,16 @@ class FooBar2 : Bar
|
|||
}
|
||||
}
|
||||
|
||||
class FooBar3 : Bar
|
||||
{
|
||||
public FooBar3() : base()
|
||||
{
|
||||
}
|
||||
|
||||
protected override String cheer()
|
||||
{
|
||||
return "FooBar3::cheer();";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
63
Examples/test-suite/csharp/enum_thorough_runme.cs
Executable file → Normal file
63
Examples/test-suite/csharp/enum_thorough_runme.cs
Executable file → Normal file
|
|
@ -358,14 +358,75 @@ public class runme {
|
|||
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.last) != 3) throw new Exception("repeatTest 5 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");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typeint) != 10) throw new Exception("differentTypes 1 failed");
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typeboolfalse) != 0) throw new Exception("differentTypes 2 failed");
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typebooltrue) != 1) throw new Exception("differentTypes 3 failed");
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typebooltwo) != 2) throw new Exception("differentTypes 4 failed");
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typechar) != 'C') throw new Exception("differentTypes 5 failed");
|
||||
if ((int)enum_thorough.differentTypesTest(DifferentTypes.typedefaultint) != 'D') throw new Exception("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough.global_typeint;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough.global_typeboolfalse;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough.global_typebooltrue;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough.global_typebooltwo;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough.global_typechar;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough.global_typedefaultint;
|
||||
if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -358,14 +358,75 @@ public class runme {
|
|||
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.last) != 3) throw new Exception("repeatTest 5 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");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typeint) != 10) throw new Exception("differentTypes 1 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typeboolfalse) != 0) throw new Exception("differentTypes 2 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typebooltrue) != 1) throw new Exception("differentTypes 3 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typebooltwo) != 2) throw new Exception("differentTypes 4 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typechar) != 'C') throw new Exception("differentTypes 5 failed");
|
||||
if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typedefaultint) != 'D') throw new Exception("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough_simple.global_typeint;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough_simple.global_typeboolfalse;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough_simple.global_typebooltrue;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough_simple.global_typebooltwo;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough_simple.global_typechar;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_simple.global_typedefaultint;
|
||||
if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -358,14 +358,75 @@ public class runme {
|
|||
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.last).swigValue != 3) throw new Exception("repeatTest 5 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");
|
||||
}
|
||||
// different types
|
||||
{
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typeint).swigValue != 10) throw new Exception("differentTypes 1 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typebooltrue).swigValue != 1) throw new Exception("differentTypes 2 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typebooltwo).swigValue != 2) throw new Exception("differentTypes 3 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typeboolfalse).swigValue != 0) throw new Exception("differentTypes 4 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typechar).swigValue != (int)'C') throw new Exception("differentTypes 5 failed");
|
||||
if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typedefaultint).swigValue != (int)'D') throw new Exception("differentTypes 6 failed");
|
||||
|
||||
int global_enum = enum_thorough_typesafe.global_typeint;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typeboolfalse;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typebooltrue;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typebooltwo;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typechar;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
|
||||
global_enum = enum_thorough_typesafe.global_typedefaultint;
|
||||
if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
48
Examples/test-suite/csharp/exception_order_runme.cs
Normal file
48
Examples/test-suite/csharp/exception_order_runme.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
Examples/test-suite/csharp/friends_runme.cs
Normal file
43
Examples/test-suite/csharp/friends_runme.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using friendsNamespace;
|
||||
|
||||
public class friends_runme {
|
||||
public static void Main() {
|
||||
A a = new A(2);
|
||||
|
||||
if (friends.get_val1(a) != 2)
|
||||
throw new Exception("failed");
|
||||
if (friends.get_val2(a) != 4)
|
||||
throw new Exception("failed");
|
||||
if (friends.get_val3(a) != 6)
|
||||
throw new Exception("failed");
|
||||
|
||||
// nice overload working fine
|
||||
if (friends.get_val1(1,2,3) != 1)
|
||||
throw new Exception("failed");
|
||||
|
||||
B b = new B(3);
|
||||
|
||||
// David's case
|
||||
if (friends.mix(a,b) != 5)
|
||||
throw new Exception("failed");
|
||||
|
||||
D_d di = new D_d(2);
|
||||
D_d dd = new D_d(3.3);
|
||||
|
||||
// incredible template overloading working just fine
|
||||
if (friends.get_val1(di) != 2)
|
||||
throw new Exception("failed");
|
||||
if (friends.get_val1(dd) != 3.3)
|
||||
throw new Exception("failed");
|
||||
|
||||
friends.set(di, 4);
|
||||
friends.set(dd, 1.3);
|
||||
|
||||
if (friends.get_val1(di) != 4)
|
||||
throw new Exception("failed");
|
||||
if (friends.get_val1(dd) != 1.3)
|
||||
throw new Exception("failed");
|
||||
}
|
||||
}
|
||||
|
||||
24
Examples/test-suite/csharp/inherit_target_language_runme.cs
Normal file
24
Examples/test-suite/csharp/inherit_target_language_runme.cs
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
78
Examples/test-suite/csharp/li_attribute_runme.cs
Normal file
78
Examples/test-suite/csharp/li_attribute_runme.cs
Normal file
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
20
Examples/test-suite/csharp/li_boost_shared_ptr_bits_runme.cs
Normal file
20
Examples/test-suite/csharp/li_boost_shared_ptr_bits_runme.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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");
|
||||
|
||||
HiddenDestructor hidden = HiddenDestructor.create();
|
||||
hidden.Dispose();
|
||||
}
|
||||
}
|
||||
|
|
@ -345,6 +345,16 @@ public class runme
|
|||
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
|
||||
|
|
|
|||
31
Examples/test-suite/csharp/li_std_combinations_runme.cs
Normal file
31
Examples/test-suite/csharp/li_std_combinations_runme.cs
Normal file
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
251
Examples/test-suite/csharp/li_std_map_runme.cs
Normal file
251
Examples/test-suite/csharp/li_std_map_runme.cs
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* li_std_map_runme.cs
|
||||
*
|
||||
* SWIG C# tester for std_map.i
|
||||
* Implementation by Yuval Baror (http://yuval.bar-or.org)
|
||||
*
|
||||
* 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);
|
||||
Dictionary<string, int> check = new Dictionary<string, int>();
|
||||
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);
|
||||
check.Add(keys[i], values[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < collectionSize; i++)
|
||||
{
|
||||
if (!check.ContainsKey(i.ToString()))
|
||||
throw new Exception("Keys and Values ContainsKey test " + i + " failed");
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
||||
27
Examples/test-suite/csharp/li_std_vector_enum_runme.cs
Normal file
27
Examples/test-suite/csharp/li_std_vector_enum_runme.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// This test tests all the methods in the C# collection wrapper
|
||||
|
||||
using System;
|
||||
using li_std_vector_enumNamespace;
|
||||
|
||||
public class li_std_vector_enum_runme {
|
||||
|
||||
public static void Main() {
|
||||
EnumVector ev = new EnumVector();
|
||||
|
||||
check((int)ev.nums[0], 10);
|
||||
check((int)ev.nums[1], 20);
|
||||
check((int)ev.nums[2], 30);
|
||||
|
||||
int expected = 10;
|
||||
foreach (EnumVector.numbers val in ev.nums) {
|
||||
check((int)val, expected);
|
||||
expected += 10;
|
||||
}
|
||||
}
|
||||
|
||||
private static void check(int a, int b) {
|
||||
if (a != b)
|
||||
throw new ApplicationException("values don't match");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,14 +82,17 @@ public class li_std_vector_runme {
|
|||
} 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 (5) test failed");
|
||||
throw new Exception("CopyTo (5a) test failed");
|
||||
} catch (ArgumentException) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
{
|
||||
StructVector inputvector = new StructVector();
|
||||
int arrayLen = 10;
|
||||
|
|
@ -150,10 +153,14 @@ public class li_std_vector_runme {
|
|||
}
|
||||
}
|
||||
try {
|
||||
new DoubleVector(null);
|
||||
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++) {
|
||||
|
|
@ -174,6 +181,13 @@ public class li_std_vector_runme {
|
|||
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
|
||||
|
|
@ -187,11 +201,22 @@ public class li_std_vector_runme {
|
|||
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 test failed");
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -516,6 +541,13 @@ public class li_std_vector_runme {
|
|||
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());
|
||||
|
|
|
|||
0
Examples/test-suite/csharp/li_std_wstring_runme.cs
Executable file → Normal file
0
Examples/test-suite/csharp/li_std_wstring_runme.cs
Executable file → Normal file
39
Examples/test-suite/csharp/nspace_extend_runme.cs
Normal file
39
Examples/test-suite/csharp/nspace_extend_runme.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
76
Examples/test-suite/csharp/nspace_runme.cs
Normal file
76
Examples/test-suite/csharp/nspace_runme.cs
Normal file
|
|
@ -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.namespce ns = new nspaceNamespace.Outer.namespce();
|
||||
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();
|
||||
}
|
||||
}
|
||||
0
Examples/test-suite/csharp/overload_complicated_runme.cs
Executable file → Normal file
0
Examples/test-suite/csharp/overload_complicated_runme.cs
Executable file → Normal file
|
|
@ -7,8 +7,8 @@ public class runme
|
|||
{
|
||||
int f = overload_template.foo();
|
||||
|
||||
f += overload_template.max(3,4);
|
||||
double b = overload_template.max(3.4,5.2);
|
||||
f += overload_template.maximum(3,4);
|
||||
double b = overload_template.maximum(3.4,5.2);
|
||||
b++; // warning suppression
|
||||
|
||||
// mix 1
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ public class pointer_reference_runme {
|
|||
Struct ss = new Struct(20);
|
||||
pointer_reference.set(ss);
|
||||
if (Struct.instance.value != 20) throw new Exception("set test failed");
|
||||
|
||||
if (pointer_reference.overloading(1) != 111) throw new Exception("overload test 1 failed");
|
||||
if (pointer_reference.overloading(ss) != 222) throw new Exception("overload test 2 failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
70
Examples/test-suite/csharp/preproc_constants_c_runme.cs
Normal file
70
Examples/test-suite/csharp/preproc_constants_c_runme.cs
Normal file
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
69
Examples/test-suite/csharp/preproc_constants_runme.cs
Normal file
69
Examples/test-suite/csharp/preproc_constants_runme.cs
Normal file
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
12
Examples/test-suite/csharp/rename_pcre_encoder_runme.cs
Normal file
12
Examples/test-suite/csharp/rename_pcre_encoder_runme.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using rename_pcre_encoderNamespace;
|
||||
|
||||
public class runme {
|
||||
static void Main() {
|
||||
SomeWidget w = new SomeWidget();
|
||||
w.putBorderWidth(17);
|
||||
if ( w.getBorderWidth() != 17 )
|
||||
throw new Exception(String.Format("Border with should be 17, not {0}",
|
||||
w.getBorderWidth()));
|
||||
}
|
||||
}
|
||||
24
Examples/test-suite/csharp/rename_pcre_enum_runme.cs
Normal file
24
Examples/test-suite/csharp/rename_pcre_enum_runme.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using rename_pcre_enumNamespace;
|
||||
|
||||
public class runme {
|
||||
static void Main() {
|
||||
Foo foo = Foo.First;
|
||||
if ( foo == Foo.Second )
|
||||
throw new Exception("Enum values should be different");
|
||||
|
||||
// Check that Foo_Max enum element was ignored.
|
||||
int numFooEnumElements = Enum.GetValues(typeof(Foo)).Length;
|
||||
if ( numFooEnumElements != 2 )
|
||||
throw new Exception(String.Format("Enum should have 2 elements, not {0}",
|
||||
numFooEnumElements));
|
||||
|
||||
BoundaryCondition bc = BoundaryCondition.MaxMax;
|
||||
if ( (int)bc != 2 )
|
||||
throw new Exception("Wrong enum value");
|
||||
|
||||
Colour c = Colour.red;
|
||||
if ( c == Colour.blue )
|
||||
throw new Exception("Enum values should be different");
|
||||
}
|
||||
}
|
||||
30
Examples/test-suite/csharp/rename_simple_runme.cs
Normal file
30
Examples/test-suite/csharp/rename_simple_runme.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
using System;
|
||||
using rename_simpleNamespace;
|
||||
|
||||
public class rename_simple_runme {
|
||||
|
||||
public static void Main() {
|
||||
NewStruct s = new NewStruct();
|
||||
check(111, s.NewInstanceVariable, "NewInstanceVariable");
|
||||
check(222, s.NewInstanceMethod(), "NewInstanceMethod");
|
||||
check(333, NewStruct.NewStaticMethod(), "NewStaticMethod");
|
||||
check(444, NewStruct.NewStaticVariable, "NewStaticVariable");
|
||||
check(555, rename_simple.NewFunction(), "NewFunction");
|
||||
check(666, rename_simple.NewGlobalVariable, "NewGlobalVariable");
|
||||
|
||||
s.NewInstanceVariable = 1111;
|
||||
NewStruct.NewStaticVariable = 4444;
|
||||
rename_simple.NewGlobalVariable = 6666;
|
||||
|
||||
check(1111, s.NewInstanceVariable, "NewInstanceVariable");
|
||||
check(4444, NewStruct.NewStaticVariable, "NewStaticVariable");
|
||||
check(6666, rename_simple.NewGlobalVariable, "NewGlobalVariable");
|
||||
}
|
||||
|
||||
public static void check(int expected, int actual, string msg) {
|
||||
if (expected != actual)
|
||||
throw new Exception("Failed: Expected: " + expected + " actual: " + actual + " " + msg);
|
||||
}
|
||||
}
|
||||
|
||||
22
Examples/test-suite/csharp/special_variable_macros_runme.cs
Normal file
22
Examples/test-suite/csharp/special_variable_macros_runme.cs
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
13
Examples/test-suite/csharp/typemap_out_optimal_runme.cs
Normal file
13
Examples/test-suite/csharp/typemap_out_optimal_runme.cs
Normal file
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue