Ejemplo n.º 1
0
  @Test
  public void shouldGive3PositionsForP15_15() {
    center = new Position(15, 15);
    iter = Utility.get8NeighborhoodIterator(center);
    neighborhood = convertIteration2List(iter);

    assertTrue("Must contain (14,15)", neighborhood.contains(new Position(14, 15)));
    assertTrue("Must contain (14,14)", neighborhood.contains(new Position(14, 14)));
    assertTrue("Must contain (15,14)", neighborhood.contains(new Position(15, 14)));

    assertEquals("Should be 3 positions in the iterator", 3, neighborhood.size());
  }
Ejemplo n.º 2
0
  @Test
  public void shouldGive8PositionsForP8_8() {
    center = new Position(8, 8);
    iter = Utility.get8NeighborhoodIterator(center);
    neighborhood = convertIteration2List(iter);

    assertTrue("Must contain (7,7)", neighborhood.contains(new Position(7, 7)));
    assertTrue("Must contain (9,9)", neighborhood.contains(new Position(9, 9)));
    assertTrue("Must contain (7,9)", neighborhood.contains(new Position(7, 9)));
    assertTrue("Must contain (8,7)", neighborhood.contains(new Position(8, 7)));

    assertFalse("Must not contain center position", neighborhood.contains(center));

    assertFalse("Must not contain (5,5) position", neighborhood.contains(new Position(5, 5)));

    assertEquals("Should be 8 positions in the iterator", 8, neighborhood.size());
  }