CUnit Programmers Reference  3.0
Data Structures | Macros | Typedefs | Functions
CI

Data Structures

struct  CU_CI_named_test
 Define a test with a name. More...
 

Macros

#define CU_CI_FIXTURE_QUIET()    (void)(__cu_suite_setup || __cu_suite_teardown || __cu_test_setup || __cu_test_teardown );
 ifndef NO_CU_CI_AUTO_PREMAIN More...
 
#define CU_CI_RUN_SUITES()   CU_CI_main(argc, argv);
 Run all registered tests and save a junit xml report in the current working directory Exit non-zero if any tests/setup/teardown or asserts have failed.
 
#define CU_CI_RUN()
 Run all registered suites in sorted order, save a junit xml report in the current dir and return the cunit exit status (0 for no-errors);.
 
#define CU_CI_DEFINE_SUITE(name, init, clean, setup, teardown)
 Set the current suite including any setup/teardown functions. More...
 
#define CUNIT_CI_TEST(test)    CU_CI_add_test(#test, test)
 Add a new test to the current suite. More...
 
#define CU_CI_SUITE_H(suitename)   void suitename(void);
 Define a suite export function in a header, for use with CU_CI_SUITE()
 
#define CU_CI_SUITE_REGISTER(_suitename, ...)
 Register the suite definition for the current file.
 
#define CU_CI_SUITE(_suitename, ...)
 Set an auto exported suite definition function for the current file. More...
 
#define CU_CI_USE_SUITE(suite)   CU_CI_FIXTURE_QUIET(); void cu_suite_ ## suite(void); cu_suite_ ## suite()
 Register a cunit suite defined with CU_CI_SUITE.
 
#define CU_SUITE_SETUP()
 Define a suite setup routine.
 
#define CU_SUITE_TEARDOWN()
 Define a suite cleanup routine.
 
#define CU_TEST_SETUP()
 Define a pre test setup routine.
 
#define CU_TEST_TEARDOWN()
 Define a post test cleanup routine.
 
#define CUNIT_CI_RUN(_suitename, ...)
 Run the given tests as part of a single exe suite.
 
#define CUNIT_CI_CLEAR_SETUPS()
 Silence compiler warnings about unused test fixture variables.
 

Typedefs

typedef struct CU_CI_named_test CU_CI_named_test
 Define a test with a name.
 

Functions

CU_EXPORT void CU_CI_args (int *argc, char ***argv)
 Obtain the command line arguments and count that was passed to CU_CI_main() More...
 
CU_EXPORT int CU_CI_main (int argc, char **argv)
 Main Entry point to CI mode of CUnit. More...
 
CU_EXPORT void CU_CI_add_suite (const char *name, CU_InitializeFunc init, CU_CleanupFunc clean, CU_SetUpFunc setup, CU_TearDownFunc teardown)
 Add a suite to CUnit CI. More...
 
CU_EXPORT void CU_CI_add_test (const char *name, CU_TestFunc test)
 Add a test to the current CUnit CI suite. More...
 

Detailed Description

Macro Definition Documentation

◆ CU_CI_DEFINE_SUITE

#define CU_CI_DEFINE_SUITE (   name,
  init,
  clean,
  setup,
  teardown 
)
Value:
CU_CI_add_suite(#name, init, clean, setup, teardown)
#define CU_CI_FIXTURE_QUIET()
ifndef NO_CU_CI_AUTO_PREMAIN
Definition: CUnitCI.h:84

Set the current suite including any setup/teardown functions.

Parameters
namethe suite name
initsuite setup function
cleansuite teardown function
setuptest setup function
teardowntest teardown function

◆ CU_CI_FIXTURE_QUIET

#define CU_CI_FIXTURE_QUIET ( )     (void)(__cu_suite_setup || __cu_suite_teardown || __cu_test_setup || __cu_test_teardown );

ifndef NO_CU_CI_AUTO_PREMAIN

Silence warnings about unused fixture functions

◆ CU_CI_SUITE

#define CU_CI_SUITE (   _suitename,
  ... 
)
Value:
void cu_suite_ ## _suitename (void); \
void cu_suite_ ## _suitename (void) { \
CU_CI_SUITE_REGISTER(_suitename, __VA_ARGS__) }

Set an auto exported suite definition function for the current file.

For use with suites defined in multiple source files via CU_CI_ADD_SUITE(name) and compilers that support attribute((constructor)) and modern MSVC

◆ CUNIT_CI_TEST

#define CUNIT_CI_TEST (   test)     CU_CI_add_test(#test, test)

Add a new test to the current suite.

Parameters
testthe test function to call.

Function Documentation

◆ CU_CI_add_suite()

CU_EXPORT void CU_CI_add_suite ( const char *  name,
CU_InitializeFunc  init,
CU_CleanupFunc  clean,
CU_SetUpFunc  setup,
CU_TearDownFunc  teardown 
)

Add a suite to CUnit CI.

Parameters
namesuite name
initoptional suite setup function
cleanoptional suite cleanup function
setupoptional per test setup function
teardownoptional per test cleanup function

References CU_add_suite_with_setup_and_teardown(), CU_initialize_registry(), CU_registry_initialized(), and CUE_SUCCESS.

◆ CU_CI_add_test()

CU_EXPORT void CU_CI_add_test ( const char *  name,
CU_TestFunc  test 
)

Add a test to the current CUnit CI suite.

Parameters
nametest name
testtest function

References CU_add_test().

◆ CU_CI_args()

CU_EXPORT void CU_CI_args ( int *  argc,
char ***  argv 
)

Obtain the command line arguments and count that was passed to CU_CI_main()

Parameters
argc
argv

◆ CU_CI_main()

CU_EXPORT int CU_CI_main ( int  argc,
char **  argv 
)

Main Entry point to CI mode of CUnit.

Parameters
argccommand line args count
argvvector of command line args
Returns
non-zero on test failure

References CU_get_registry(), CU_print_all_suite_tests(), and CUE_SUCCESS.