Example #1
0
        public void IList()
        {
            ComplexDoubleVector a = new ComplexDoubleVector(new Complex[4] {
                0, 1, 2, 3
            });

            Assert.AreEqual(a.IsFixedSize, false);
            Assert.AreEqual(a.IsReadOnly, false);

            a.Add((Complex)4.0);
            Assert.AreEqual(a.Length, 5);
            Assert.AreEqual(a[4], (Complex)4);
            Assert.AreEqual(a.Contains((Complex)4.0), true);

            a.Insert(1, (Complex)5.0);
            Assert.AreEqual(a.Length, 6);
            Assert.AreEqual(a.Contains((Complex)5.0), true);
            Assert.AreEqual(a[0], (Complex)0);
            Assert.AreEqual(a[1], (Complex)5);
            Assert.AreEqual(a[2], (Complex)1);
            Assert.AreEqual(a[3], (Complex)2);
            Assert.AreEqual(a[4], (Complex)3);
            Assert.AreEqual(a[5], (Complex)4);

            a.Remove((Complex)5.0);
            Assert.AreEqual(a.Length, 5);
            Assert.AreEqual(a.Contains((Complex)5.0), false);
            Assert.AreEqual(a[0], (Complex)0);
            Assert.AreEqual(a[1], (Complex)1);
            Assert.AreEqual(a[2], (Complex)2);
            Assert.AreEqual(a[3], (Complex)3);
            Assert.AreEqual(a[4], (Complex)4);

            a.RemoveAt(2);
            Assert.AreEqual(a.Length, 4);
            Assert.AreEqual(a.Contains((Complex)2.0), false);
            Assert.AreEqual(a[0], (Complex)0);
            Assert.AreEqual(a[1], (Complex)1);
            Assert.AreEqual(a[2], (Complex)3);
            Assert.AreEqual(a[3], (Complex)4);
        }