public void SpanLikeTest() { var v0 = new UnityEngine.Vector3(1, 2, 3); var v1 = new UnityEngine.Vector3(4, 5, 6); var positions = new UnityEngine.Vector3[] { v0, v1, }; var span = SpanLike.CopyFrom(positions); Assert.AreEqual(2, span.Length); Assert.AreEqual(v0, span[0]); Assert.AreEqual(v1, span[1]); }
public void Vector4Test() { var bytes = new byte[4 * 4]; { var span = SpanLike.Wrap <Single>(new ArraySegment <byte>(bytes)); span[0] = 1.0f; } { var span = SpanLike.Wrap <Vector4>(new ArraySegment <byte>(bytes)); Assert.AreEqual(1.0f, span[0].X); } { var span = SpanLike.Wrap <Quaternion>(new ArraySegment <byte>(bytes)); Assert.AreEqual(1.0f, span[0].X); } }
public bool Equals(SpanLike <T> other) { if (Length != other.Length) { return(false); } var end = Length; for (int i = 0; i < end; ++i) { if (!this[i].Equals(other[i])) { return(false); } } return(true); }