Fix #3475492 - iterating through std::vector wrappers of enumerations.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12916 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3340045d67
commit
50693941c6
13 changed files with 253 additions and 0 deletions
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");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue