summaryrefslogtreecommitdiff
path: root/src/Properties.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/Properties.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/Properties.zig')
-rw-r--r--src/Properties.zig9
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
172fn testAllocator(allocator: Allocator) !void {
173 var prop = try Properties.init(allocator);
174 prop.deinit(allocator);
175}
176
177test "Allocation failure" {
178 try testing.checkAllAllocationFailures(testing.allocator, testAllocator, .{});
179}
180
172const std = @import("std"); 181const std = @import("std");
173const builtin = @import("builtin"); 182const builtin = @import("builtin");
174const compress = std.compress; 183const compress = std.compress;