Ejemplo n.º 1
0
        public void findMaxIsland3()
        {
            int[] threeIslandGrid = new int[]
            {
                0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0,
            };

            var islandExplorer = new IslandExplorer();

            Assert.AreEqual(4, islandExplorer.search(threeIslandGrid));
        }
Ejemplo n.º 2
0
        public void findOneIsland()
        {
            int[] oneIslandGrid = new int[]
            {
                0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
            };

            var islandExplorer = new IslandExplorer();

            Assert.AreEqual(1, islandExplorer.search(oneIslandGrid));
        }
Ejemplo n.º 3
0
        public void findZeroIsland()
        {
            int[] zeroIslandGrid = new int[]
            {
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            };

            var islandExplorer = new IslandExplorer();

            Assert.AreEqual(0, islandExplorer.search(zeroIslandGrid));
        }
Ejemplo n.º 4
0
        public void findThreeSizeIsland()
        {
            int[][] islandGrid = new int[][]
            {
                new int [] { 0, 1, 0 },
                new int [] { 0, 1, 0 },
                new int [] { 0, 1, 0 },
            };

            var islandExplorer = new IslandExplorer();

            Assert.AreEqual(3, islandExplorer.search(0, 0, islandGrid));
        }
Ejemplo n.º 5
0
        public void checkGridLength()
        {
            int[][] islandGrid = new int[][]
            {
                new int [] { 0, 0, 0 },
                new int [] { 0, 0, 0 },
                new int [] { 0, 0, 0 },
            };

            var islandExplorer = new IslandExplorer();

            Assert.IsTrue(islandExplorer.checkGridLength(islandGrid));
        }
Ejemplo n.º 6
0
        public void findConnectedFiveIsland()
        {
            int[][] islandGrid = new int[][]
            {
                new int[] { 0, 1, 0 },
                new int[] { 1, 1, 1 },
                new int[] { 0, 1, 0 },
            };

            var islandExplorer = new IslandExplorer();

            Assert.AreEqual(5, islandExplorer.MaxAreaOfIsland(islandGrid));
        }
Ejemplo n.º 7
0
        public void findOneIsland()
        {
            int[][] islandGrid = new int[][]
            {
                new int[] { 0, 0, 0 },
                new int[] { 0, 1, 0 },
                new int[] { 0, 0, 0 },
            };

            var islandExplorer = new IslandExplorer();

            Assert.AreEqual(1, islandExplorer.MaxAreaOfIsland(islandGrid));
        }
Ejemplo n.º 8
0
        public void checkThreeSizeIsland_Down()
        {
            int[][] islandGrid = new int[][]
            {
                new int [] { 1, 0, 0 },
                new int [] { 1, 0, 0 },
                new int [] { 1, 0, 1 },
            };

            var islandExplorer = new IslandExplorer();

            Assert.IsTrue(islandExplorer.checkGridLength(islandGrid));
            Assert.AreEqual(3, islandExplorer.search(0, 0, islandGrid));
        }
Ejemplo n.º 9
0
        public void checkLimitDimensionOfGrid_normal()
        {
            int[] normalGrid = new int[]
            {
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            };

            var islandExplorer = new IslandExplorer();

            Assert.IsFalse(islandExplorer.checkLimitDimension(normalGrid));
        }
Ejemplo n.º 10
0
        public void checkLimitDimensionOfGrid_exceed()
        {
            int[] exceedGrid = new int[]
            {
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
            };

            var islandExplorer = new IslandExplorer();

            Assert.IsTrue(islandExplorer.checkLimitDimension(exceedGrid));
        }
Ejemplo n.º 11
0
 public void makeInstance()
 {
     var islandExplorer = new IslandExplorer();
 }