diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-07-07 12:59:39 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-07-07 13:12:56 -0400 |
commit | 3206124fb3af2481fc45e705f7bba3ea56016433 (patch) | |
tree | 994f03b0d9d1db2e410a7bef155f0e5b4e03fe28 /tests/list.c | |
parent | 144353ab004bcd3e85f4cdd0a848add7811df2fe (diff) | |
download | bfs-3206124fb3af2481fc45e705f7bba3ea56016433.tar.xz |
tests: Simplify unit tests with a global variable
It's a little awkward to thread the test result through manually; much
easier to just make bfs_check() update a global variable.
Diffstat (limited to 'tests/list.c')
-rw-r--r-- | tests/list.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/tests/list.c b/tests/list.c index e14570f..822077e 100644 --- a/tests/list.c +++ b/tests/list.c @@ -41,7 +41,7 @@ static bool check_list_items(struct list *list, int *array, size_t size) { #define ARRAY(...) (int[]){ __VA_ARGS__ }, countof((int[]){ __VA_ARGS__ }) #define EMPTY() NULL, 0 -bool check_list(void) { +void check_list(void) { struct list l1; SLIST_INIT(&l1); bfs_verify(check_list_items(&l1, EMPTY())); @@ -92,6 +92,4 @@ bool check_list(void) { SLIST_APPEND(&l2, &i12); SLIST_SPLICE(&l1, &l1.head->next, &l2); bfs_verify(check_list_items(&l1, ARRAY(10, 11, 12, 15, 20))); - - return true; } |