예제 #1
0
        public void TestMathOperators()
        {
            Matrix3By3 test1 = new Matrix3By3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
            Matrix3By3 test2 = new Matrix3By3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);

            Assert.IsTrue(Matrix3By3.Zero.Equals(test1.Subtract(test2)));
            Assert.IsTrue(Matrix3By3.Zero.Equals(test1 - test2));
            Assert.IsTrue((test2 * 2.0).Equals(test1.Add(test2)));
            Assert.IsTrue((test2 * 2.0).Equals(test1 + test2));
            Assert.IsTrue((new Matrix3By3(30, 36, 42, 66, 81, 96, 102, 126, 150).Equals(test1.Multiply(test2))));
            Assert.IsTrue((new Matrix3By3(30, 36, 42, 66, 81, 96, 102, 126, 150).Equals(test1 * test2)));
        }
예제 #2
0
        public void TestMathOperators()
        {
            var matrix1 = new Matrix3By3(1.0, 2.0, 3.0,
                                         4.0, 5.0, 6.0,
                                         7.0, 8.0, 9.0);
            var matrix2 = new Matrix3By3(1.0, 2.0, 3.0,
                                         4.0, 5.0, 6.0,
                                         7.0, 8.0, 9.0);

            Assert.AreEqual(Matrix3By3.Zero, matrix1.Subtract(matrix2));
            Assert.AreEqual(Matrix3By3.Zero, matrix1 - matrix2);
            Assert.AreEqual(matrix2 * 2.0, matrix1.Add(matrix2));
            Assert.AreEqual(matrix2 * 2.0, matrix1 + matrix2);

            var expected = new Matrix3By3(30, 36, 42,
                                          66, 81, 96,
                                          102, 126, 150);

            Assert.AreEqual(expected, matrix1.Multiply(matrix2));
            Assert.AreEqual(expected, matrix1 * matrix2);
        }
예제 #3
0
 public void TestMathOperators()
 {
     Matrix3By3 test1 = new Matrix3By3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
     Matrix3By3 test2 = new Matrix3By3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
     Assert.IsTrue(Matrix3By3.Zero.Equals(test1.Subtract(test2)));
     Assert.IsTrue(Matrix3By3.Zero.Equals(test1 - test2));
     Assert.IsTrue((test2 * 2.0).Equals(test1.Add(test2)));
     Assert.IsTrue((test2 * 2.0).Equals(test1 + test2));
     Assert.IsTrue((new Matrix3By3(30, 36, 42, 66, 81, 96, 102, 126, 150).Equals(test1.Multiply(test2))));
     Assert.IsTrue((new Matrix3By3(30, 36, 42, 66, 81, 96, 102, 126, 150).Equals(test1 * test2)));
 }