mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
Tech | Fix | Delete MockDataFactory.kt copy-paste (#2244)
This commit is contained in:
parent
6206f68dea
commit
51996ff726
187 changed files with 163 additions and 774 deletions
|
@ -1,64 +0,0 @@
|
|||
package com.anytypeio.anytype.sample.helpers
|
||||
|
||||
import java.util.*
|
||||
import java.util.concurrent.ThreadLocalRandom
|
||||
|
||||
object MockDataFactory {
|
||||
|
||||
fun randomUuid(): String {
|
||||
return UUID.randomUUID().toString()
|
||||
}
|
||||
|
||||
fun randomString(): String {
|
||||
return randomUuid()
|
||||
}
|
||||
|
||||
|
||||
fun randomInt(): Int {
|
||||
return ThreadLocalRandom.current().nextInt(0, 1000 + 1)
|
||||
}
|
||||
|
||||
fun randomInt(max: Int): Int {
|
||||
return ThreadLocalRandom.current().nextInt(0, max)
|
||||
}
|
||||
|
||||
fun randomLong(): Long {
|
||||
return randomInt().toLong()
|
||||
}
|
||||
|
||||
fun randomFloat(): Float {
|
||||
return randomInt().toFloat()
|
||||
}
|
||||
|
||||
fun randomDouble(): Double {
|
||||
return randomInt().toDouble()
|
||||
}
|
||||
|
||||
fun randomBoolean(): Boolean {
|
||||
return Math.random() < 0.5
|
||||
}
|
||||
|
||||
fun makeIntList(count: Int): List<Int> {
|
||||
val items = mutableListOf<Int>()
|
||||
repeat(count) {
|
||||
items.add(randomInt())
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
fun makeStringList(count: Int): List<String> {
|
||||
val items = mutableListOf<String>()
|
||||
repeat(count) {
|
||||
items.add(randomUuid())
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
fun makeDoubleList(count: Int): List<Double> {
|
||||
val items = mutableListOf<Double>()
|
||||
repeat(count) {
|
||||
items.add(randomDouble())
|
||||
}
|
||||
return items
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue