Esempio n. 1
0
        public void TestEqualAndHash()
        {
            TrTransform a = TrTransform.TRS(new Vector3(0, 2, 3), new Quaternion(4, 5, 6, 7), 8);
            TrTransform b = a;

            Assert.IsTrue(a.Equals(b));
            Assert.IsTrue(b.Equals(a));
            Assert.IsTrue(a == b);
            Assert.IsTrue(b == a);
            Assert.IsTrue(!(a != b));
            Assert.IsTrue(!(b != a));
            Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
        }
Esempio n. 2
0
        public void TestEqualIsNotApproximate()
        {
            // Unity's Vector== is approximate. Test that we aren't inheriting that
            // bad behavior.
            TrTransform a = TrTransform.TRS(new Vector3(0, 2, 3), new Quaternion(0, 0, 0, 1), 8);
            TrTransform b = a;

            b.translation.x += 1e-6f;
            b.rotation.x    += 1e-5f;
            Assert.IsFalse(b.Equals(a));
            Assert.IsFalse(b == a);
            Assert.IsTrue(b != a);
        }