Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Uuid.MAX #381

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kotlinx-uuid-core/api/android/kotlinx-uuid-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions kotlinx-uuid-core/api/jvm/kotlinx-uuid-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ public fun String.toUuidOrNull(): Uuid? = try {
} catch (_: IllegalArgumentException) {
null
}

public val Uuid.Companion.MAX: Uuid get() = fromLongs(-1, -1)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Loading