@Test
public void testFloorSum() {

    AVLGroupTree x = new AVLGroupTree(false);
    int total = 0;
    for (int i = 0; i < 1000; ++i) {
        int count = randomIntBetween(1, 10);
        x.add(randomDouble(), count, null);
        total += count;
    }
    assertEquals(IntAVLTree.NIL, x.floorSum(-1));
    for (long i = 0; i < total + 10; ++i) {
        final int floorNode = x.floorSum(i);
        assertTrue(x.headSum(floorNode) <= i);
        final int next = x.next(floorNode);
        assertTrue(next == IntAVLTree.NIL || x.headSum(next) > i);
    }
}