Add debug functions

This commit is contained in:
2025-09-09 05:45:57 -07:00
parent aec2f6145e
commit 403618888c
3 changed files with 69 additions and 1 deletions

View File

@ -65,6 +65,10 @@ int main(int argc, const char **argv) {
STATIC_A(1);
STATIC_A(2);
STATIC_A(3);
assert(refcount_debug_context_count_object(c, &static_a_1, static_a_1.next)
== 1);
assert(refcount_debug_context_count_object(c, &static_a_1, static_a_2.next)
== 0);
A *a = make_a(c, 10, "Hello world\n");
assert(!refcount_context_is_static(c, a));
@ -124,6 +128,7 @@ int main(int argc, const char **argv) {
first->next = a;
a = first;
assert(refcount_context_num_refs(c, a) == 1);
assert(refcount_debug_context_count_object(c, a, a) == 1);
refcount_context_ref(c, a);
refcount_context_unref(c, a);