Ejemplo n.º 1
0
        public void TestMultiply()
        {
            {
                //multiplication by a scalar TEST
                double[] TV1         = { 2.0, 3.0, 4.0 }; //TesVar1 (for actual vec)
                vector   vec         = new vector(TV1);
                vector   actual      = vec.Multiply(5.0);
                vector   actual_2    = 5.0 * vec;
                vector   actual_3    = vec * 5.0;
                object   actualObj   = (object)actual;
                object   actualObj_2 = (object)actual_2;
                object   actualObj_3 = (object)actual_3;

                double[] TV2         = { 2.0 * 5.0, 3.0 * 5.0, 4.0 * 5.0 }; //TesVar2 (for expected vec)
                vector   expected    = new vector(TV2);
                object   expectedObj = (object)expected;

                Assert.AreEqual(actualObj.GetHashCode(), expectedObj.GetHashCode());
                Assert.AreEqual(actualObj_2.GetHashCode(), expectedObj.GetHashCode());
                Assert.AreEqual(actualObj_3.GetHashCode(), expectedObj.GetHashCode());
            }
            {
                //multiplication by a vector TEST
                double[] TV1         = { 2.0, 3.0, 4.0 }; //TesVar1 (for actual vec)
                vector   vec         = new vector(TV1);
                vector   actual      = vec.Multiply(vec);
                vector   actual_2    = vec * vec;
                object   actualObj   = (object)actual;
                object   actualObj_2 = (object)actual_2;

                double[] TV2         = { 0.0, 0.0, 0.0 }; //TesVar2 (for expected vec)
                vector   expected    = new vector(TV2);
                object   expectedObj = (object)expected;

                Assert.AreEqual(actualObj.GetHashCode(), expectedObj.GetHashCode());
                Assert.AreEqual(actualObj_2.GetHashCode(), expectedObj.GetHashCode());
            }
        }