Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static final class IntervalStreamer extends AtomicReference<Disposable>
public void run() {
var c = counterTask++;
available = c;
if (c + 1 >= end) {
if (c + 1 - end >= 0) {
DisposableHelper.dispose(this);
}
for (;;) {
Expand All @@ -107,7 +107,7 @@ public void run() {
public @NonNull CompletionStage<Boolean> next() {
waiter.getAndSet(null);
for (;;) {
if (counterLocal >= end) {
if (counterLocal - end >= 0) {
return NEXT_FALSE;
}
var c = current;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,23 @@ public void underNoOverflowLong() throws Throwable {
Streamable.intervalRange(-2, Long.MAX_VALUE, 20, 20, TimeUnit.MILLISECONDS, Schedulers.single());
}

@Test
public void maxValueEnd() {
Streamable.intervalRange(Long.MAX_VALUE - 2, 3, 1, 1, TimeUnit.MILLISECONDS, Schedulers.single())
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(Long.MAX_VALUE - 2, Long.MAX_VALUE - 1, Long.MAX_VALUE);
}

@Test
public void unlimitedFromOne() {
Streamable.intervalRange(1, Long.MAX_VALUE, 1, 1, TimeUnit.MILLISECONDS, Schedulers.single())
.take(3)
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1L, 2L, 3L);
}

@Test
public void underflowLongExec() throws Throwable {
assertThrows(IllegalArgumentException.class, () -> {
Expand Down
Loading