public void SwapException() { ComplexDoubleVector a = new ComplexDoubleVector(new double[4] { 0, 1, 2, 3 }); ComplexDoubleVector b = new ComplexDoubleVector(new double[5] { 4, 5, 6, 7, 8 }); a.Swap(b); }
public void SwapException() { Assert.Throws(typeof(ArgumentException), () => { var a = new ComplexDoubleVector(new double[4] { 0, 1, 2, 3 }); var b = new ComplexDoubleVector(new double[5] { 4, 5, 6, 7, 8 }); a.Swap(b); }); }
public void CopySwap() { ComplexDoubleVector a = new ComplexDoubleVector(new double[4] { 0, 1, 2, 3 }); ComplexDoubleVector b = new ComplexDoubleVector(new double[4] { 4, 5, 6, 7 }); ComplexDoubleVector c = new ComplexDoubleVector(4); ComplexDoubleVector d = new ComplexDoubleVector(4); a.Copy(c); b.Copy(d); Assert.AreEqual(a.Length, c.Length); Assert.AreEqual(a[0], c[0]); Assert.AreEqual(a[1], c[1]); Assert.AreEqual(a[2], c[2]); Assert.AreEqual(a[3], c[3]); Assert.AreEqual(b.Length, d.Length); Assert.AreEqual(b[0], d[0]); Assert.AreEqual(b[1], d[1]); Assert.AreEqual(b[2], d[2]); Assert.AreEqual(b[3], d[3]); a.Swap(b); Assert.AreEqual(b.Length, c.Length); Assert.AreEqual(b[0], c[0]); Assert.AreEqual(b[1], c[1]); Assert.AreEqual(b[2], c[2]); Assert.AreEqual(b[3], c[3]); Assert.AreEqual(a.Length, d.Length); Assert.AreEqual(a[0], d[0]); Assert.AreEqual(a[1], d[1]); Assert.AreEqual(a[2], d[2]); Assert.AreEqual(a[3], d[3]); }