use of io.questdb.std.LongList in project questdb by bluestreak01.
the class IntervalUtilsTest method testIntersectInplace.
@Test
public void testIntersectInplace() {
LongList intervals = new LongList();
// A
add(intervals, -1, 10);
// B
add(intervals, 1, 2);
add(intervals, 3, 4);
runTestIntersectInplace(intervals, 2, "[1,4]");
}
use of io.questdb.std.LongList in project questdb by bluestreak01.
the class IntervalUtilsTest method testLastAContainsWhoelBUnionAllAfterB.
@Test
public void testLastAContainsWhoelBUnionAllAfterB() {
LongList intervals = new LongList();
// A
add(intervals, 1, 2);
add(intervals, 3, 4);
add(intervals, 50, 250);
// B
add(intervals, 100, 101);
add(intervals, 200, 201);
add(intervals, 205, 206);
runTestUnionInplace(intervals, 6, "[1,2], [3,4], [50,250]");
}
use of io.questdb.std.LongList in project questdb by bluestreak01.
the class IntervalUtilsTest method testIsInListWithOneInterval.
@Test
public void testIsInListWithOneInterval() {
LongList intervals = new LongList();
add(intervals, 100, 102);
Assert.assertFalse(IntervalUtils.isInIntervals(intervals, 99));
Assert.assertTrue(IntervalUtils.isInIntervals(intervals, 100));
Assert.assertTrue(IntervalUtils.isInIntervals(intervals, 101));
Assert.assertTrue(IntervalUtils.isInIntervals(intervals, 102));
Assert.assertFalse(IntervalUtils.isInIntervals(intervals, 103));
}
use of io.questdb.std.LongList in project questdb by bluestreak01.
the class IntervalUtilsTest method runTestInvertInplace.
private void runTestInvertInplace(LongList intervals, int divider, String expected) {
LongList toInvertExtracted = new LongList(intervals);
IntervalUtils.invert(intervals, divider);
TestUtils.assertEquals(expected, toIntervalString(intervals, divider));
LongList copy1 = new LongList(toInvertExtracted);
IntervalUtils.invert(copy1, divider);
TestUtils.assertEquals(expected, toIntervalString(copy1, divider));
// Double invert must be same as in the beginning
IntervalUtils.invert(copy1, divider);
TestUtils.assertEquals(toIntervalString(toInvertExtracted, divider), toIntervalString(copy1, divider));
}
use of io.questdb.std.LongList in project questdb by bluestreak01.
the class IntervalUtilsTest method testIsInEmptyIntervalList.
@Test
public void testIsInEmptyIntervalList() {
LongList intervals = new LongList();
Assert.assertFalse(IntervalUtils.isInIntervals(intervals, 123));
}
Aggregations