mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 04:20:00 +03:00
Fix an issue discovered by unit test
This commit is contained in:
parent
103ba463c3
commit
da9f0c6667
2 changed files with 4 additions and 3 deletions
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue