Skip to content

Commit

Permalink
fix: added array wrap-around functionality for the TestClock
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Peterson <[email protected]>
  • Loading branch information
mattp-swirldslabs committed Jun 27, 2024
1 parent def0452 commit babcb8a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ static class TestClock implements InstantSource {

@Override
public long millis() {
return millis[index++];
long value = millis[index];

// cycle through the provided millis
// and wrap around if necessary
index = index > millis.length - 1 ? 0 : index + 1;
return value;
}

@Override
Expand Down

0 comments on commit babcb8a

Please sign in to comment.