Beispiel #1
0
        public void IfStartedAtTargetThenPathExists()
        {
            var       sut        = new RatInAMaze();
            const int sampleSize = 3;
            var       maze       = new int[sampleSize][];

            maze[0]    = new int[sampleSize];
            maze[0][0] = 1;
            Assert.True(sut.IsPathExists(maze, 0, 0));
        }
Beispiel #2
0
        public void IfSurroundedByDeadEnsPathDoNotExists()
        {
            var       sut        = new RatInAMaze();
            const int sampleSize = 3;
            var       maze       = new int[sampleSize][];

            maze[0]    = new int[sampleSize];
            maze[1]    = new int[sampleSize];
            maze[2]    = new int[sampleSize];
            maze[0][0] = 1;
            Assert.False(sut.IsPathExists(maze, 2, 2));
        }
Beispiel #3
0
        public void ComplexPath()
        {
            var sut = new RatInAMaze();

            var maze = new int[4][];

            maze[0] = new[] { 1, 0, 1, 1, 0 };
            maze[1] = new[] { 1, 1, 1, 0, 1 };
            maze[2] = new[] { 0, 1, 0, 1, 1 };
            maze[3] = new[] { 1, 1, 1, 1, 1 };

            Assert.True(sut.IsPathExists(maze, 2, 3));
        }
Beispiel #4
0
        public void SimplePath()
        {
            var       sut        = new RatInAMaze();
            const int sampleSize = 2;
            var       maze       = new int[sampleSize][];

            maze[0]    = new int[sampleSize];
            maze[1]    = new int[sampleSize];
            maze[0][0] = 1;
            maze[0][1] = 1;
            maze[1][1] = 1;
            Assert.True(sut.IsPathExists(maze, 1, 1));
        }