Exemple #1
0
        private static void MaxSubmatrixTest(int[,] matrix, int n)
        {
            int expected = MaxSubmatrixTestClass.GetMaxSubmatrixSum(matrix, n);
            int actual   = MaxSubmatrixClass.MaxSubmatrix(matrix);

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void MaxSubmatrixTest()
        {
            for (int i = 0; i < 10; i++)
            {
                int n = 5;
                int[,] matrix = new int[n, n];
                Random random = new Random();

                for (int j = 0; j < n; j++)
                {
                    for (int k = 0; k < n; k++)
                    {
                        matrix[j, k] = random.Next(-20, 21);
                    }
                }

                MaxSubmatrixTestClass.MaxSubmatrixTest(matrix, n);
            }
        }