Add static, runtime and debug assert utilities

This commit is contained in:
2025-08-09 21:36:54 +01:00
parent 75be2316e0
commit b8c548ee4b
29 changed files with 100 additions and 56 deletions

View File

@@ -1,4 +1,4 @@
assert(list != NULL);
wapp_debug_assert(list != NULL, "`list` should not be NULL");
u64 count = list->node_count;
for (u64 i = 0; i < count; ++i) {{

View File

@@ -1,4 +1,4 @@
assert(index < list->node_count);
wapp_runtime_assert(index < list->node_count, "`index` is out of bounds");
{NodeType} *output = NULL;
{NodeType} *current = list->first;

View File

@@ -1,4 +1,4 @@
assert(list != NULL && node != NULL && (node->item) != NULL);
wapp_debug_assert(list != NULL && node != NULL && (node->item) != NULL, "`list`, `node` and `node->item` should not be NULL");
if (index == 0) {{
wapp_{Tlower}_list_push_front(list, node);

View File

@@ -1,4 +1,4 @@
assert(list != NULL);
wapp_debug_assert(list != NULL, "`list` should not be NULL");
{NodeType} *output = NULL;

View File

@@ -1,4 +1,4 @@
assert(list != NULL);
wapp_debug_assert(list != NULL, "`list` should not be NULL");
{NodeType} *output = NULL;

View File

@@ -1,4 +1,4 @@
assert(list != NULL && node != NULL && (node->item) != NULL);
wapp_debug_assert(list != NULL && node != NULL && (node->item) != NULL, "`list`, `node` and `node->item` should not be NULL");
{ListType} node_list = {Tlower}_node_to_list(node);

View File

@@ -1,4 +1,4 @@
assert(list != NULL && node != NULL && (node->item) != NULL);
wapp_debug_assert(list != NULL && node != NULL && (node->item) != NULL, "`list`, `node` and `node->item` should not be NULL");
{ListType} node_list = {Tlower}_node_to_list(node);

View File

@@ -1,4 +1,4 @@
assert(list != NULL);
wapp_debug_assert(list != NULL, "`list` should not be NULL");
{NodeType} *output = NULL;