swig/Examples/test-suite/csharp/rename_pcre_enum_runme.cs
Vadim Zeitlin 70c5bb5a47 Add support for "[not]regexmatch" and "regextarget" to %rename.
"regexmatch" and "notregexmatch" can be used with anonymous %renames in the
same way as "match" and "notmatch" while "regextarget" specifies that the
argument of a non-anonymous %rename should be interpreted as a regular
expression.

Document the new functions.

Also add a new unit test for %regex also testing regexmatch &c and provide
test code for C# and Java verifying that it works as intended.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12174 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-07-22 17:02:10 +00:00

24 lines
752 B
C#

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