示例#1
0
        public void ManyRectanglesfail()
        {
            //Arrange
            int[,] rectangles = new int[1000001, 4];
            int rectNumber = 0;

            for (int i = 0; i < 1000; i++)
            {
                for (int j = 0; j < 1000; j++)
                {
                    rectangles[rectNumber, 0] = i;
                    rectangles[rectNumber, 1] = j;
                    rectangles[rectNumber, 2] = i + 1;
                    rectangles[rectNumber, 3] = j + 1;
                    rectNumber++;
                }
            }
            rectangles[1000000, 0] = 1000000;
            rectangles[1000000, 1] = 1000000;
            rectangles[1000000, 2] = 1000001;
            rectangles[1000000, 3] = 1000001;

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.False(result);
        }
示例#2
0
        public void BasicPass3()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 3, 3, 15, 22 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.True(result);
        }
示例#3
0
        public void NotConnected1()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 1, 1, 2, 5 },
                { 3, 1, 4, 5 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.False(result);
        }
示例#4
0
        public void NegativePointsPass()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { -2, -2, -1, 2 },
                { -1, -2, 3, 2 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.True(result);
        }
示例#5
0
        public void Overlap3()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 1, 1, 2, 2 },
                { 1, 1, 2, 2 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.False(result);
        }
示例#6
0
        public void Overlap1()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 5, 5, 6, 10 },
                { 5, 9, 6, 15 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.False(result);
        }
示例#7
0
        public void BasicFail3()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 3, 3, 15, 22 },
                { 14, 22, 15, 23 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.False(result);
        }
示例#8
0
        public void AreaTestFail()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 1, 1, 3, 5 },
                { 3, 1, 4, 3 },
                { 2, 4, 4, 5 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.False(result);
        }
示例#9
0
        public void LargeCaseFail()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 1, 1, 1000000, 1000000 },
                { 1, 1000000, 1000000, 1000001 },
                { 1000000, 1, 1000001, 1000002 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.False(result);
        }
示例#10
0
        public void BasicFail1()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 1, 1, 3, 3 },
                { 3, 1, 4, 2 },
                { 3, 2, 4, 4 },
                { 2, 3, 3, 4 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.False(result);
        }
示例#11
0
        public void NotSimplyConnected2()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 1, 1, 2, 10 },
                { 1, 10, 10, 10 },
                { 2, 1, 11, 2 },
                { 10, 2, 11, 11 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.False(result);
        }
示例#12
0
        public void BasicPass4()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 1, 1, 2, 5 },
                { 2, 1, 3, 5 },
                { 3, 1, 4, 5 },
                { 4, 1, 5, 5 },
                { 5, 1, 6, 5 },
                { 6, 1, 7, 5 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.True(result);
        }
示例#13
0
        public void NegativePointsFail()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { -1, -1, -1, -5 },
                { -2, -1, -2, -5 },
                { -3, -1, -3, -5 },
                { -4, -1, -4, -5 },
                { -5, -1, -5, -5 },
                { -6, -1, -6, -4 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.False(result);
        }
示例#14
0
        public void BasicPass2()
        {
            //Arrange
            int[,] rectangles = new int[, ] {
                { 1, 1, 2, 2 },
                { 2, 1, 3, 2 },
                { 1, 2, 2, 3 },
                { 2, 2, 3, 3 },
                { 3, 1, 4, 4 },
                { 1, 3, 3, 5 },
                { 3, 4, 4, 5 }
            };

            //Act
            Problem391 Problem391Solution = new Problem391(rectangles);
            bool       result             = Problem391Solution.Solve();

            //Assert
            Assert.True(result);
        }