Fix an issue discovered by unit test

This commit is contained in:
Benoit Marty 2021-03-16 12:03:01 +01:00 committed by Benoit Marty
parent 103ba463c3
commit da9f0c6667
2 changed files with 4 additions and 3 deletions

View File

@ -33,7 +33,8 @@ internal fun getBetsChunkSize(listSize: Int, limit: Int): BestChunkSize {
)
} else {
val numberOfChunks = ceil(listSize / limit.toDouble()).toInt()
val chunkSize = listSize / numberOfChunks
// Round on next Int
val chunkSize = ceil(listSize / numberOfChunks.toDouble()).toInt()
BestChunkSize(
numberOfChunks = numberOfChunks,

View File

@ -42,10 +42,10 @@ class MathUtilTest : MatrixTest {
fun testGetBestChunkSize100() = doTest(100, 100, 1, 100)
@Test
fun testGetBestChunkSize101() = doTest(101, 100, 2, 50)
fun testGetBestChunkSize101() = doTest(101, 100, 2, 51)
@Test
fun testGetBestChunkSize199() = doTest(199, 100, 2, 99)
fun testGetBestChunkSize199() = doTest(199, 100, 2, 100)
@Test
fun testGetBestChunkSize200() = doTest(200, 100, 2, 100)