diff options
| author | 2025-04-30 20:30:39 -0400 | |
|---|---|---|
| committer | 2025-04-30 20:30:39 -0400 | |
| commit | 10048b0d31d0db923ae39c6bbd67139ed6252f6f (patch) | |
| tree | 65df1666aacd102f59b4ac0844ccc7f7ddda91db /src/LetterCasing.zig | |
| parent | Setup variants for all allocating modules (diff) | |
| download | zg-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.zig | 9 |
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 | ||
| 206 | fn testAllocator(allocator: Allocator) !void { | ||
| 207 | var prop = try LetterCasing.init(allocator); | ||
| 208 | prop.deinit(allocator); | ||
| 209 | } | ||
| 210 | |||
| 211 | test "Allocation failure" { | ||
| 212 | try testing.checkAllAllocationFailures(testing.allocator, testAllocator, .{}); | ||
| 213 | } | ||
| 214 | |||
| 206 | const std = @import("std"); | 215 | const std = @import("std"); |
| 207 | const builtin = @import("builtin"); | 216 | const builtin = @import("builtin"); |
| 208 | const compress = std.compress; | 217 | const compress = std.compress; |