feat: Adding suit wise setup and tear down.

This commit is contained in:
2025-06-25 14:56:38 +02:00
parent 5efea9a9b6
commit 717af6378b
3 changed files with 40 additions and 4 deletions

11
set.c
View File

@@ -129,6 +129,12 @@ static void dispatch_single_test(struct SETest *test)
static void dispatch_tests(struct SETSuit *suit)
{
printf("\n\n==== Running suit: %s (%d) ====\n\n", suit->name, suit->len);
if (suit->setup != NULL && !suit->setup())
{
fprintf(stderr, "Suit not executed: Setup failed.\n");
}
struct SETest *test = suit->tests;
for (int i = 0; i < suit->len; i++)
{
@@ -154,6 +160,11 @@ static void dispatch_tests(struct SETSuit *suit)
perror("shctl");
exit(1);
}
if (suit->tear_down != NULL && !suit->tear_down())
{
fprintf(stderr, "Teardown failed.\n");
}
}
static void dispatch_test_suits(struct SETSuit **suits, int counter)