// This test tests all the methods in the C# collection wrapper using System; using li_std_vectorNamespace; public class li_std_vector_runme { private static readonly int collectionSize = 20; private static readonly int midCollection = collectionSize/2; public static DoubleVector myDoubleVector; public static RealVector myRealVector; public static void Main() { // Setup collection DoubleVector vect = new DoubleVector(); for (int i=0; i myEnumerator = dv.GetEnumerator(); while ( myEnumerator.MoveNext() ) { if (myEnumerator.Current != 77.7) throw new Exception("Repeat (2) test failed"); } } } { // InsertRange() test DoubleVector dvect = new DoubleVector(); for (int i=0; i<5; i++) { dvect.Add(1000.0*i); } vect.InsertRange(midCollection, dvect); if (vect.Count != collectionSize+dvect.Count) throw new Exception("InsertRange test size failed"); for (int i=0; i { global::System.Collections.Generic.IEnumerable collection = one_two_three; check123(new StringVector(collection)); } // Test construction from IList<> { global::System.Collections.Generic.IList collection = one_two_three; check123(new StringVector(collection)); } // Test construction from ICollection { global::System.Collections.ICollection collection = one_two_three; check123(new StringVector(collection)); } // Test construction from ICollection<> { global::System.Collections.Generic.ICollection collection = new global::System.Collections.Generic.List(one_two_three); check123(new StringVector(collection)); } } } private static void check123(StringVector stringv) { string concatenated = ""; foreach (string s in stringv) concatenated = concatenated + s; if (concatenated != "onetwothree") throw new Exception("concatenated string failed: " + concatenated); } }