Beispiel #1
0
        public void FourRussiansMethodTest()
        {
            // arrange
            int[][] A = new int[][] {
                new int[] { 0, 0, 1 },
                new int[] { 1, 0, 1 },
                new int[] { 1, 0, 0 }
            };
            int[][] B = new int[][] {
                new int[] { 1, 1, 1 },
                new int[] { 0, 0, 1 },
                new int[] { 1, 0, 1 }
            };
            int[][] C = new int[][] {
                new int[] { 1, 0, 1 },
                new int[] { 1, 1, 1 },
                new int[] { 1, 1, 1 }
            };

            int[][] X = new int[][] {
                new int[] { 1, 1, 1 },
                new int[] { 0, 0, 0 },
                new int[] { 0, 0, 0 }
            };
            int[][] Y = new int[][] {
                new int[] { 1, 0, 0 },
                new int[] { 1, 0, 0 },
                new int[] { 1, 0, 0 }
            };
            int[][] Z = new int[][] {
                new int[] { 1, 0, 0 },
                new int[] { 0, 0, 0 },
                new int[] { 0, 0, 0 }
            };

            // action
            bool actual1 = Operations.MatrixEqual(FourRussians.FourRussiansMethod(A, B), C);
            bool actual2 = Operations.MatrixEqual(FourRussians.FourRussiansMethod(X, Y), Z);

            // assert
            Assert.AreEqual(actual1, true);
            Assert.AreEqual(actual2, true);
        }