@Test
public void testEncode()
{

    KeyAlgo algo = new LinearKeyAlgo(3, 4).setBounds(-1, 9, -2, 20);
    assertEquals(2L, algo.encode(-1, 5));
    assertEquals(11L, algo.encode(14, 7));
    // on grid => lower number
    assertEquals(5L, algo.encode(8, 4));
    // out of bounds
    assertEquals(1L, algo.encode(-4, 3));
    assertEquals(3L, algo.encode(2, 22));
    assertEquals(0L, algo.encode(-4, -4));
    assertEquals(11L, algo.encode(22, 22));
}