refine docs for util_allocator.h - issue #548

Sat, 04 Jan 2025 13:40:34 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 04 Jan 2025 13:40:34 +0100
changeset 1086
4c6ea8a10acd
parent 1085
b8e0b4130cc3
child 1087
128324af5164

refine docs for util_allocator.h - issue #548

tests/util_allocator.h file | annotate | diff | comparison | revisions
--- a/tests/util_allocator.h	Sat Jan 04 13:34:37 2025 +0100
+++ b/tests/util_allocator.h	Sat Jan 04 13:40:34 2025 +0100
@@ -35,6 +35,25 @@
 extern "C" {
 #endif
 
+/**
+ * An allocator that verifies allocations / deallocations during testing.
+ *
+ * @par Typical Use
+ * @code
+ * CxTestingAllocator talloc;
+ * cx_testing_allocator_init(&talloc);
+ * CxAllocator *alloc = &talloc.base;
+ * CX_TEST_DO {
+ *     // do your tests and use alloc as allocator for all API calls
+ *     // ...
+ *     // optional: check that the allocator was used
+ *     CX_TEST_ASSERT(cx_testing_allocator_used(&talloc));
+ *     // verify
+ *     CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
+ * }
+ * cx_testing_allocator_destroy(&talloc);
+ * @endcode
+ */
 typedef struct CxTestingAllocator {
     CxAllocator base;
     /**
@@ -61,7 +80,7 @@
      */
     size_t tracked_count;
     /**
-     * The capaciyty of the \c tracked array.
+     * The capaciyty of the @c tracked array.
      */
     size_t tracked_capacity;
     /**
@@ -73,18 +92,20 @@
 
 /**
  * Initializes a new testing allocator.
+ * @see cx_testing_allocator_destroy()
  */
 void cx_testing_allocator_init(CxTestingAllocator *alloc);
 
 /**
  * Destroys a testing allocator.
+ * @see cx_testing_allocator_init()
  */
 void cx_testing_allocator_destroy(CxTestingAllocator *alloc);
 
 /**
  * Verifies that this allocator has been used.
  *
- * @return true if any allocation was attempted using this allocator
+ * @return true iff any allocation was attempted using this allocator
  */
 bool cx_testing_allocator_used(const CxTestingAllocator *alloc);
 

mercurial