示例#1
0
        public void GetAllExactCovers_Returns_Correct_Solution_For_Test_Matrix_2()
        {
            // arrange
            var m = new AlgorithmXMatrix(4);

            m.AddRows(new[]
            {
                new[] { 0, 1, 2 },
                new[] { 0, 2 },
                new[] { 1 },
                new[] { 3 }
            });

            // act
            var solutions = m.GetAllExactCovers();

            // assert
            AssertSoolutionsAreEqual(
                new[]
            {
                new[]
                {
                    new[] { 1 },
                    new[] { 0, 2 },
                    new[] { 3 }
                },
                new[]
                {
                    new[] { 0, 1, 2 },
                    new[] { 3 }
                }
            },
                solutions);
        }
示例#2
0
        public void GetAllExactCovers_Returns_Correct_Solution_For_Test_Matrix_1_With_Additional_Empty_Rows()
        {
            // arrange
            var m = new AlgorithmXMatrix(7);

            m.AddRows(new[]
            {
                new int[0],
                new[] { 2, 4, 5 },
                new[] { 0, 3, 6 },
                new[] { 1, 2, 5 },
                new[] { 0, 3 },
                new[] { 1, 6 },
                new[] { 3, 4, 6 }
            });

            // act
            var solutions = m.GetAllExactCovers();

            // assert

            AssertSoolutionsAreEqual(
                new[]
            {
                new[]
                {
                    new[] { 2, 4, 5 },
                    new[] { 0, 3 },
                    new[] { 1, 6 }
                }
            },
                solutions);
        }
示例#3
0
        public void ArgumentException_Is_Thrown_If_Columns_Are_Not_Ordered()
        {
            // arrange
            var m = new AlgorithmXMatrix(4);

            // act
            m.AddRows(new[]
            {
                new [] { 3, 2 },
            });

            // assert
            Assert.Fail();
        }
示例#4
0
        public void GetAllExactCovers_Returns_No_Solutions_For_Test_Matrix_3()
        {
            // arrange
            var m = new AlgorithmXMatrix(4);

            m.AddRows(new[]
            {
                new[] { 0, 1 },
                new[] { 0, 2 },
                new[] { 1, 2 },
            });

            // act
            var solutions = m.GetAllExactCovers();

            // assert
            Assert.AreEqual(0, solutions.Count());
        }