Example #1
0
        public void CloneTest3()
        {
            RectMatrix <int, string> matrix = new RectMatrix <int, string>();

            matrix.EnsureSize(2, 3);
            matrix[0, 0]               = 11;
            matrix[0, 1]               = 12;
            matrix[0, 2]               = 27;
            matrix[1, 0]               = 9;
            matrix[1, 1]               = 10;
            matrix[1, 2]               = 55;
            matrix.RowAttributes[1]    = "R1";
            matrix.ColumnAttributes[0] = "C1";
            matrix.ColumnAttributes[1] = "C2";
            matrix.ColumnAttributes[2] = "C3";
            var result = matrix.Clone();

            Assert.AreEqual(11, result[0, 0]);
            Assert.AreEqual(12, result[0, 1]);
            Assert.AreEqual(27, result[0, 2]);
            Assert.AreEqual(9, result[1, 0]);
            Assert.AreEqual(10, result[1, 1]);
            Assert.AreEqual(55, result[1, 2]);
            Assert.IsNull(null, result.RowAttributes[0]);
            Assert.AreEqual("R1", result.RowAttributes[1]);
            Assert.AreEqual("C1", result.ColumnAttributes[0]);
            Assert.AreEqual("C2", result.ColumnAttributes[1]);
            Assert.AreEqual("C3", result.ColumnAttributes[2]);
        }
Example #2
0
        public void CloneSimpleTest2()
        {
            RectMatrix <int, int> matrix = new RectMatrix <int, int>(12, 16);

            matrix.EnsureSize(8, 6);
            var result = matrix.Clone();

            Assert.IsNotNull(result);
            Assert.AreEqual(new MatrixSize(12, 16), result.Capacity);
            Assert.AreEqual(new MatrixSize(8, 6), result.Size);
        }
Example #3
0
        public void CloneSimpleTest1()
        {
            RectMatrix <float> matrix = new RectMatrix <float>(4, 6);

            matrix.EnsureSize(2, 4);
            var result = matrix.Clone();

            Assert.IsNotNull(result);
            Assert.AreEqual(new MatrixSize(4, 6), result.Capacity);
            Assert.AreEqual(new MatrixSize(2, 4), result.Size);
        }
Example #4
0
        public void CloneTest2()
        {
            RectMatrix <string> matrix = new RectMatrix <string>();

            matrix.EnsureSize(3, 2);
            matrix[0, 0] = "A";
            matrix[0, 1] = "3";
            matrix[1, 0] = "9";
            matrix[1, 1] = "0";
            matrix[2, 0] = "7";
            matrix[2, 1] = "P";
            var result = matrix.Clone();

            Assert.AreEqual("A", result[0, 0]);
            Assert.AreEqual("3", result[0, 1]);
            Assert.AreEqual("9", result[1, 0]);
            Assert.AreEqual("0", result[1, 1]);
            Assert.AreEqual("7", result[2, 0]);
            Assert.AreEqual("P", result[2, 1]);
        }
Example #5
0
        public void CloneTest1()
        {
            RectMatrix <int> matrix = new RectMatrix <int>();

            matrix.EnsureSize(2, 3);
            matrix[0, 0] = 1;
            matrix[0, 1] = 2;
            matrix[0, 2] = 7;
            matrix[1, 0] = 9;
            matrix[1, 1] = 0;
            matrix[1, 2] = 5;
            var result = matrix.Clone();

            Assert.AreEqual(1, result[0, 0]);
            Assert.AreEqual(2, result[0, 1]);
            Assert.AreEqual(7, result[0, 2]);
            Assert.AreEqual(9, result[1, 0]);
            Assert.AreEqual(0, result[1, 1]);
            Assert.AreEqual(5, result[1, 2]);
        }