예제 #1
0
        public void Addition()
        {
            Vector4D a = new Vector4D(1.0, 2.0, 3.0, 4.0);
            Vector4D b = new Vector4D(2.0, 3.0, 4.0, 5.0);
            Vector4D c = Vector4D.Add(a, b);

            Assert.AreEqual(new Vector4D(3.0, 5.0, 7.0, 9.0), c);
        }
예제 #2
0
            public void adding_vectors_leaves_right_unchanged()
            {
                var left          = new Vector4D(1, 2, 10, -4);
                var right         = new Vector4D(3, 4, 11, 1);
                var expectedRight = new Vector4D(right);

                left.Add(right);

                Assert.Equal(expectedRight, right);
            }
예제 #3
0
            public void adding_vector_adds_to_components()
            {
                var actual   = new Vector4D(1, 2, 10, -4);
                var right    = new Vector4D(3, 4, 11, 1);
                var expected = new Vector4D(4, 6, 21, -3);

                actual.Add(right);

                Assert.Equal(expected, actual);
            }
예제 #4
0
 public void Addition()
 {
     Assert.AreEqual(Vector4D.Zero, op1 + op2, "Operator");
     Assert.AreEqual(Vector4D.Zero, Vector4D.Add(op1, op2), "Method");
     UnitHelper.RefOperationTester <Vector4D>(op1, op2, Vector4D.Zero, Vector4D.Add, "Addition");
 }
예제 #5
0
        public void Add()
        {
            Vector4D v1 = new Vector4D(1.0, 2.0, 3.0, 4.0);
            Vector4D v2 = new Vector4D(4.0, 5.0, 6.0, 7.0);
            
            Vector4D v3 = v1 + v2;
            Assert.AreEqual(5.0, v3.X, 1e-14);
            Assert.AreEqual(7.0, v3.Y, 1e-14);
            Assert.AreEqual(9.0, v3.Z, 1e-14);
            Assert.AreEqual(11.0, v3.W, 1e-14);

            Vector4D v4 = v1.Add(v2);
            Assert.AreEqual(5.0, v4.X, 1e-14);
            Assert.AreEqual(7.0, v4.Y, 1e-14);
            Assert.AreEqual(9.0, v4.Z, 1e-14);
            Assert.AreEqual(11.0, v4.W, 1e-14);
        }