1
0
Fork 0
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:
Sergey Boishtyan 2022-05-09 19:48:16 +03:00 committed by GitHub
parent 6206f68dea
commit 51996ff726
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
187 changed files with 163 additions and 774 deletions

View file

@ -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
}
}