commonMain.io.kotest.property.kotlinx.datetime.instants.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotest-property-datetime-jvm Show documentation
Show all versions of kotest-property-datetime-jvm Show documentation
Kotest property testing generators for kotlinx-datetime
The newest version!
package io.kotest.property.kotlinx.datetime
import io.kotest.property.Arb
import io.kotest.property.arbitrary.long
import io.kotest.property.arbitrary.map
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
/**
* Returns an [Arb] where each value is a randomly generated Instant in the given range.
*
* The default range is the unix epoch to 'now'.
*/
fun Arb.Companion.instant(range: LongRange = 0L..Clock.System.now().toEpochMilliseconds()) =
Arb.long(range).map { Instant.fromEpochMilliseconds(it) }
© 2015 - 2025 Weber Informatics LLC | Privacy Policy