@Test public void testCharArea2() { char[][] grid = new char[][] { {'c', 'a', ' '}, {'b', ' ', 'b'}, {' ', ' ', 'a'} }; CharGrid cg = new CharGrid(grid); assertEquals(6, cg.charArea('a')); assertEquals(3, cg.charArea('b')); assertEquals(1, cg.charArea('c')); assertEquals(9, cg.charArea(' ')); }
@Test public void testCharArea3() { char[][] grid = new char[][] { {'.', 'a', ','}, {'b', 'a', 'b'}, {'+', ',', 'a'} }; CharGrid cg = new CharGrid(grid); assertEquals(6, cg.charArea('a')); assertEquals(3, cg.charArea('b')); assertEquals(0, cg.charArea('c')); assertEquals(6, cg.charArea(',')); assertEquals(1, cg.charArea('+')); }
@Test public void testCharArea1() { char[][] grid = new char[][] { {'a', 'y', ' '}, {'x', 'a', 'z'}, }; CharGrid cg = new CharGrid(grid); assertEquals(4, cg.charArea('a')); assertEquals(1, cg.charArea('z')); }
public void testCharArea4() { char[][] grid = new char[][] { {'.', 'a', ',', 'd', 'b', 'j'}, {'b', 'a', 'b', ',', 'b', '+'}, {'+', ',', 'a', 'b', '+', '.'} }; CharGrid cg = new CharGrid(grid); assertEquals(18, cg.charArea('.')); assertEquals(1, cg.charArea('j')); assertEquals(15, cg.charArea('b')); assertEquals(9, cg.charArea(',')); assertEquals(12, cg.charArea('+')); assertEquals(1, cg.charArea('d')); }