コード例 #1
0
  @Test
  public void testCountPlus1() {
    char[][] grid =
        new char[][] {
          {'a', 'y', ' '},
          {'x', 'a', 'z'},
        };

    CharGrid cg = new CharGrid(grid);

    assertEquals(0, cg.countPlus());
  }
コード例 #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());
  }
コード例 #3
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());
  }