Add ToArray test for C# std::vector wrapper
This commit is contained in:
parent
6227013da4
commit
368cd3b52c
3 changed files with 15 additions and 1 deletions
|
|
@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.0.0 (in progress)
|
||||
===========================
|
||||
|
||||
2018-01-12: Liryna
|
||||
[C#] Patch #1128. Add ToArray function to std::vector wrappers.
|
||||
|
||||
2018-01-12: wsfulton
|
||||
[Java] Fix issue #1156. Add missing throws clause for interfaces when using the
|
||||
%interface family of macros.
|
||||
|
|
|
|||
|
|
@ -177,6 +177,17 @@ public class li_std_vector_runme {
|
|||
if (doubleArray[i] != dvCopy[i])
|
||||
throw new Exception("Copy constructor failed, index:" + i);
|
||||
}
|
||||
if (dvCopy.Count != doubleArray.Length)
|
||||
throw new Exception("Copy constructor lengths mismatch");
|
||||
|
||||
// ToArray test
|
||||
double[] dvArray = dv.ToArray();
|
||||
for (int i=0; i<doubleArray.Length; i++) {
|
||||
if (doubleArray[i] != dvArray[i])
|
||||
throw new Exception("ToArray failed, index:" + i);
|
||||
}
|
||||
if (dvArray.Length != doubleArray.Length)
|
||||
throw new Exception("ToArray lengths mismatch");
|
||||
}
|
||||
{
|
||||
// Repeat() test
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
}
|
||||
|
||||
public $typemap(cstype, CTYPE)[] ToArray() {
|
||||
$typemap(cstype, CTYPE)[] array = new $typemap(cstype, CTYPE)[Count];
|
||||
$typemap(cstype, CTYPE)[] array = new $typemap(cstype, CTYPE)[this.Count];
|
||||
this.CopyTo(array);
|
||||
return array;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue