Esempio n. 1
0
        public void TestConcatenationNotNullArray()
        {
            My_Array a = new My_Array(new int[] { 1, 2, 3 });

            int [] conc = a.Concatenation(new int[] { 3, 2, 1 });
            CollectionAssert.AreEqual(conc, new int[] { 1, 2, 3, 3, 2, 1 });
        }
Esempio n. 2
0
        public void TestConcatenationNullArray()
        {
            My_Array a = null;

            int [] conc = a.Concatenation(new int[] { 1, 2, 3 });
            Assert.Fail();
        }
Esempio n. 3
0
        public void TestScalarProductNullArray()
        {
            My_Array a      = null;
            double   scalar = a.ScalarProduct(new int[] { 1, 2, 3 });

            Assert.Fail();
        }
Esempio n. 4
0
        public void TestScalarProductArrayDifLength()
        {
            My_Array a      = new My_Array(new int[] { 1, 2, 3 });
            double   scalar = a.ScalarProduct(new int[] { 1, 2 });

            Assert.Fail();
        }
Esempio n. 5
0
        public void TestSumArrayDifLength()
        {
            My_Array a = new My_Array(new int[] { 1, 2, 3 });

            a.Sum(new int[] { 1, 2 });
            Assert.Fail();
        }
Esempio n. 6
0
        public void TestScalarProductArraySameLength()
        {
            My_Array a      = new My_Array(new int[] { 1, 2, 3 });
            double   scalar = a.ScalarProduct(new int[] { 1, 2, 3 });

            Assert.AreEqual(scalar, 14);
        }
Esempio n. 7
0
        public void TestSumArraySameLength()
        {
            My_Array a = new My_Array(new int[] { 1, 2, 3 });

            a.Sum(new int[] { 1, 2, 3 });
            CollectionAssert.AreEqual(a.A, new int[] { 2, 4, 6 });
        }
Esempio n. 8
0
        public void TestSumNullArray()
        {
            My_Array a = null;

            a.Sum(new int[] { 1, 2, 3 });
            Assert.Fail();
        }
Esempio n. 9
0
        public void Array_Sum_123_123_246()
        {
            My_Array a = new My_Array(new int[] { 1, 2, 3 });

            a.Sum(new int[] { 1, 2, 3 });
            CollectionAssert.AreEqual(a.A, new int[] { 2, 4, 6 });
        }
Esempio n. 10
0
        public void MyArrayToAnother()
        {
            My_Array a = new My_Array(new int[] { 1, 2, 3 });
            My_Array b = new My_Array(a);

            CollectionAssert.AreEqual(a.A, b.A);
        }
Esempio n. 11
0
        public void Array_Sum_ShorterLength()
        {
            My_Array a = new My_Array(new int[] { 1, 2, 3 });

            a.Sum(new int[] { 1, 2 });

            Assert.Fail();
        }
Esempio n. 12
0
        public void CreateFromAnotherArray_FullCopy()
        {
            int[]    x = new int[] { 1, 2, 3 };
            My_Array a = new My_Array(x);
            My_Array b = new My_Array(a);

            a.Sum(x);
            CollectionAssert.AreEqual(a.A, x);
            Assert.Fail();
        }
Esempio n. 13
0
        public void Array_Create_FullCopy()
        {
            My_Array array = null;

            {
                int [] k = { 1, 2, 3 };
                array = new My_Array(k);

                k[0] = 2;
            }

            CollectionAssert.AreEqual(array.A, new int[] { 1, 2, 3 });
        }