diff options
| author | 2025-04-30 20:30:39 -0400 | |
|---|---|---|
| committer | 2025-04-30 20:30:39 -0400 | |
| commit | 10048b0d31d0db923ae39c6bbd67139ed6252f6f (patch) | |
| tree | 65df1666aacd102f59b4ac0844ccc7f7ddda91db /src/Scripts.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/Scripts.zig')
| -rw-r--r-- | src/Scripts.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Scripts.zig b/src/Scripts.zig index f71a2b5..fd5fde9 100644 --- a/src/Scripts.zig +++ b/src/Scripts.zig | |||
| @@ -233,6 +233,15 @@ test "script" { | |||
| 233 | try testing.expectEqual(Script.Latin, self.script('A').?); | 233 | try testing.expectEqual(Script.Latin, self.script('A').?); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | fn testAllocator(allocator: Allocator) !void { | ||
| 237 | var prop = try Scripts.init(allocator); | ||
| 238 | prop.deinit(allocator); | ||
| 239 | } | ||
| 240 | |||
| 241 | test "Allocation failure" { | ||
| 242 | try testing.checkAllAllocationFailures(testing.allocator, testAllocator, .{}); | ||
| 243 | } | ||
| 244 | |||
| 236 | const std = @import("std"); | 245 | const std = @import("std"); |
| 237 | const builtin = @import("builtin"); | 246 | const builtin = @import("builtin"); |
| 238 | const compress = std.compress; | 247 | const compress = std.compress; |