package com.fishercoder;

import com.fishercoder.solutions._200;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class _200Test {
    private static _200.DFSSolution dfsSolution;
    private static _200.UnionFindSolution unionFindSolution;
    private static char[][] grid;

    @BeforeClass
    public static void setup(){
        dfsSolution = new _200.DFSSolution();
        unionFindSolution = new _200.UnionFindSolution();
    }

    @Test
    public void test1(){
        grid = new char[][]{
                {'1','1','1'},
                {'0','1','0'},
                {'1','1','1'},
        };
        assertEquals(1, dfsSolution.numIslands(grid));
        assertEquals(1, unionFindSolution.numIslands(grid));
    }

    @Test
    public void test2(){
        grid = new char[][]{
                {'1','1','1','1','0'},
                {'1','1','0','1','0'},
                {'1','1','0','0','0'},
                {'0','0','0','0','0'},
        };
        assertEquals(0, dfsSolution.numIslands(grid));
        assertEquals(0, unionFindSolution.numIslands(grid));
    }

    @Test
    public void test3(){
        grid = new char[][]{
                {'1','1','0','0','0'},
                {'1','1','0','0','0'},
                {'0','0','1','0','0'},
                {'0','0','0','1','1'},
        };
        assertEquals(3, dfsSolution.numIslands(grid));
        assertEquals(3, unionFindSolution.numIslands(grid));
    }

}

@@ -81,21 +81,16 @@
 t.Before
-Class
 ;%0Aimport
@@ -337,13 +337,8 @@
 fore
-Class
 %0A   
@@ -345,23 +345,16 @@
  public 
-static 
 void set
@@ -684,32 +684,166 @@
 mIslands(grid));
+%0A%0A        grid = new char%5B%5D%5B%5D%7B%0A                %7B'1','1','1'%7D,%0A                %7B'0','1','0'%7D,%0A                %7B'1','1','1'%7D,%0A        %7D;
 %0A        assertE
@@ -1147,17 +1147,17 @@
 tEquals(
-0
+1
 , dfsSol
@@ -1172,32 +1172,229 @@
 mIslands(grid));
+%0A%0A        grid = new char%5B%5D%5B%5D%7B%0A                %7B'1','1','1','1','0'%7D,%0A                %7B'1','1','0','1','0'%7D,%0A                %7B'1','1','0','0','0'%7D,%0A                %7B'0','0','0','0','0'%7D,%0A        %7D;
 %0A        assertE
@@ -1399,17 +1399,17 @@
 tEquals(
-0
+1
 , unionF
@@ -1727,24 +1727,221 @@
 ands(grid));
+%0A%0A        grid = new char%5B%5D%5B%5D%7B%0A                %7B'1','1','0','0','0'%7D,%0A                %7B'1','1','0','0','0'%7D,%0A                %7B'0','0','1','0','0'%7D,%0A                %7B'0','0','0','1','1'%7D,%0A        %7D;
 %0A        ass

fix build