Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Suite fixture feature #166

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implement function to add fixtures to a suite
ozars committed Jul 17, 2018
commit 08294c6141bf92217d3f948fe2d1a0e56af57525
16 changes: 16 additions & 0 deletions src/check.c
Original file line number Diff line number Diff line change
@@ -280,6 +280,22 @@ static Fixture *fixture_create(SFun fun, int ischecked)
return f;
}

void suite_add_unchecked_fixture(Suite * s, SFun setup, SFun teardown)
{
if(setup)
{
check_list_add_end(s->unch_sflst,
fixture_create(setup, 0));
}

/* Add teardowns at front so they are run in reverse order. */
if(teardown)
{
check_list_add_front(s->unch_tflst,
fixture_create(teardown, 0));
}
}

void tcase_add_unchecked_fixture(TCase * tc, SFun setup, SFun teardown)
{
tcase_add_fixture(tc, setup, teardown, 0);
3 changes: 3 additions & 0 deletions src/check.h.in
Original file line number Diff line number Diff line change
@@ -308,6 +308,9 @@ CK_DLL_EXP void CK_EXPORT _tcase_add_test(TCase * tc, const TTest * ttest,
int _signal, int allowed_exit_value,
int start, int end);

CK_DLL_EXP void CK_EXPORT suite_add_unchecked_fixture(Suite * s, SFun setup,
SFun teardown);

/**
* Add unchecked fixture setup/teardown functions to a test case
*