@Test
public void testLevelToNegative() throws Exception {

    Number n = new NumberWithGradient(3, -7, 2);
    int expected[] = { 3, 1, -1, -3, -5, -7, -7, -7};
    for(int idx=0; idx<expected.length; idx++) {
        int i = n.intValue();
        Assert.assertEquals("Invalid value at iteration " + idx, expected[idx], i);
    }
}