feat: Global setup and teardown functions.

This commit is contained in:
2025-06-24 20:48:24 +02:00
parent cf1a311c14
commit cbec16baa2
2 changed files with 20 additions and 0 deletions

13
set.c
View File

@@ -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;
}

7
set.h
View File

@@ -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)