Ejemplo n.º 1
0
        public void TestIdentity()
        {
            Matrix33  nativeMatrix  = Matrix33.CreateIdentity();
            Matrix3x3 managedmatrix = Matrix3x3.Identity;

            // Compare native vs managed identity
            Assert.That(nativeMatrix.m00, Is.EqualTo(managedmatrix[0, 0]));
            Assert.That(nativeMatrix.m01, Is.EqualTo(managedmatrix[0, 1]));
            Assert.That(nativeMatrix.m02, Is.EqualTo(managedmatrix[0, 2]));
            Assert.That(nativeMatrix.m10, Is.EqualTo(managedmatrix[1, 0]));
            Assert.That(nativeMatrix.m11, Is.EqualTo(managedmatrix[1, 1]));
            Assert.That(nativeMatrix.m12, Is.EqualTo(managedmatrix[1, 2]));
            Assert.That(nativeMatrix.m20, Is.EqualTo(managedmatrix[2, 0]));
            Assert.That(nativeMatrix.m21, Is.EqualTo(managedmatrix[2, 1]));
            Assert.That(nativeMatrix.m22, Is.EqualTo(managedmatrix[2, 2]));

            // Compare managed to the real values of the identity
            Assert.That(managedmatrix[0, 0], Is.EqualTo(1));
            Assert.That(managedmatrix[0, 1], Is.EqualTo(0));
            Assert.That(managedmatrix[0, 2], Is.EqualTo(0));
            Assert.That(managedmatrix[1, 0], Is.EqualTo(0));
            Assert.That(managedmatrix[1, 1], Is.EqualTo(1));
            Assert.That(managedmatrix[1, 2], Is.EqualTo(0));
            Assert.That(managedmatrix[2, 0], Is.EqualTo(0));
            Assert.That(managedmatrix[2, 1], Is.EqualTo(0));
            Assert.That(managedmatrix[2, 2], Is.EqualTo(1));
        }
Ejemplo n.º 2
0
        public void TestIdentity()
        {
            Assert.That(true, Is.EqualTo(Matrix3x3.Identity == Matrix33.CreateIdentity()));

            Matrix3x3 managedmatrix = Matrix3x3.Identity;

            Assert.That(true, Is.EqualTo(managedmatrix == Matrix3x3.Identity));
            Assert.That(managedmatrix.m00, Is.EqualTo(1));
            Assert.That(managedmatrix.m01, Is.EqualTo(0));
            Assert.That(managedmatrix.m02, Is.EqualTo(0));
            Assert.That(managedmatrix.m10, Is.EqualTo(0));
            Assert.That(managedmatrix.m11, Is.EqualTo(1));
            Assert.That(managedmatrix.m12, Is.EqualTo(0));
            Assert.That(managedmatrix.m20, Is.EqualTo(0));
            Assert.That(managedmatrix.m21, Is.EqualTo(0));
            Assert.That(managedmatrix.m22, Is.EqualTo(1));
        }