From cbec16baa26d6032c5bab686ac6e3cc052c41f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20H=C3=B6hne?= Date: Tue, 24 Jun 2025 20:48:24 +0200 Subject: [PATCH] feat: Global setup and teardown functions. --- set.c | 13 +++++++++++++ set.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/set.c b/set.c index e6edef1..02aa7f2 100644 --- a/set.c +++ b/set.c @@ -172,6 +172,12 @@ int main(int argc, char **argv) printf("\n\n%s", BANNER); #endif /* ifndef NO_BANNER */ + if (!set_up()) + { + fprintf(stderr, "%s\n", "Setup call returned with error. Aborting execution."); + return 1; + } + int counter = 0; set_bundle_suits(NULL, &counter, true); @@ -183,4 +189,11 @@ int main(int argc, char **argv) set_bundle_suits(suits, &counter, false); dispatch_test_suits(suits, counter); + + if (!tear_down()) + { + fprintf(stderr, "%s\n", "Teardown returned with error."); + return 1; + } + return 0; } diff --git a/set.h b/set.h index fc21800..917c47a 100644 --- a/set.h +++ b/set.h @@ -34,6 +34,13 @@ void set_bundle_suits(struct SETSuit **suits, int *counter, bool count); int create_shared_suit_space(size_t size); +bool set_up(); + +bool tear_down(); + +#define SETUP() void set_up() +#define TEAR_DOWN() bool tear_down() + #define BUNDLE() \ void set_bundle_suits(struct SETSuit **suits, int *counter, bool count)