use of io.engineblock.activityapi.cyclelog.buffers.cycles.CycleSegment in project engineblock by engineblock.
the class CycleArrayTest method testBasicArray.
@Test
public void testBasicArray() {
CycleArray a1 = new CycleArray(2, 3, 9);
CycleSegment s1 = a1.getInputSegment(1);
assertThat(s1).isNotNull();
assertThat(s1.isExhausted()).isFalse();
long v1 = s1.nextCycle();
assertThat(v1).isEqualTo(2L);
assertThat(s1.isExhausted()).isTrue();
long v2 = s1.nextCycle();
assertThat(v2).isLessThan(0);
CycleSegment s2 = a1.getInputSegment(2);
assertThat(s2).isNotNull();
assertThat(s2.isExhausted()).isFalse();
long v3 = s2.nextCycle();
assertThat(v3).isEqualTo(3L);
assertThat(s2.isExhausted()).isFalse();
long v4 = s2.nextCycle();
assertThat(v4).isEqualTo(9L);
assertThat(s2.isExhausted()).isTrue();
long v5 = s2.nextCycle();
assertThat(v5).isLessThan(0);
CycleSegment s3 = a1.getInputSegment(1);
assertThat(s3).isNull();
}
Aggregations