@@ -15,6 +15,7 @@ import tests.distinctStringValues
15
15
import tests.stress.ExecutionTimeMeasuringTest
16
16
import tests.testOn
17
17
import kotlin.random.Random
18
+ import kotlin.random.nextInt
18
19
import kotlin.test.*
19
20
import kotlin.time.ExperimentalTime
20
21
@@ -319,7 +320,7 @@ class PersistentListBuilderTest : ExecutionTimeMeasuringTest() {
319
320
maxIterationCount : Int ,
320
321
afterIteration : () -> Unit ) {
321
322
val towardStart = Random .nextBoolean()
322
- val iterationCount = Random .nextInt(maxIterationCount)
323
+ val iterationCount = Random .nextInt(0 .. maxIterationCount)
323
324
324
325
if (towardStart) {
325
326
repeat(iterationCount) {
@@ -449,7 +450,7 @@ class PersistentListBuilderTest : ExecutionTimeMeasuringTest() {
449
450
repeat(times = 100 ) {
450
451
val createNew = Random .nextDouble() < 0.1
451
452
if (createNew) {
452
- val index = Random .nextInt(expected.size)
453
+ val index = Random .nextInt(0 .. expected.size)
453
454
builderIterator = builder.listIterator(index)
454
455
expectedIterator = expected.listIterator(index)
455
456
compare(expectedIterator, builderIterator) { listIteratorProperties() }
@@ -475,7 +476,7 @@ class PersistentListBuilderTest : ExecutionTimeMeasuringTest() {
475
476
}
476
477
}
477
478
} else {
478
- val maxIterationCount = expected.size / 3
479
+ val maxIterationCount = expected.size / 3 + 1
479
480
iterateWith(expectedIterator, builderIterator, maxIterationCount) { /* Do nothing after iteration */ }
480
481
}
481
482
}
0 commit comments