@Test
public void testWrapX() throws Exception {

    final GridDef gridDef = GridDef.createGlobal(8, 4);
    assertEquals(0, gridDef.wrapX(0));
    assertEquals(7, gridDef.wrapX(7));
    assertEquals(7, gridDef.wrapX(-1));
    assertEquals(6, gridDef.wrapX(-2));
    assertEquals(5, gridDef.wrapX(-3));
    assertEquals(4, gridDef.wrapX(-4));
    assertEquals(3, gridDef.wrapX(-5));
    assertEquals(2, gridDef.wrapX(-6));
    assertEquals(1, gridDef.wrapX(-7));
    assertEquals(0, gridDef.wrapX(-8));
    assertEquals(7, gridDef.wrapX(-9));
    assertEquals(0, gridDef.wrapX(8));
    assertEquals(1, gridDef.wrapX(9));
    assertEquals(2, gridDef.wrapX(10));
    assertEquals(3, gridDef.wrapX(11));
    assertEquals(4, gridDef.wrapX(12));
    assertEquals(5, gridDef.wrapX(13));
    assertEquals(6, gridDef.wrapX(14));
    assertEquals(7, gridDef.wrapX(15));
    assertEquals(0, gridDef.wrapX(16));
}