public void CopyException() { Assert.Throws(typeof(ArgumentException), () => { var a = new FloatVector(new float[4] { 0, 1, 2, 3 }); var b = new FloatVector(5); a.CopyFrom(b); }); }
public void CopySwap() { var a = new FloatVector(new float[4] { 0, 1, 2, 3 }); var b = new FloatVector(new float[4] { 4, 5, 6, 7 }); var c = new FloatVector(4); var d = new FloatVector(4); a.CopyFrom(c); b.CopyFrom(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]); }