Skip to content

Commit

Permalink
chore: use isZero instead of isEqualTo(0)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher-Chianelli committed Jan 14, 2025
1 parent 8b32b52 commit f7d9644
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void testResizeBasic() {
});
buffer.resize();
var bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(0);
assertThat(bufferState.readIndex()).isZero();
assertThat(bufferState.writeIndex()).isEqualTo(2);
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(2, 3, 0, 0, 0, 0, 0, 0);
assertThat(bufferState.scoreRingBuffer()).containsExactly(
Expand All @@ -49,7 +49,7 @@ void testResizeWrapped() {
});
buffer.resize();
var bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(0);
assertThat(bufferState.readIndex()).isZero();
assertThat(bufferState.writeIndex()).isEqualTo(2);
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(2, 3, 0, 0, 0, 0, 0, 0);
assertThat(bufferState.scoreRingBuffer()).containsExactly(
Expand All @@ -76,7 +76,7 @@ void testPutEmpty() {
});
buffer.put(1, SimpleScore.of(1));
var bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(0);
assertThat(bufferState.readIndex()).isZero();
assertThat(bufferState.writeIndex()).isEqualTo(1);
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(1, 0, 0, 0);
assertThat(bufferState.scoreRingBuffer()).containsExactly(
Expand All @@ -87,7 +87,7 @@ void testPutEmpty() {

buffer.put(3, SimpleScore.of(2));
bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(0);
assertThat(bufferState.readIndex()).isZero();
assertThat(bufferState.writeIndex()).isEqualTo(2);
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(1, 3, 0, 0);
assertThat(bufferState.scoreRingBuffer()).containsExactly(
Expand All @@ -98,7 +98,7 @@ void testPutEmpty() {

buffer.put(5, SimpleScore.of(3));
bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(0);
assertThat(bufferState.readIndex()).isZero();
assertThat(bufferState.writeIndex()).isEqualTo(3);
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(1, 3, 5, 0);
assertThat(bufferState.scoreRingBuffer()).containsExactly(
Expand All @@ -109,8 +109,8 @@ void testPutEmpty() {

buffer.put(7, SimpleScore.of(4));
bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(0);
assertThat(bufferState.writeIndex()).isEqualTo(0);
assertThat(bufferState.readIndex()).isZero();
assertThat(bufferState.writeIndex()).isZero();
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(1, 3, 5, 7);
assertThat(bufferState.scoreRingBuffer()).containsExactly(
SimpleScore.of(1),
Expand All @@ -120,7 +120,7 @@ void testPutEmpty() {

buffer.put(9, SimpleScore.of(5));
bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(0);
assertThat(bufferState.readIndex()).isZero();
assertThat(bufferState.writeIndex()).isEqualTo(5);
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(1, 3, 5, 7, 9, 0, 0, 0);
assertThat(bufferState.scoreRingBuffer()).containsExactly(
Expand Down Expand Up @@ -169,7 +169,7 @@ void testPutWrapped() {

buffer.put(9, SimpleScore.of(5));
bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(0);
assertThat(bufferState.readIndex()).isZero();
assertThat(bufferState.writeIndex()).isEqualTo(5);
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(1, 3, 5, 7, 9, 0, 0, 0);
assertThat(bufferState.scoreRingBuffer()).containsExactly(
Expand Down Expand Up @@ -197,7 +197,7 @@ void testPeek() {
assertThat(buffer.peekFirst()).isEqualTo(SimpleScore.of(1));
var bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(2);
assertThat(bufferState.writeIndex()).isEqualTo(0);
assertThat(bufferState.writeIndex()).isZero();
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(0, 0, 1, 3);
assertThat(bufferState.scoreRingBuffer()).containsExactly(SimpleScore.of(-1),
SimpleScore.of(0),
Expand All @@ -218,8 +218,8 @@ void testClear() {
});
buffer.clear();
var bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(0);
assertThat(bufferState.writeIndex()).isEqualTo(0);
assertThat(bufferState.readIndex()).isZero();
assertThat(bufferState.writeIndex()).isZero();
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(0, 0, 0, 0);
assertThat(bufferState.scoreRingBuffer()).containsExactly(null,
null,
Expand All @@ -242,7 +242,7 @@ void testPollLatestScoreBeforeTimeAndClearPriorFull() {

var bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(1);
assertThat(bufferState.writeIndex()).isEqualTo(0);
assertThat(bufferState.writeIndex()).isZero();
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(0, 2, 3, 4);
assertThat(bufferState.scoreRingBuffer()).containsExactly(null,
SimpleScore.of(2),
Expand Down Expand Up @@ -420,7 +420,7 @@ void testPollLatestScoreBeforeTimeAndClearPriorEqualWrappedZero() {
});
assertThat(buffer.pollLatestScoreBeforeTimeAndClearPrior(2)).isEqualTo(SimpleScore.of(2));
var bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(0);
assertThat(bufferState.readIndex()).isZero();
assertThat(bufferState.writeIndex()).isEqualTo(3);
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(2, 3, 4, 0, 0);
assertThat(bufferState.scoreRingBuffer()).containsExactly(
Expand Down Expand Up @@ -471,7 +471,7 @@ void testPollLatestScoreBeforeTimeAndClearPriorOverflowWrappedZero() {
assertThat(buffer.pollLatestScoreBeforeTimeAndClearPrior(10)).isEqualTo(SimpleScore.of(2));
var bufferState = buffer.getState();
assertThat(bufferState.readIndex()).isEqualTo(4);
assertThat(bufferState.writeIndex()).isEqualTo(0);
assertThat(bufferState.writeIndex()).isZero();
assertThat(bufferState.nanoTimeRingBuffer()).containsExactly(0, 0, 0, 0, 2);
assertThat(bufferState.scoreRingBuffer()).containsExactly(
null,
Expand Down

0 comments on commit f7d9644

Please sign in to comment.