diff options
| author | 2026-02-05 07:07:40 -0500 | |
|---|---|---|
| committer | 2026-02-05 07:07:40 -0500 | |
| commit | 95f9487f6a7bde2d7266399bdf6843b97cc1b301 (patch) | |
| tree | 122cd20fa574861e807844974b49eb2f91285d3c /src/unicode_tests.zig | |
| parent | Teasing out canonicalization (diff) | |
| download | zg-95f9487f6a7bde2d7266399bdf6843b97cc1b301.tar.gz zg-95f9487f6a7bde2d7266399bdf6843b97cc1b301.tar.xz zg-95f9487f6a7bde2d7266399bdf6843b97cc1b301.zip | |
Base units do not allocate
CanonData included. I may still sort out caseless matching without
allocation, but that's a stretch goal.
Closes #86
Closes #85
Diffstat (limited to 'src/unicode_tests.zig')
| -rw-r--r-- | src/unicode_tests.zig | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/unicode_tests.zig b/src/unicode_tests.zig index 50b8824..81ea90d 100644 --- a/src/unicode_tests.zig +++ b/src/unicode_tests.zig | |||
| @@ -5,9 +5,6 @@ test "Unicode normalization tests" { | |||
| 5 | defer arena.deinit(); | 5 | defer arena.deinit(); |
| 6 | const allocator = arena.allocator(); | 6 | const allocator = arena.allocator(); |
| 7 | 7 | ||
| 8 | const n = try Normalize.init(allocator); | ||
| 9 | defer n.deinit(allocator); | ||
| 10 | |||
| 11 | var reader = std.io.Reader.fixed(@embedFile("NormalizationTest.txt")); | 8 | var reader = std.io.Reader.fixed(@embedFile("NormalizationTest.txt")); |
| 12 | var cp_buf: [4]u8 = undefined; | 9 | var cp_buf: [4]u8 = undefined; |
| 13 | 10 | ||
| @@ -47,7 +44,7 @@ test "Unicode normalization tests" { | |||
| 47 | } | 44 | } |
| 48 | 45 | ||
| 49 | const want = w_buf.items; | 46 | const want = w_buf.items; |
| 50 | var got = try n.nfc(allocator, input); | 47 | var got = try Normalize.nfc(allocator, input); |
| 51 | defer got.deinit(allocator); | 48 | defer got.deinit(allocator); |
| 52 | 49 | ||
| 53 | try testing.expectEqualStrings(want, got.slice); | 50 | try testing.expectEqualStrings(want, got.slice); |
| @@ -64,7 +61,7 @@ test "Unicode normalization tests" { | |||
| 64 | } | 61 | } |
| 65 | 62 | ||
| 66 | const want = w_buf.items; | 63 | const want = w_buf.items; |
| 67 | var got = try n.nfd(allocator, input); | 64 | var got = try Normalize.nfd(allocator, input); |
| 68 | defer got.deinit(allocator); | 65 | defer got.deinit(allocator); |
| 69 | 66 | ||
| 70 | try testing.expectEqualStrings(want, got.slice); | 67 | try testing.expectEqualStrings(want, got.slice); |
| @@ -81,7 +78,7 @@ test "Unicode normalization tests" { | |||
| 81 | } | 78 | } |
| 82 | 79 | ||
| 83 | const want = w_buf.items; | 80 | const want = w_buf.items; |
| 84 | var got = try n.nfkc(allocator, input); | 81 | var got = try Normalize.nfkc(allocator, input); |
| 85 | defer got.deinit(allocator); | 82 | defer got.deinit(allocator); |
| 86 | 83 | ||
| 87 | try testing.expectEqualStrings(want, got.slice); | 84 | try testing.expectEqualStrings(want, got.slice); |
| @@ -98,7 +95,7 @@ test "Unicode normalization tests" { | |||
| 98 | } | 95 | } |
| 99 | 96 | ||
| 100 | const want = w_buf.items; | 97 | const want = w_buf.items; |
| 101 | const got = try n.nfkd(allocator, input); | 98 | const got = try Normalize.nfkd(allocator, input); |
| 102 | defer got.deinit(allocator); | 99 | defer got.deinit(allocator); |
| 103 | 100 | ||
| 104 | try testing.expectEqualStrings(want, got.slice); | 101 | try testing.expectEqualStrings(want, got.slice); |