summaryrefslogtreecommitdiff
path: root/src/LetterCasing.zig
diff options
context:
space:
mode:
authorGravatar Sam Atman2025-04-30 20:30:39 -0400
committerGravatar Sam Atman2025-04-30 20:30:39 -0400
commit10048b0d31d0db923ae39c6bbd67139ed6252f6f (patch)
tree65df1666aacd102f59b4ac0844ccc7f7ddda91db /src/LetterCasing.zig
parentSetup variants for all allocating modules (diff)
downloadzg-10048b0d31d0db923ae39c6bbd67139ed6252f6f.tar.gz
zg-10048b0d31d0db923ae39c6bbd67139ed6252f6f.tar.xz
zg-10048b0d31d0db923ae39c6bbd67139ed6252f6f.zip
Allocation Failure Tests
These turned up an excessive amount of allocations in CanonData and CompatData, which have been reduced to two through the somewhat squirrely use of 'magic numbers'. There are now allocation tests for every allocated structure in the library, and they run to completion in a reasonable amount of time. So, that's nice.
Diffstat (limited to 'src/LetterCasing.zig')
-rw-r--r--src/LetterCasing.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/LetterCasing.zig b/src/LetterCasing.zig
index a7260b8..11a3e96 100644
--- a/src/LetterCasing.zig
+++ b/src/LetterCasing.zig
@@ -203,6 +203,15 @@ test "toLowerStr" {
203 try testing.expectEqualStrings("hello, world 2112!", lowered); 203 try testing.expectEqualStrings("hello, world 2112!", lowered);
204} 204}
205 205
206fn testAllocator(allocator: Allocator) !void {
207 var prop = try LetterCasing.init(allocator);
208 prop.deinit(allocator);
209}
210
211test "Allocation failure" {
212 try testing.checkAllAllocationFailures(testing.allocator, testAllocator, .{});
213}
214
206const std = @import("std"); 215const std = @import("std");
207const builtin = @import("builtin"); 216const builtin = @import("builtin");
208const compress = std.compress; 217const compress = std.compress;