Search in sources :

Example 16 with LongList

use of io.questdb.std.LongList in project questdb by bluestreak01.

the class IntervalUtilsTest method testIntersectInplace2.

@Test
public void testIntersectInplace2() {
    LongList intervals = new LongList();
    // A
    add(intervals, -1, 10);
    // B
    add(intervals, 1, 2);
    add(intervals, 4, 5);
    runTestIntersectInplace(intervals, 2, "[1,2], [4,5]");
}
Also used : LongList(io.questdb.std.LongList) Test(org.junit.Test)

Example 17 with LongList

use of io.questdb.std.LongList in project questdb by bluestreak01.

the class IntervalUtilsTest method testUnionEmpty2.

@Test
public void testUnionEmpty2() {
    LongList intervals = new LongList();
    // A
    runTestUnionInplace(intervals, 0, "");
}
Also used : LongList(io.questdb.std.LongList) Test(org.junit.Test)

Example 18 with LongList

use of io.questdb.std.LongList in project questdb by bluestreak01.

the class IntervalUtilsTest method testIntersectEmpty.

@Test
public void testIntersectEmpty() {
    LongList intervals = new LongList();
    // A
    // B
    add(intervals, -20, -2);
    add(intervals, 1, 2);
    runTestIntersectInplace(intervals, 0, "");
}
Also used : LongList(io.questdb.std.LongList) Test(org.junit.Test)

Example 19 with LongList

use of io.questdb.std.LongList in project questdb by bluestreak01.

the class IntervalUtilsTest method testInvertWithNegativeInfinity.

@Test
public void testInvertWithNegativeInfinity() {
    LongList intervals = new LongList();
    // A
    intervals.add(1);
    // B
    add(intervals, 2, 100);
    add(intervals, 200, Long.MAX_VALUE);
    runTestInvertInplace(intervals, 1, "[NaN,1], [101,199]");
}
Also used : LongList(io.questdb.std.LongList) Test(org.junit.Test)

Example 20 with LongList

use of io.questdb.std.LongList in project questdb by bluestreak01.

the class IntervalUtilsTest method testIsInListWithOddNumberOfIntervals.

@Test
public void testIsInListWithOddNumberOfIntervals() {
    LongList intervals = new LongList();
    add(intervals, 100, 102);
    add(intervals, 122, 124);
    add(intervals, 150, 155);
    Assert.assertFalse(IntervalUtils.isInIntervals(intervals, 99));
    Assert.assertTrue(IntervalUtils.isInIntervals(intervals, 101));
    Assert.assertFalse(IntervalUtils.isInIntervals(intervals, 103));
    Assert.assertTrue(IntervalUtils.isInIntervals(intervals, 123));
    Assert.assertFalse(IntervalUtils.isInIntervals(intervals, 125));
    Assert.assertTrue(IntervalUtils.isInIntervals(intervals, 151));
    Assert.assertFalse(IntervalUtils.isInIntervals(intervals, 156));
}
Also used : LongList(io.questdb.std.LongList) Test(org.junit.Test)

Aggregations

LongList (io.questdb.std.LongList)30 Test (org.junit.Test)25 LongTreeSet (io.questdb.griffin.engine.table.LongTreeSet)3 Rnd (io.questdb.std.Rnd)2 CyclicBarrier (java.util.concurrent.CyclicBarrier)2 GriffinParserTestUtils.intervalToString (io.questdb.griffin.GriffinParserTestUtils.intervalToString)1 SOCountDownLatch (io.questdb.mp.SOCountDownLatch)1 ObjList (io.questdb.std.ObjList)1 Random (java.util.Random)1 BrokenBarrierException (java.util.concurrent.BrokenBarrierException)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1