diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-22 15:54:15 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-22 18:21:32 -0400 |
| commit | 859cbf7d72ffc080f6e0224980bbed7458f1d07e (patch) | |
| tree | 9da2510b8035cbff6326d1ec9263f300bc56e00a /tests | |
| parent | d559feb7011fd1c75ae66c9aed38536dcd41a2cf (diff) | |
Test if v1 and v6 UUID `node` is set correctly
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/core/encoding/uuid/test_core_uuid.odin | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/tests/core/encoding/uuid/test_core_uuid.odin b/tests/core/encoding/uuid/test_core_uuid.odin index 895de3863..3a0d621ca 100644 --- a/tests/core/encoding/uuid/test_core_uuid.odin +++ b/tests/core/encoding/uuid/test_core_uuid.odin @@ -121,12 +121,19 @@ test_v1 :: proc(t: ^testing.T) { point_c := time.time_add({}, 5 * time.Second) CLOCK :: 0x3A1A - v1_a := uuid.generate_v1(CLOCK, nil, point_a) - v1_b := uuid.generate_v1(CLOCK, nil, point_b) - v1_c := uuid.generate_v1(CLOCK, nil, point_c) + mac := [6]u8{0xFF, 0x10, 0xAA, 0x55, 0x01, 0xFF} + + v1_a := uuid.generate_v1(CLOCK, mac, point_a) + v1_b := uuid.generate_v1(CLOCK, mac, point_b) + v1_c := uuid.generate_v1(CLOCK, mac, point_c) testing.expect_value(t, uuid.clock_seq(v1_a), CLOCK) + extracted_mac := uuid.node(v1_a) + for i in 0 ..< len(mac) { + testing.expect(t, mac[i] == extracted_mac[i]) + } + time_a := uuid.time_v1(v1_a) time_b := uuid.time_v1(v1_b) time_c := uuid.time_v1(v1_c) @@ -149,12 +156,19 @@ test_v6 :: proc(t: ^testing.T) { point_c := time.time_add({}, 5 * time.Second) CLOCK :: 0x3A1A - v6_a := uuid.generate_v6(CLOCK, nil, point_a) - v6_b := uuid.generate_v6(CLOCK, nil, point_b) - v6_c := uuid.generate_v6(CLOCK, nil, point_c) + mac := [6]u8{0xFF, 0x10, 0xAA, 0x55, 0x01, 0xFF} + + v6_a := uuid.generate_v6(CLOCK, mac, point_a) + v6_b := uuid.generate_v6(CLOCK, mac, point_b) + v6_c := uuid.generate_v6(CLOCK, mac, point_c) testing.expect_value(t, uuid.clock_seq(v6_a), CLOCK) + extracted_mac := uuid.node(v6_a) + for i in 0 ..< len(mac) { + testing.expect(t, mac[i] == extracted_mac[i]) + } + time_a := uuid.time_v6(v6_a) time_b := uuid.time_v6(v6_b) time_c := uuid.time_v6(v6_c) |