confirmDoubleConvert(-2.00, -2);
confirmDoubleConvert(-2.01, -3);
}
public void testLinearOffsetRange() {
LinearOffsetRange lor;
lor = new LinearOffsetRange(3, 2);
assertEquals(3, lor.getFirstIndex());
assertEquals(4, lor.getLastIndex());
lor = lor.normaliseAndTranslate(0); // expected no change
assertEquals(3, lor.getFirstIndex());
assertEquals(4, lor.getLastIndex());
lor = lor.normaliseAndTranslate(5);
assertEquals(8, lor.getFirstIndex());
assertEquals(9, lor.getLastIndex());
// negative length
lor = new LinearOffsetRange(6, -4).normaliseAndTranslate(0);
assertEquals(3, lor.getFirstIndex());
assertEquals(6, lor.getLastIndex());
// bounds checking
lor = new LinearOffsetRange(0, 100);
assertFalse(lor.isOutOfBounds(0, 16383));
lor = lor.normaliseAndTranslate(16300);
assertTrue(lor.isOutOfBounds(0, 16383));
assertFalse(lor.isOutOfBounds(0, 65535));
}