Exemple #1
0
        public void NullObject()
        {
            var vector1 = new VectorN(3);

            vector1.SetValues(1, 2, 5);

            Assert.IsFalse(vector1.Equals((object)null));

            Assert.AreEqual(1, vector1[0]);
            Assert.AreEqual(2, vector1[1]);
            Assert.AreEqual(5, vector1[2]);
        }
Exemple #2
0
        public void SameValuesObject()
        {
            var vector1 = new VectorN(3);

            vector1.SetValues(1, 2, 5);
            var vector2 = new VectorN(3);

            vector2.SetValues(1, 2, 5);

            Assert.IsTrue(vector1.Equals((object)vector2));

            Assert.AreEqual(1, vector1[0]);
            Assert.AreEqual(2, vector1[1]);
            Assert.AreEqual(5, vector1[2]);

            Assert.AreEqual(1, vector2[0]);
            Assert.AreEqual(2, vector2[1]);
            Assert.AreEqual(5, vector2[2]);
        }
Exemple #3
0
        public void DifferentDimensions()
        {
            var vector1 = new VectorN(3);

            vector1.SetValues(1, 2, 5);
            var vector2 = new VectorN(4);

            vector2.SetValues(1, 2, 5, 6);

            Assert.IsFalse(vector1.Equals(vector2));

            Assert.AreEqual(1, vector1[0]);
            Assert.AreEqual(2, vector1[1]);
            Assert.AreEqual(5, vector1[2]);

            Assert.AreEqual(1, vector2[0]);
            Assert.AreEqual(2, vector2[1]);
            Assert.AreEqual(5, vector2[2]);
            Assert.AreEqual(6, vector2[3]);
        }