diff --git a/kotlinx-uuid-core/api/android/kotlinx-uuid-core.api b/kotlinx-uuid-core/api/android/kotlinx-uuid-core.api index 4ab80fd..9bbdbc2 100644 --- a/kotlinx-uuid-core/api/android/kotlinx-uuid-core.api +++ b/kotlinx-uuid-core/api/android/kotlinx-uuid-core.api @@ -21,6 +21,7 @@ public final class app/softwork/uuid/UuidKt { public static final fun from (Lkotlin/uuid/Uuid$Companion;IJIJI)Lkotlin/uuid/Uuid; public static synthetic fun from$default (Lkotlin/uuid/Uuid$Companion;IJIJIILjava/lang/Object;)Lkotlin/uuid/Uuid; public static final fun getClockSequence (Lkotlin/uuid/Uuid;)I + public static final fun getMAX (Lkotlin/uuid/Uuid$Companion;)Lkotlin/uuid/Uuid; public static final fun getNode (Lkotlin/uuid/Uuid;)J public static final fun getTimeStamp (Lkotlin/uuid/Uuid;)J public static final fun getVariant (Lkotlin/uuid/Uuid;)I diff --git a/kotlinx-uuid-core/api/jvm/kotlinx-uuid-core.api b/kotlinx-uuid-core/api/jvm/kotlinx-uuid-core.api index 634187e..33f0f57 100644 --- a/kotlinx-uuid-core/api/jvm/kotlinx-uuid-core.api +++ b/kotlinx-uuid-core/api/jvm/kotlinx-uuid-core.api @@ -26,6 +26,7 @@ public final class app/softwork/uuid/UuidKt { public static final fun from (Lkotlin/uuid/Uuid$Companion;IJIJI)Lkotlin/uuid/Uuid; public static synthetic fun from$default (Lkotlin/uuid/Uuid$Companion;IJIJIILjava/lang/Object;)Lkotlin/uuid/Uuid; public static final fun getClockSequence (Lkotlin/uuid/Uuid;)I + public static final fun getMAX (Lkotlin/uuid/Uuid$Companion;)Lkotlin/uuid/Uuid; public static final fun getNode (Lkotlin/uuid/Uuid;)J public static final fun getTimeStamp (Lkotlin/uuid/Uuid;)J public static final fun getVariant (Lkotlin/uuid/Uuid;)I diff --git a/kotlinx-uuid-core/src/commonMain/kotlin/app/softwork/uuid/Uuid.kt b/kotlinx-uuid-core/src/commonMain/kotlin/app/softwork/uuid/Uuid.kt index f2a74ec..1b753ba 100644 --- a/kotlinx-uuid-core/src/commonMain/kotlin/app/softwork/uuid/Uuid.kt +++ b/kotlinx-uuid-core/src/commonMain/kotlin/app/softwork/uuid/Uuid.kt @@ -105,3 +105,5 @@ public fun String.toUuidOrNull(): Uuid? = try { } catch (_: IllegalArgumentException) { null } + +public val Uuid.Companion.MAX: Uuid get() = fromLongs(-1, -1) diff --git a/kotlinx-uuid-core/src/commonTest/kotlin/app/softwork/uuid/UuidTest.kt b/kotlinx-uuid-core/src/commonTest/kotlin/app/softwork/uuid/UuidTest.kt index 2bd49cd..7ee6ad3 100644 --- a/kotlinx-uuid-core/src/commonTest/kotlin/app/softwork/uuid/UuidTest.kt +++ b/kotlinx-uuid-core/src/commonTest/kotlin/app/softwork/uuid/UuidTest.kt @@ -15,6 +15,7 @@ internal const val SOME_UUID_STRING: String = "1b3e4567-e99b-13d3-a476-446657420 class UuidTest { @Test fun testZero() { + assertEquals("00000000-0000-0000-0000-000000000000", Uuid.NIL.toString()) assertEquals(0, Uuid.NIL.variant) assertEquals(0, Uuid.NIL.versionNumber) assertEquals(0, Uuid.NIL.timeStamp) @@ -23,6 +24,17 @@ class UuidTest { assertEquals(false, Uuid.NIL.isRfcVariant) } + @Test + fun testMax() { + assertEquals("ffffffff-ffff-ffff-ffff-ffffffffffff", Uuid.MAX.toString()) + assertEquals(7, Uuid.MAX.variant) + assertEquals(15, Uuid.MAX.versionNumber) + assertEquals(1152921504606846975, Uuid.MAX.timeStamp) + assertEquals(8191, Uuid.MAX.clockSequence) + assertEquals(281474976710655, Uuid.MAX.node) + assertEquals(false, Uuid.MAX.isRfcVariant) + } + @Test fun testConstructingFromString() { val uuid = Uuid.parse(UUID_STRING)