File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,8 @@ function _build_uuid1(rng::AbstractRNG, timestamp::UInt64)
7474 # mask off clock sequence and node
7575 u &= 0x00000000000000003fffffffffffffff
7676
77- # set the unicast/multicast bit and version
78- u |= 0x00000000000010000000010000000000
77+ # set the version, variant, and unicast/multicast bit
78+ u |= 0x00000000000010008000010000000000
7979
8080 ts_low = timestamp & typemax (UInt32)
8181 ts_mid = (timestamp >> 32 ) & typemax (UInt16)
Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ u7 = uuid7()
4242 @test uuid_version (u7) == 7
4343end
4444
45+ @testset " Extraction of variant bits" begin
46+ # RFC 4122, section 4.1.1
47+ uuid_variant (u:: UUID ) = Int ((u. value >> 62 ) & 0x3 )
48+ @test uuid_variant (u1) == 2
49+ @test uuid_variant (u4) == 2
50+ @test uuid_variant (u5) == 2
51+ @test uuid_variant (u7) == 2
52+ end
53+
4554@testset " Parsing from string" begin
4655 @test u1 == UUID (string (u1)) == UUID (GenericString (string (u1)))
4756 @test u4 == UUID (string (u4)) == UUID (GenericString (string (u4)))
You can’t perform that action at this time.
0 commit comments