Exemplo n.º 1
0
  @Test
  public void testCountPlus1() {
    char[][] grid =
        new char[][] {
          {'a', 'y', ' '},
          {'x', 'a', 'z'},
        };

    CharGrid cg = new CharGrid(grid);

    assertEquals(0, cg.countPlus());
  }
Exemplo n.º 2
0
  @Test
  public void testCountPlus2() {
    char[][] grid =
        new char[][] {
          {'.', 'a', ','},
          {'a', 'a', 'a'},
          {'+', 'a', 'a'}
        };

    CharGrid cg = new CharGrid(grid);

    assertEquals(1, cg.countPlus());
  }
Exemplo n.º 3
0
  @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'));
  }
Exemplo n.º 4
0
  @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(' '));
  }
Exemplo n.º 5
0
  @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('+'));
  }
Exemplo n.º 6
0
  @Test
  public void testCountPlus6() {
    char[][] grid =
        new char[][] {
          {'a', 'b', 'a', 'a', 'a', 'j'},
          {'a', 'a', 'a', 'a', 'b', 'b'},
          {'a', 'a', 'a', 'b', 'b', 'b'},
          {'a', 'a', 'a', 'c', 'b', '+'},
          {'a', 'b', 'c', 'c', 'c', '+'},
          {'b', 'b', 'b', 'c', 'b', '+'},
          {'+', 'b', 'a', 'b', '+', '.'}
        };

    CharGrid cg = new CharGrid(grid);

    assertEquals(4, cg.countPlus());
  }
Exemplo n.º 7
0
  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'));
  }