From 50c73ad346fb63eb6d057dcc7d1351c95e12e83d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Sep 2024 11:14:08 -0400 Subject: Improve test allocator API Add a simple API for setting up the failing allocator to avoid manually tinkering with its members. Conveniently, this also avoids confusing cppcheck. --- test/test_tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/test_tree.c') diff --git a/test/test_tree.c b/test/test_tree.c index fae6d85..ff63999 100644 --- a/test/test_tree.c +++ b/test/test_tree.c @@ -211,9 +211,9 @@ test_failed_alloc(void) assert(!stress(&allocator.base, 0, 16)); // Test that each allocation failing is handled gracefully - const size_t n_new_allocs = allocator.n_allocations; + const size_t n_new_allocs = zix_failing_allocator_reset(&allocator, 0); for (size_t i = 0U; i < n_new_allocs; ++i) { - allocator.n_remaining = i; + zix_failing_allocator_reset(&allocator, i); assert(stress(&allocator.base, 0, 16)); } } -- cgit v1.2.1