diff options
Diffstat (limited to 'test/failing_allocator.h')
-rw-r--r-- | test/failing_allocator.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/failing_allocator.h b/test/failing_allocator.h index 982874d..215f2b6 100644 --- a/test/failing_allocator.h +++ b/test/failing_allocator.h @@ -1,10 +1,10 @@ -// Copyright 2021 David Robillard <d@drobilla.net> +// Copyright 2021-2024 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#ifndef ZIX_FAILING_ALLOCATOR_H -#define ZIX_FAILING_ALLOCATOR_H +#ifndef ZIX_TEST_FAILING_ALLOCATOR_H +#define ZIX_TEST_FAILING_ALLOCATOR_H -#include "zix/allocator.h" +#include <zix/allocator.h> #include <stddef.h> @@ -15,7 +15,12 @@ typedef struct { size_t n_remaining; ///< Number of remaining successful allocations } ZixFailingAllocator; +/// Return an allocator configured by default to succeed ZixFailingAllocator zix_failing_allocator(void); -#endif // ZIX_FAILING_ALLOCATOR_H +/// Reset an allocator to fail after some number of "allowed" allocations +size_t +zix_failing_allocator_reset(ZixFailingAllocator* allocator, size_t n_allowed); + +#endif // ZIX_TEST_FAILING_ALLOCATOR_H |