std::vector<T> wrapper improvements for .NET 2 implementing IEnumerable<T>
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11156 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
df698a8d32
commit
6975ecd65c
3 changed files with 93 additions and 17 deletions
|
|
@ -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;
|
||||
|
|
@ -154,6 +157,9 @@ public class li_std_vector_runme {
|
|||
throw new Exception("ICollection constructor null test failed");
|
||||
} catch (ArgumentNullException) {
|
||||
}
|
||||
{
|
||||
myDoubleVector = new DoubleVector() { 123.4, 567.8, 901.2 };
|
||||
}
|
||||
|
||||
// IndexOf() test
|
||||
for (int i=0; i<collectionSize; i++) {
|
||||
|
|
@ -187,11 +193,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 +533,13 @@ public class li_std_vector_runme {
|
|||
li_std_vector.halve_in_place(dvec);
|
||||
}
|
||||
|
||||
// Dispose()
|
||||
{
|
||||
using (StructVector vs = new StructVector() { new Struct(0.0), new Struct(11.1) } )
|
||||
using (DoubleVector vd = new DoubleVector() { 0.0, 11.1 } ) {
|
||||
}
|
||||
}
|
||||
|
||||
// More wrapped methods
|
||||
{
|
||||
RealVector v0 = li_std_vector.vecreal(new RealVector());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue