diff options
author | David Robillard <d@drobilla.net> | 2024-09-28 11:14:08 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-09-28 11:15:15 -0400 |
commit | 50c73ad346fb63eb6d057dcc7d1351c95e12e83d (patch) | |
tree | 17e1be3b38642022e582dfde58ccced85c4ca15e /test/test_tree.c | |
parent | 19bd977e943bf37c2c24ee0116486fa9b7611f70 (diff) | |
download | zix-50c73ad346fb63eb6d057dcc7d1351c95e12e83d.tar.gz zix-50c73ad346fb63eb6d057dcc7d1351c95e12e83d.tar.bz2 zix-50c73ad346fb63eb6d057dcc7d1351c95e12e83d.zip |
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.
Diffstat (limited to 'test/test_tree.c')
-rw-r--r-- | test/test_tree.c | 4 |
1 files changed, 2 insertions, 2 deletions
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)); } } |