diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2023-03-22 20:50:57 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2023-03-22 21:05:13 +0000 |
commit | 20f7309220a774e1c2b5b0ec3cf94f4d09c192bd (patch) | |
tree | 9317a30d07e97272940a43ac1e3b5f9d60782f91 /Examples | |
parent | 5533ca1061c87d019acc04ad1a68ce0f62858c42 (diff) | |
download | swig-20f7309220a774e1c2b5b0ec3cf94f4d09c192bd.tar.gz |
std_array.i std_vector.i tweaks
Efficiency fixes and tidy up from previous commit.
Add test case for constructing from differently sized containers.
Issue #2478
Diffstat (limited to 'Examples')
-rw-r--r-- | Examples/test-suite/csharp/cpp11_std_array_runme.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Examples/test-suite/csharp/cpp11_std_array_runme.cs b/Examples/test-suite/csharp/cpp11_std_array_runme.cs index ee7c5ee24..649e06206 100644 --- a/Examples/test-suite/csharp/cpp11_std_array_runme.cs +++ b/Examples/test-suite/csharp/cpp11_std_array_runme.cs @@ -78,5 +78,20 @@ public class cpp11_std_array_runme catch (ArgumentOutOfRangeException) { } + + // ICollection constructor, differently sized + ai = new ArrayInt6(new int[] {1, 2, 3}); + compareContainers(ai, new int[] { 1, 2, 3, 0, 0, 0}); + ai = new ArrayInt6(new int[] {1, 2, 3, 4, 5, 6, 7, 8}); + compareContainers(ai, new int[] { 1, 2, 3, 4, 5, 6}); + + // ToArray test + int[] aiArray = ai.ToArray(); + for (int i=0; i<ai.Count; i++) { + if (aiArray[i] != ai[i]) + throw new Exception("ToArray failed, index:" + i); + } + if (ai.Count != aiArray.Length) + throw new Exception("ToArray lengths mismatch"); } } |