diff options
| author | 2025-04-30 20:30:39 -0400 | |
|---|---|---|
| committer | 2025-04-30 20:30:39 -0400 | |
| commit | 10048b0d31d0db923ae39c6bbd67139ed6252f6f (patch) | |
| tree | 65df1666aacd102f59b4ac0844ccc7f7ddda91db /src/Properties.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/Properties.zig')
| -rw-r--r-- | src/Properties.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Properties.zig b/src/Properties.zig index f7e57ec..73602a0 100644 --- a/src/Properties.zig +++ b/src/Properties.zig | |||
| @@ -169,6 +169,15 @@ test "Props" { | |||
| 169 | try testing.expect(!self.isDecimal('g')); | 169 | try testing.expect(!self.isDecimal('g')); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | fn testAllocator(allocator: Allocator) !void { | ||
| 173 | var prop = try Properties.init(allocator); | ||
| 174 | prop.deinit(allocator); | ||
| 175 | } | ||
| 176 | |||
| 177 | test "Allocation failure" { | ||
| 178 | try testing.checkAllAllocationFailures(testing.allocator, testAllocator, .{}); | ||
| 179 | } | ||
| 180 | |||
| 172 | const std = @import("std"); | 181 | const std = @import("std"); |
| 173 | const builtin = @import("builtin"); | 182 | const builtin = @import("builtin"); |
| 174 | const compress = std.compress; | 183 | const compress = std.compress; |