diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-22 14:40:09 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-22 18:21:32 -0400 |
| commit | 95a9c9b016ab36110f7313105915ab45fea75ca3 (patch) | |
| tree | e99e38aafe335b201ee504bb1a0a096a6b53db63 /tests/core/encoding | |
| parent | 9b3a104640f518f21a83ae2c9784cd8601589880 (diff) | |
Fix indentation
Diffstat (limited to 'tests/core/encoding')
| -rw-r--r-- | tests/core/encoding/uuid/test_core_uuid.odin | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/tests/core/encoding/uuid/test_core_uuid.odin b/tests/core/encoding/uuid/test_core_uuid.odin index 460e4259b..f50aca963 100644 --- a/tests/core/encoding/uuid/test_core_uuid.odin +++ b/tests/core/encoding/uuid/test_core_uuid.odin @@ -11,56 +11,56 @@ import "core:time" test_version_and_variant :: proc(t: ^testing.T) { context.random_generator = crypto.random_generator() - v1 := uuid.generate_v1(0) - v3 := uuid_legacy.generate_v3(uuid.Namespace_DNS, "") - v4 := uuid.generate_v4() - v5 := uuid_legacy.generate_v5(uuid.Namespace_DNS, "") - v6 := uuid.generate_v6() - v7 := uuid.generate_v7() - - testing.expect_value(t, uuid.version(v1), 1) - testing.expect_value(t, uuid.variant(v1), uuid.Variant_Type.RFC_4122) - testing.expect_value(t, uuid.version(v3), 3) - testing.expect_value(t, uuid.variant(v3), uuid.Variant_Type.RFC_4122) - testing.expect_value(t, uuid.version(v4), 4) - testing.expect_value(t, uuid.variant(v4), uuid.Variant_Type.RFC_4122) - testing.expect_value(t, uuid.version(v5), 5) - testing.expect_value(t, uuid.variant(v5), uuid.Variant_Type.RFC_4122) - testing.expect_value(t, uuid.version(v6), 6) - testing.expect_value(t, uuid.variant(v6), uuid.Variant_Type.RFC_4122) - testing.expect_value(t, uuid.version(v7), 7) - testing.expect_value(t, uuid.variant(v7), uuid.Variant_Type.RFC_4122) + v1 := uuid.generate_v1(0) + v3 := uuid_legacy.generate_v3(uuid.Namespace_DNS, "") + v4 := uuid.generate_v4() + v5 := uuid_legacy.generate_v5(uuid.Namespace_DNS, "") + v6 := uuid.generate_v6() + v7 := uuid.generate_v7() + + testing.expect_value(t, uuid.version(v1), 1) + testing.expect_value(t, uuid.variant(v1), uuid.Variant_Type.RFC_4122) + testing.expect_value(t, uuid.version(v3), 3) + testing.expect_value(t, uuid.variant(v3), uuid.Variant_Type.RFC_4122) + testing.expect_value(t, uuid.version(v4), 4) + testing.expect_value(t, uuid.variant(v4), uuid.Variant_Type.RFC_4122) + testing.expect_value(t, uuid.version(v5), 5) + testing.expect_value(t, uuid.variant(v5), uuid.Variant_Type.RFC_4122) + testing.expect_value(t, uuid.version(v6), 6) + testing.expect_value(t, uuid.variant(v6), uuid.Variant_Type.RFC_4122) + testing.expect_value(t, uuid.version(v7), 7) + testing.expect_value(t, uuid.variant(v7), uuid.Variant_Type.RFC_4122) } @(test) test_legacy_namespaced_uuids :: proc(t: ^testing.T) { - TEST_NAME :: "0123456789ABCDEF0123456789ABCDEF" + TEST_NAME :: "0123456789ABCDEF0123456789ABCDEF" - Expected_Result :: struct { - namespace: uuid.Identifier, - v3, v5: string, - } + Expected_Result :: struct { + namespace: uuid.Identifier, + v3, v5: string, + } - Expected_Results := [?]Expected_Result { - { uuid.Namespace_DNS, "80147f37-36db-3b82-b78f-810c3c6504ba", "18394c41-13a2-593f-abf2-a63e163c2860" }, - { uuid.Namespace_URL, "8136789b-8e16-3fbd-800b-1587e2f22521", "07337422-eb77-5fd3-99af-c7f59e641e13" }, - { uuid.Namespace_OID, "adbb95bc-ea50-3226-9a75-20c34a6030f8", "24db9b0f-70b8-53c4-a301-f695ce17276d" }, - { uuid.Namespace_X500, "a8965ad1-0e54-3d65-b933-8b7cca8e8313", "3012bf2d-fac4-5187-9825-493e6636b936" }, - } + Expected_Results := [?]Expected_Result { + { uuid.Namespace_DNS, "80147f37-36db-3b82-b78f-810c3c6504ba", "18394c41-13a2-593f-abf2-a63e163c2860" }, + { uuid.Namespace_URL, "8136789b-8e16-3fbd-800b-1587e2f22521", "07337422-eb77-5fd3-99af-c7f59e641e13" }, + { uuid.Namespace_OID, "adbb95bc-ea50-3226-9a75-20c34a6030f8", "24db9b0f-70b8-53c4-a301-f695ce17276d" }, + { uuid.Namespace_X500, "a8965ad1-0e54-3d65-b933-8b7cca8e8313", "3012bf2d-fac4-5187-9825-493e6636b936" }, + } - for exp in Expected_Results { - v3 := uuid_legacy.generate_v3(exp.namespace, TEST_NAME) - v5 := uuid_legacy.generate_v5(exp.namespace, TEST_NAME) + for exp in Expected_Results { + v3 := uuid_legacy.generate_v3(exp.namespace, TEST_NAME) + v5 := uuid_legacy.generate_v5(exp.namespace, TEST_NAME) - v3_str := uuid.to_string(v3) - defer delete(v3_str) + v3_str := uuid.to_string(v3) + defer delete(v3_str) - v5_str := uuid.to_string(v5) - defer delete(v5_str) + v5_str := uuid.to_string(v5) + defer delete(v5_str) - testing.expect_value(t, v3_str, exp.v3) - testing.expect_value(t, v5_str, exp.v5) - } + testing.expect_value(t, v3_str, exp.v3) + testing.expect_value(t, v5_str, exp.v5) + } } @(test) @@ -151,74 +151,74 @@ test_v7 :: proc(t: ^testing.T) { @(test) test_writing :: proc(t: ^testing.T) { - id: uuid.Identifier + id: uuid.Identifier - for &b, i in id { - b = u8(i) - } + for &b, i in id { + b = u8(i) + } buf: [uuid.EXPECTED_LENGTH]u8 - s_alloc := uuid.to_string(id) - defer delete(s_alloc) + s_alloc := uuid.to_string(id) + defer delete(s_alloc) s_buf := uuid.to_string(id, buf[:]) - testing.expect_value(t, s_alloc, "00010203-0405-0607-0809-0a0b0c0d0e0f") - testing.expect_value(t, s_buf, "00010203-0405-0607-0809-0a0b0c0d0e0f") + testing.expect_value(t, s_alloc, "00010203-0405-0607-0809-0a0b0c0d0e0f") + testing.expect_value(t, s_buf, "00010203-0405-0607-0809-0a0b0c0d0e0f") } @(test) test_reading :: proc(t: ^testing.T) { - id, err := uuid.read("00010203-0405-0607-0809-0a0b0c0d0e0f") - testing.expect_value(t, err, nil) + id, err := uuid.read("00010203-0405-0607-0809-0a0b0c0d0e0f") + testing.expect_value(t, err, nil) - for b, i in id { - testing.expect_value(t, b, u8(i)) - } + for b, i in id { + testing.expect_value(t, b, u8(i)) + } } @(test) test_reading_errors :: proc(t: ^testing.T) { - { - BAD_STRING :: "|.......@....@....@....@............" - _, err := uuid.read(BAD_STRING) - testing.expect_value(t, err, uuid.Read_Error.Invalid_Separator) - } - - { - BAD_STRING :: "|.......-....-....-....-............" - _, err := uuid.read(BAD_STRING) - testing.expect_value(t, err, uuid.Read_Error.Invalid_Hexadecimal) - } - - { - BAD_STRING :: ".......-....-....-....-............" - _, err := uuid.read(BAD_STRING) - testing.expect_value(t, err, uuid.Read_Error.Invalid_Length) - } - - { - BAD_STRING :: "|.......-....-....-....-............|" - _, err := uuid.read(BAD_STRING) - testing.expect_value(t, err, uuid.Read_Error.Invalid_Length) - } - - { - BAD_STRING :: "00000000-0000-0000-0000-0000000000001" - _, err := uuid.read(BAD_STRING) - testing.expect_value(t, err, uuid.Read_Error.Invalid_Length) - } - - { - BAD_STRING :: "00000000000000000000000000000000" - _, err := uuid.read(BAD_STRING) - testing.expect_value(t, err, uuid.Read_Error.Invalid_Length) - } - - { - OK_STRING :: "00000000-0000-0000-0000-000000000000" - _, err := uuid.read(OK_STRING) - testing.expect_value(t, err, nil) - } + { + BAD_STRING :: "|.......@....@....@....@............" + _, err := uuid.read(BAD_STRING) + testing.expect_value(t, err, uuid.Read_Error.Invalid_Separator) + } + + { + BAD_STRING :: "|.......-....-....-....-............" + _, err := uuid.read(BAD_STRING) + testing.expect_value(t, err, uuid.Read_Error.Invalid_Hexadecimal) + } + + { + BAD_STRING :: ".......-....-....-....-............" + _, err := uuid.read(BAD_STRING) + testing.expect_value(t, err, uuid.Read_Error.Invalid_Length) + } + + { + BAD_STRING :: "|.......-....-....-....-............|" + _, err := uuid.read(BAD_STRING) + testing.expect_value(t, err, uuid.Read_Error.Invalid_Length) + } + + { + BAD_STRING :: "00000000-0000-0000-0000-0000000000001" + _, err := uuid.read(BAD_STRING) + testing.expect_value(t, err, uuid.Read_Error.Invalid_Length) + } + + { + BAD_STRING :: "00000000000000000000000000000000" + _, err := uuid.read(BAD_STRING) + testing.expect_value(t, err, uuid.Read_Error.Invalid_Length) + } + + { + OK_STRING :: "00000000-0000-0000-0000-000000000000" + _, err := uuid.read(OK_STRING) + testing.expect_value(t, err, nil) + } } |