public void DontColorMyMatrix()
        {
            AdjacencyList list = new AdjacencyList("2x2onecolor.txt");
            var colorsLine = File.ReadLines("2x2onecolor.txt").First();
            var colors = colorsLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(short.Parse);

            IGraphTraversal traversal = new MatrixTraversal(list, colors.ToArray());
            IColorator colorator = new MatrixColorator(traversal);
            colorator.Color();
        }
示例#2
0
        public void TestMethod1()
        {
            byte n = 0;
            var  expectedMatrix = new int[n, n];
            var  actualMatrix   = MatrixTraversal.GenerateMatrix(n);

            var areMatrixesEqual = this.AreMatricesEqual(expectedMatrix, actualMatrix);

            Assert.IsTrue(areMatrixesEqual);
        }
        public static int[,] Generate(int size)
        {
            var matrix = new int[size, size];

            var startupCell = MatrixTraversal.FindFirstAvailableCell(matrix);

            if (startupCell != null)
            {
                MatrixTraversal.FillMatrix(matrix, startupCell);
            }

            return(matrix);
        }
示例#4
0
        public void TestMethod3()
        {
            byte n = 2;
            var  expectedMatrix = new int[, ]
            {
                { 1, 4 },
                { 3, 2 }
            };
            var actualMatrix = MatrixTraversal.GenerateMatrix(n);

            var areMatrixesEqual = this.AreMatricesEqual(expectedMatrix, actualMatrix);

            Assert.IsTrue(areMatrixesEqual);
        }
示例#5
0
        public void TestMethod4()
        {
            byte n = 3;
            var  expectedMatrix = new int[, ]
            {
                { 1, 7, 8 },
                { 6, 2, 9 },
                { 5, 4, 3 }
            };
            var actualMatrix = MatrixTraversal.GenerateMatrix(n);

            var areMatrixesEqual = this.AreMatricesEqual(expectedMatrix, actualMatrix);

            Assert.IsTrue(areMatrixesEqual);
        }
示例#6
0
        public void TestMethod5()
        {
            byte n = 6;
            var  expectedMatrix = new int[, ]
            {
                { 1, 16, 17, 18, 19, 20 },
                { 15, 2, 27, 28, 29, 21 },
                { 14, 31, 3, 26, 30, 22 },
                { 13, 36, 32, 4, 25, 23 },
                { 12, 35, 34, 33, 5, 24 },
                { 11, 10, 9, 8, 7, 6 }
            };
            var actualMatrix = MatrixTraversal.GenerateMatrix(n);

            var areMatrixesEqual = this.AreMatricesEqual(expectedMatrix, actualMatrix);

            Assert.IsTrue(areMatrixesEqual);
        }
 public void MatrixTraversal_Should_Be_Initialized()
 {
     MatrixTraversal traversal = new MatrixTraversal(null, null);
     Assert.Inconclusive();
 }