Data Structures | |
struct | CU_Test |
CUnit test case data type. More... | |
struct | CU_Suite |
CUnit suite data type. More... | |
struct | CU_TestRegistry |
CUnit test registry data type. More... | |
struct | CU_TestInfo |
Test case parameters. More... | |
struct | CU_SuiteInfo |
Suite parameters. More... | |
struct | test_suite |
Deprecated (version 1). More... | |
struct | CU_FailureRecord |
Data type for holding assertion failure information (linked list). More... | |
struct | CU_RunSummary |
Data type for holding statistics and assertion failures for a test run. More... | |
Defines | |
#define | get_error() CU_get_error_msg() |
Deprecated (version 1). | |
#define | MAX_TEST_NAME_LENGTH 256 |
Maximum length of a test name string. | |
#define | MAX_SUITE_NAME_LENGTH 256 |
Maximim length of a suite name string. | |
#define | BOOL int |
Boolean type for CUnit use. | |
#define | TRUE 1 |
Boolean TRUE for CUnit use. | |
#define | FALSE 0 |
Boolean FALSE for CUnit use. | |
#define | CU_UNREFERENCED_PARAMETER(x) (void)x |
Consistent approach to referencing unused parameters. | |
#define | CU_PASS(msg) { CU_assertImplementation(TRUE, __LINE__, ("CU_PASS(" #msg ")"), __FILE__, "", FALSE); } |
Record a pass condition without performing a logical test. | |
#define | CU_ASSERT(value) { CU_assertImplementation((value), __LINE__, #value, __FILE__, "", FALSE); } |
Simple assertion. | |
#define | CU_ASSERT_FATAL(value) { CU_assertImplementation((value), __LINE__, #value, __FILE__, "", TRUE); } |
Simple assertion. | |
#define | CU_TEST(value) { CU_assertImplementation((value), __LINE__, #value, __FILE__, "", FALSE); } |
Simple assertion. | |
#define | CU_TEST_FATAL(value) { CU_assertImplementation((value), __LINE__, #value, __FILE__, "", TRUE); } |
Simple assertion. | |
#define | CU_FAIL(msg) { CU_assertImplementation(FALSE, __LINE__, ("CU_FAIL(" #msg ")"), __FILE__, "", FALSE); } |
Record a failure without performing a logical test. | |
#define | CU_FAIL_FATAL(msg) { CU_assertImplementation(FALSE, __LINE__, ("CU_FAIL_FATAL(" #msg ")"), __FILE__, "", TRUE); } |
Record a failure without performing a logical test, and abort test. | |
#define | CU_ASSERT_TRUE(value) { CU_assertImplementation((value), __LINE__, ("CU_ASSERT_TRUE(" #value ")"), __FILE__, "", FALSE); } |
Asserts that value is TRUE. | |
#define | CU_ASSERT_TRUE_FATAL(value) { CU_assertImplementation((value), __LINE__, ("CU_ASSERT_TRUE_FATAL(" #value ")"), __FILE__, "", TRUE); } |
Asserts that value is TRUE. | |
#define | CU_ASSERT_FALSE(value) { CU_assertImplementation(!(value), __LINE__, ("CU_ASSERT_FALSE(" #value ")"), __FILE__, "", FALSE); } |
Asserts that value is FALSE. | |
#define | CU_ASSERT_FALSE_FATAL(value) { CU_assertImplementation(!(value), __LINE__, ("CU_ASSERT_FALSE_FATAL(" #value ")"), __FILE__, "", TRUE); } |
Asserts that value is FALSE. | |
#define | CU_ASSERT_EQUAL(actual, expected) { CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); } |
Asserts that actual == expected. | |
#define | CU_ASSERT_EQUAL_FATAL(actual, expected) { CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", TRUE); } |
Asserts that actual == expected. | |
#define | CU_ASSERT_NOT_EQUAL(actual, expected) { CU_assertImplementation(((actual) != (expected)), __LINE__, ("CU_ASSERT_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); } |
Asserts that actual != expected. | |
#define | CU_ASSERT_NOT_EQUAL_FATAL(actual, expected) { CU_assertImplementation(((actual) != (expected)), __LINE__, ("CU_ASSERT_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", TRUE); } |
Asserts that actual != expected. | |
#define | CU_ASSERT_PTR_EQUAL(actual, expected) { CU_assertImplementation(((void*)(actual) == (void*)(expected)), __LINE__, ("CU_ASSERT_PTR_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); } |
Asserts that pointers actual == expected. | |
#define | CU_ASSERT_PTR_EQUAL_FATAL(actual, expected) { CU_assertImplementation(((void*)(actual) == (void*)(expected)), __LINE__, ("CU_ASSERT_PTR_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", TRUE); } |
Asserts that pointers actual == expected. | |
#define | CU_ASSERT_PTR_NOT_EQUAL(actual, expected) { CU_assertImplementation(((void*)(actual) != (void*)(expected)), __LINE__, ("CU_ASSERT_PTR_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); } |
Asserts that pointers actual != expected. | |
#define | CU_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) { CU_assertImplementation(((void*)(actual) != (void*)(expected)), __LINE__, ("CU_ASSERT_PTR_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", TRUE); } |
Asserts that pointers actual != expected. | |
#define | CU_ASSERT_PTR_NULL(value) { CU_assertImplementation((NULL == (void*)(value)), __LINE__, ("CU_ASSERT_PTR_NULL(" #value")"), __FILE__, "", FALSE); } |
Asserts that pointer value is NULL. | |
#define | CU_ASSERT_PTR_NULL_FATAL(value) { CU_assertImplementation((NULL == (void*)(value)), __LINE__, ("CU_ASSERT_PTR_NULL_FATAL(" #value")"), __FILE__, "", TRUE); } |
Asserts that pointer value is NULL. | |
#define | CU_ASSERT_PTR_NOT_NULL(value) { CU_assertImplementation((NULL != (void*)(value)), __LINE__, ("CU_ASSERT_PTR_NOT_NULL(" #value")"), __FILE__, "", FALSE); } |
Asserts that pointer value is not NULL. | |
#define | CU_ASSERT_PTR_NOT_NULL_FATAL(value) { CU_assertImplementation((NULL != (void*)(value)), __LINE__, ("CU_ASSERT_PTR_NOT_NULL_FATAL(" #value")"), __FILE__, "", TRUE); } |
Asserts that pointer value is not NULL. | |
#define | CU_ASSERT_STRING_EQUAL(actual, expected) { CU_assertImplementation(!(strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); } |
Asserts that string actual == expected. | |
#define | CU_ASSERT_STRING_EQUAL_FATAL(actual, expected) { CU_assertImplementation(!(strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", TRUE); } |
Asserts that string actual == expected. | |
#define | CU_ASSERT_STRING_NOT_EQUAL(actual, expected) { CU_assertImplementation((strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); } |
Asserts that string actual != expected. | |
#define | CU_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) { CU_assertImplementation((strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", TRUE); } |
Asserts that string actual != expected. | |
#define | CU_ASSERT_NSTRING_EQUAL(actual, expected, count) { CU_assertImplementation(!(strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", FALSE); } |
Asserts that string actual == expected with length specified. | |
#define | CU_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) { CU_assertImplementation(!(strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_EQUAL_FATAL(" #actual "," #expected "," #count ")"), __FILE__, "", TRUE); } |
Asserts that string actual == expected with length specified. | |
#define | CU_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) { CU_assertImplementation((strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_NOT_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", FALSE); } |
Asserts that string actual != expected with length specified. | |
#define | CU_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) { CU_assertImplementation((strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_NOT_EQUAL_FATAL(" #actual "," #expected "," #count ")"), __FILE__, "", TRUE); } |
Asserts that string actual != expected with length specified. | |
#define | CU_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) { CU_assertImplementation(((fabs((double)(actual) - (expected)) <= fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", FALSE); } |
Asserts that double actual == expected within the specified tolerance. | |
#define | CU_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) { CU_assertImplementation(((fabs((double)(actual) - (expected)) <= fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_EQUAL_FATAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", TRUE); } |
Asserts that double actual == expected within the specified tolerance. | |
#define | CU_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) { CU_assertImplementation(((fabs((double)(actual) - (expected)) > fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_NOT_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", FALSE); } |
Asserts that double actual != expected within the specified tolerance. | |
#define | CU_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) { CU_assertImplementation(((fabs((double)(actual) - (expected)) > fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_NOT_EQUAL_FATAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", TRUE); } |
Asserts that double actual != expected within the specified tolerance. | |
#define | ASSERT(value) { if (FALSE == (int)(value)) { CU_assertImplementation((BOOL)value, __LINE__, #value, __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_TRUE(value) { if (FALSE == (value)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_TRUE(" #value ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_FALSE(value) { if (FALSE != (value)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_FALSE(" #value ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_EQUAL(actual, expected) { if ((actual) != (expected)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_NOT_EQUAL(actual, expected) { if ((void*)(actual) == (void*)(expected)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_PTR_EQUAL(actual, expected) { if ((void*)(actual) != (void*)(expected)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_PTR_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_PTR_NOT_EQUAL(actual, expected) { if ((void*)(actual) == (void*)(expected)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_PTR_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_PTR_NULL(value) { if (NULL != (void*)(value)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_PTR_NULL(" #value")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_PTR_NOT_NULL(value) { if (NULL == (void*)(value)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_PTR_NOT_NULL(" #value")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_STRING_EQUAL(actual, expected) { if (strcmp((const char*)actual, (const char*)expected)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_STRING_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_STRING_NOT_EQUAL(actual, expected) { if (!strcmp((const char*)actual, (const char*)expected)) { CU_assertImplementation(TRUE, __LINE__, ("ASSERT_STRING_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_NSTRING_EQUAL(actual, expected, count) { if (strncmp((const char*)actual, (const char*)expected, (size_t)count)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_NSTRING_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) { if (!strncmp((const char*)actual, (const char*)expected, (size_t)count)) { CU_assertImplementation(TRUE, __LINE__, ("ASSERT_NSTRING_NOT_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_DOUBLE_EQUAL(actual, expected, granularity) { if ((fabs((double)actual - expected) > fabs((double)granularity))) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_DOUBLE_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) { if ((fabs((double)actual - expected) <= fabs((double)granularity))) { CU_assertImplementation(TRUE, __LINE__, ("ASSERT_DOUBLE_NOT_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", FALSE); return; }} |
Deprecated (version 1). | |
#define | CU_CALLOC(x, y) calloc((x), (y)) |
Standard calloc() if MEMTRACE not defined. | |
#define | CU_MALLOC(x) malloc((x)) |
Standard malloc() if MEMTRACE not defined. | |
#define | CU_FREE(x) free((x)) |
Standard free() if MEMTRACE not defined. | |
#define | CU_REALLOC(x, y) realloc((x), (y)) |
Standard realloc() if MEMTRACE not defined. | |
#define | CU_CREATE_MEMORY_REPORT(x) |
No-op if MEMTRACE not defined. | |
#define | CU_DUMP_MEMORY_USAGE(x) |
No-op if MEMTRACE not defined. | |
#define | CU_ADD_TEST(suite, test) (CU_add_test(suite, #test, (CU_TestFunc)test)) |
Shortcut macro for adding a test to a suite. | |
#define | CU_TEST_INFO_NULL { NULL, NULL } |
NULL CU_test_info_t to terminate arrays of tests. | |
#define | CU_SUITE_INFO_NULL { NULL, NULL, NULL, NULL } |
NULL CU_suite_info_t to terminate arrays of suites. | |
#define | TEST_CASE_NULL { NULL, NULL } |
Deprecated (version 1). | |
#define | TEST_GROUP_NULL { NULL, NULL, NULL, NULL } |
Deprecated (version 1). | |
#define | test_group_register(tg) CU_register_suites(tg) |
Deprecated (version 1). | |
#define | initialize_registry() CU_initialize_registry() |
Deprecated (version 1). | |
#define | cleanup_registry() CU_cleanup_registry() |
Deprecated (version 1). | |
#define | add_test_group(name, init, clean) CU_add_suite(name, init, clean) |
Deprecated (version 1). | |
#define | add_test_case(group, name, test) CU_add_test(group, name, test) |
Deprecated (version 1). | |
#define | get_registry() CU_get_registry() |
Deprecated (version 1). | |
#define | set_registry(reg) CU_set_registry((reg)) |
Deprecated (version 1). | |
#define | get_group_by_name(group, reg) CU_get_suite_by_name(group, reg) |
Deprecated (version 1). | |
#define | get_test_by_name(test, group) CU_get_test_by_name(test, group) |
Deprecated (version 1). | |
#define | ADD_TEST_TO_GROUP(group, test) (CU_add_test(group, #test, (CU_TestFunc)test)) |
Deprecated (version 1). | |
#define | CUNIT_MAX_STRING_LENGTH 1024 |
Maximum string length. | |
#define | CUNIT_MAX_ENTITY_LEN 5 |
maximum number of characters in a translated xml entity. | |
#define | translate_special_characters(src, dest, len) CU_translate_special_characters(src, dest, len) |
Deprecated (version 1). | |
#define | compare_strings(src, dest) CU_compare_strings(src, dest) |
Deprecated (version 1). | |
#define | trim_left(str) CU_trim_left(str) |
Deprecated (version 1). | |
#define | trim_right(str) CU_trim_right(str) |
Deprecated (version 1). | |
#define | trim(str) CU_trim(str) |
Deprecated (version 1). | |
Typedefs | |
typedef enum CU_ErrorAction | CU_ErrorAction |
CUnit error action codes. | |
typedef int(* | CU_InitializeFunc )(void) |
Signature for suite initialization function. | |
typedef int(* | CU_CleanupFunc )(void) |
Signature for suite cleanup function. | |
typedef void(* | CU_TestFunc )(void) |
Signature for a testing function in a test case. | |
typedef CU_Test | CU_Test |
CUnit test case data type. | |
typedef CU_Test * | CU_pTest |
Pointer to a CUnit test case. | |
typedef CU_Suite | CU_Suite |
CUnit suite data type. | |
typedef CU_Suite * | CU_pSuite |
Pointer to a CUnit suite. | |
typedef CU_TestRegistry | CU_TestRegistry |
CUnit test registry data type. | |
typedef CU_TestRegistry * | CU_pTestRegistry |
Pointer to a CUnit test registry. | |
typedef CU_TestInfo | CU_TestInfo |
Test case parameters. | |
typedef CU_TestInfo * | CU_pTestInfo |
Pointer to CU_TestInfo type. | |
typedef CU_SuiteInfo | CU_SuiteInfo |
Suite parameters. | |
typedef CU_SuiteInfo * | CU_pSuiteInfo |
Pointer to CU_SuiteInfo type. | |
typedef CU_TestInfo | test_case_t |
Deprecated (version 1). | |
typedef CU_SuiteInfo | test_group_t |
Deprecated (version 1). | |
typedef test_suite | test_suite_t |
Deprecated (version 1). | |
typedef CU_InitializeFunc | InitializeFunc |
Deprecated (version 1). | |
typedef CU_CleanupFunc | CleanupFunc |
Deprecated (version 1). | |
typedef CU_TestFunc | TestFunc |
Deprecated (version 1). | |
typedef CU_Test | _TestCase |
Deprecated (version 1). | |
typedef CU_pTest | PTestCase |
Deprecated (version 1). | |
typedef CU_Suite | _TestGroup |
Deprecated (version 1). | |
typedef CU_pSuite | PTestGroup |
Deprecated (version 1). | |
typedef CU_TestRegistry | _TestRegistry |
Deprecated (version 1). | |
typedef CU_pTestRegistry | PTestRegistry |
Deprecated (version 1). | |
typedef CU_FailureRecord | CU_FailureRecord |
Data type for holding assertion failure information (linked list). | |
typedef CU_FailureRecord * | CU_pFailureRecord |
Pointer to CU_FailureRecord. | |
typedef CU_RunSummary | CU_RunSummary |
Data type for holding statistics and assertion failures for a test run. | |
typedef CU_RunSummary * | CU_pRunSummary |
Pointer to CU_RunSummary. | |
typedef void(* | CU_TestStartMessageHandler )(const CU_pTest pTest, const CU_pSuite pSuite) |
Message handler called at the start of a test. | |
typedef void(* | CU_TestCompleteMessageHandler )(const CU_pTest pTest, const CU_pSuite pSuite, const CU_pFailureRecord pFailure) |
Message handler called at the completion of a test. | |
typedef void(* | CU_AllTestsCompleteMessageHandler )(const CU_pFailureRecord pFailure) |
Message handler called at the completion of a test run. | |
typedef void(* | CU_SuiteInitFailureMessageHandler )(const CU_pSuite pSuite) |
Message handler called when a suite initializer fails. | |
typedef CU_FailureRecord | _TestResult |
typedef CU_pFailureRecord | PTestResult |
Enumerations | |
enum | CU_ErrorCode { CUE_SUCCESS = 0, CUE_NOMEMORY = 1, CUE_NOREGISTRY = 10, CUE_REGISTRY_EXISTS = 11, CUE_NOSUITE = 20, CUE_NO_SUITENAME = 21, CUE_SINIT_FAILED = 22, CUE_SCLEAN_FAILED = 23, CUE_DUP_SUITE = 24, CUE_NOTEST = 30, CUE_NO_TESTNAME = 31, CUE_DUP_TEST = 32, CUE_TEST_NOT_IN_SUITE = 33, CUE_FOPEN_FAILED = 40, CUE_FCLOSE_FAILED = 41, CUE_BAD_FILENAME = 42, CUE_WRITE_ERROR = 43 } |
CUnit error codes. More... | |
enum | CU_ErrorAction { CUEA_IGNORE, CUEA_FAIL, CUEA_ABORT } |
CUnit error action codes. More... | |
Functions | |
CU_ErrorCode | CU_get_error (void) |
Get the error code. | |
const char * | CU_get_error_msg (void) |
Get the message corresponding to the error code. | |
void | CU_set_error_action (CU_ErrorAction action) |
Set the action to take when an error condition occurs. | |
CU_ErrorAction | CU_get_error_action (void) |
Get the current error action code. | |
void | test_cunit_CUError (void) |
void | CU_set_error (CU_ErrorCode error) |
Set the error code. | |
void | test_cunit_deactivate_malloc (void) |
Disable memory allocation for testing purposes. | |
void | test_cunit_activate_malloc (void) |
Enable memory allocation for testing purposes. | |
unsigned int | test_cunit_get_n_memevents (void *pLocation) |
Retrieve number of memory events for a given pointer. | |
unsigned int | test_cunit_get_n_allocations (void *pLocation) |
Retrieve number of allocations for a given pointer. | |
unsigned int | test_cunit_get_n_deallocations (void *pLocation) |
Retrieve number of deallocations for a given pointer. | |
void | test_cunit_MyMem (void) |
The main internal testing function for MyMem.c. | |
CU_ErrorCode | CU_initialize_registry (void) |
Initialize the test registry. | |
void | CU_cleanup_registry (void) |
Clear the test registry. | |
CU_pSuite | CU_add_suite (const char *strName, CU_InitializeFunc pInit, CU_CleanupFunc pClean) |
Create a new test suite and add it to the test registry. | |
CU_pTest | CU_add_test (CU_pSuite pSuite, const char *strName, CU_TestFunc pTestFunc) |
Create a new test case and add it to a test suite. | |
CU_ErrorCode | CU_register_suites (CU_SuiteInfo suite_info[]) |
Registers the suites in a single CU_SuiteInfo array.. | |
CU_ErrorCode | CU_register_nsuites (int suite_count,...) |
Registers multiple suite arrays in CU_SuiteInfo format. | |
int | test_suite_register (test_suite_t *ts) |
Deprecated (version 1). | |
CU_pTestRegistry | CU_get_registry (void) |
Retrieve a pointer to the current test registry. | |
CU_pTestRegistry | CU_set_registry (CU_pTestRegistry pTestRegistry) |
Set the registry to an existing CU_pTestRegistry instance. | |
CU_pTestRegistry | CU_create_new_registry (void) |
Create and initialize a new test registry. | |
void | CU_destroy_existing_registry (CU_pTestRegistry *ppRegistry) |
Destroy and free all memory for an existing test registry. | |
CU_pSuite | CU_get_suite_by_name (const char *szSuiteName, CU_pTestRegistry pRegistry) |
Retrieve a pointer to the suite having the specified name. | |
CU_pTest | CU_get_test_by_name (const char *szTestName, CU_pSuite pSuite) |
Retrieve a pointer to the test case having the specified name. | |
void | test_cunit_TestDB (void) |
void | CU_set_test_start_handler (CU_TestStartMessageHandler pTestStartMessage) |
Set the message handler to call before each test is run. | |
void | CU_set_test_complete_handler (CU_TestCompleteMessageHandler pTestCompleteMessage) |
Set the message handler to call after each test is run. | |
void | CU_set_all_test_complete_handler (CU_AllTestsCompleteMessageHandler pAllTestsCompleteMessage) |
Set the message handler to call after all tests have been run. | |
void | CU_set_suite_init_failure_handler (CU_SuiteInitFailureMessageHandler pSuiteInitFailureMessage) |
Set the message handler to call when a suite initialization function returns an error. | |
CU_TestStartMessageHandler | CU_get_test_start_handler (void) |
Retrieve the message handler called before each test is run. | |
CU_TestCompleteMessageHandler | CU_get_test_complete_handler (void) |
Retrieve the message handler called after each test is run. | |
CU_AllTestsCompleteMessageHandler | CU_get_all_test_complete_handler (void) |
Retrieve the message handler called after all tests are run. | |
CU_SuiteInitFailureMessageHandler | CU_get_suite_init_failure_handler (void) |
Retrieve the message handler called when a suite initialization error occurs. | |
CU_ErrorCode | CU_run_all_tests (void) |
Run all tests in all suites registered in the test registry. | |
CU_ErrorCode | CU_run_suite (CU_pSuite pSuite) |
Run all tests in a specified suite. | |
CU_ErrorCode | CU_run_test (CU_pSuite pSuite, CU_pTest pTest) |
Run a specific test in a specified suite. | |
unsigned int | CU_get_number_of_suites_run (void) |
Retrieve the number of suites completed during the previous run. | |
unsigned int | CU_get_number_of_suites_failed (void) |
Retrieve the number of suites which failed to initialize during the previous run. | |
unsigned int | CU_get_number_of_tests_run (void) |
Retrieve the number of tests completed during the previous run. | |
unsigned int | CU_get_number_of_tests_failed (void) |
Retrieve the number of tests which contained failed assertions during the previous run. | |
unsigned int | CU_get_number_of_asserts (void) |
Retrieve the number of assertions processed during the last run. | |
unsigned int | CU_get_number_of_successes (void) |
Retrieve the number of successful assertions during the last run. | |
unsigned int | CU_get_number_of_failures (void) |
Retrieve the number of failed assertions during the last run. | |
unsigned int | CU_get_number_of_failure_records (void) |
Retrieve the number failure records created during the previous run. | |
CU_pFailureRecord | CU_get_failure_list (void) |
Retrieve the list of failures which occurred during the last test run. | |
CU_pRunSummary | CU_get_run_summary (void) |
Retrieve the entire run summary for the last test run. | |
CU_pSuite | CU_get_current_suite (void) |
Retrieve a pointer to the currently-running suite (NULL if none). | |
CU_pTest | CU_get_current_test (void) |
Retrieve a pointer to the currently-running test (NULL if none). | |
BOOL | CU_is_test_running (void) |
Returns TRUE if a test run is in progress, TRUE otherwise. | |
void | CU_clear_previous_results (void) |
Initialize the run summary information stored from the previous test run. | |
BOOL | CU_assertImplementation (BOOL bValue, unsigned int uiLine, char strCondition[], char strFile[], char strFunction[], BOOL bFatal) |
Assertion implementation function. | |
void | test_cunit_TestRun (void) |
int | CU_translate_special_characters (const char *szSrc, char *szDest, int maxlen) |
Convert special characters in the specified string to xml entity codes. | |
int | CU_compare_strings (const char *szSrc, const char *szDest) |
Case-insensitive string comparison. | |
void | CU_trim_left (char *szString) |
Trim leading whitespace from the specified string. | |
void | CU_trim_right (char *szString) |
Trim trailing whitespace from the specified string. | |
void | CU_trim (char *szString) |
Trim leading and trailing whitespace from the specified string. | |
void | test_cunit_Util (void) |
const char * | get_error_desc (CU_ErrorCode error) |
Internal function to look up the error message for a specified error code. | |
void | cleanup_test_registry (CU_pTestRegistry pRegistry) |
Internal function to clean up the specified test registry. | |
CU_pSuite | create_suite (const char *strName, CU_InitializeFunc pInit, CU_CleanupFunc pClean) |
Internal function to create a new test suite having the specified parameters. | |
void | cleanup_suite (CU_pSuite pSuite) |
Internal function to clean up the specified test suite. | |
void | insert_suite (CU_pTestRegistry pRegistry, CU_pSuite pSuite) |
Internal function to insert a suite into a registry. | |
CU_pTest | create_test (const char *strName, CU_TestFunc pTestFunc) |
Internal function to create a new test case having the specified parameters. | |
void | cleanup_test (CU_pTest pTest) |
Internal function to clean up the specified test. | |
void | insert_test (CU_pSuite pSuite, CU_pTest pTest) |
Internal function to insert a test into a suite. | |
BOOL | suite_exists (CU_pTestRegistry pRegistry, const char *szSuiteName) |
Internal function to check whether a suite having a specified name already exists. | |
BOOL | test_exists (CU_pSuite pSuite, const char *szTestName) |
Internal function to check whether a test having a specified name is already registered in a given suite. | |
void | clear_previous_results (CU_pRunSummary pRunSummary, CU_pFailureRecord *ppFailure) |
Initialize the run summary information in the specified structure. | |
void | cleanup_failure_list (CU_pFailureRecord *ppFailure) |
Free all memory allocated for the linked list of test failure records. | |
CU_ErrorCode | run_single_suite (CU_pSuite pSuite, CU_pRunSummary pRunSummary) |
Run all tests in a specified suite. | |
CU_ErrorCode | run_single_test (CU_pTest pTest, CU_pRunSummary pRunSummary) |
Run a specific test. | |
void | add_failure (CU_pFailureRecord *ppFailure, CU_pRunSummary pRunSummary, unsigned int uiLineNumber, char szCondition[], char szFileName[], CU_pSuite pSuite, CU_pTest pTest) |
Record a failed test. | |
int | get_index (char ch) |
Check whether a character is a special xml character. | |
Variables | |
CU_ErrorCode | g_error_number = CUE_SUCCESS |
Local variable holding the current error code. | |
CU_ErrorCode | g_error_action = CUEA_IGNORE |
Local variable holding the current error action code. | |
CU_pTestRegistry | f_pTestRegistry = NULL |
The active internal Test Registry. | |
BOOL | f_bTestIsRunning = FALSE |
Flag for whether a test run is in progress. | |
CU_pSuite | f_pCurSuite = NULL |
Pointer to the suite currently being run. | |
CU_pTest | f_pCurTest = NULL |
Pointer to the test currently being run. | |
CU_RunSummary | f_run_summary = {0, 0, 0, 0, 0, 0, 0} |
CU_RunSummary to hold results of each test run. | |
CU_pFailureRecord | f_failure_list = NULL |
CU_pFailureRecord to hold head of failure record list of each test run. | |
CU_pFailureRecord | f_last_failure = NULL |
Keeps track of end of f_run_summary list for message handlers. | |
CU_TestStartMessageHandler | f_pTestStartMessageHandler = NULL |
Pointer to the function to be called before running a test. | |
CU_TestCompleteMessageHandler | f_pTestCompleteMessageHandler = NULL |
Pointer to the function to be called after running a test. | |
CU_AllTestsCompleteMessageHandler | f_pAllTestsCompleteMessageHandler = NULL |
Pointer to the function to be called when all tests have been run. | |
CU_SuiteInitFailureMessageHandler | f_pSuiteInitFailureMessageHandler = NULL |
Pointer to the function to be called if a suite initialization function returns an error. | |
struct { | |
char special_char | |
char * replacement | |
} | bindings |
Structure containing mappings of special characters to xml entity codes. |
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Boolean type for CUnit use.
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Shortcut macro for adding a test to a suite.
|
|
Simple assertion. Reports failure with no other action. |
|
Asserts that double actual == expected within the specified tolerance. If actual is within granularity of expected, the assertion passes. Reports failure with no other action. |
|
Asserts that double actual == expected within the specified tolerance. If actual is within granularity of expected, the assertion passes. Reports failure and causes test to abort. |
|
Asserts that double actual != expected within the specified tolerance. If actual is within granularity of expected, the assertion fails. Reports failure with no other action. |
|
Asserts that double actual != expected within the specified tolerance. If actual is within granularity of expected, the assertion fails. Reports failure and causes test to abort. |
|
Asserts that actual == expected. Reports failure with no other action. |
|
Asserts that actual == expected. Reports failure and causes test to abort. |
|
Asserts that value is FALSE. Reports failure with no other action. |
|
Asserts that value is FALSE. Reports failure and causes test to abort. |
|
Simple assertion. Reports failure and causes test to abort. |
|
Asserts that actual != expected. Reports failure with no other action. |
|
Asserts that actual != expected. Reports failure and causes test to abort. |
|
Asserts that string actual == expected with length specified. The comparison is limited to count characters. Reports failure with no other action. |
|
Asserts that string actual == expected with length specified. The comparison is limited to count characters. Reports failure and causes test to abort. |
|
Asserts that string actual != expected with length specified. The comparison is limited to count characters. Reports failure with no other action. |
|
Asserts that string actual != expected with length specified. The comparison is limited to count characters. Reports failure and causes test to abort. |
|
Asserts that pointers actual == expected. Reports failure with no other action. |
|
Asserts that pointers actual == expected. Reports failure and causes test to abort. |
|
Asserts that pointers actual != expected. Reports failure with no other action. |
|
Asserts that pointers actual != expected. Reports failure and causes test to abort. |
|
Asserts that pointer value is not NULL. Reports failure with no other action. |
|
Asserts that pointer value is not NULL. Reports failure and causes test to abort. |
|
Asserts that pointer value is NULL. Reports failure with no other action. |
|
Asserts that pointer value is NULL. Reports failure and causes test to abort. |
|
Asserts that string actual == expected. Reports failure with no other action. |
|
Asserts that string actual == expected. Reports failure and causes test to abort. |
|
Asserts that string actual != expected. Reports failure with no other action. |
|
Asserts that string actual != expected. Reports failure and causes test to abort. |
|
Asserts that value is TRUE. Reports failure with no other action. |
|
Asserts that value is TRUE. Reports failure and causes test to abort. |
|
Standard calloc() if MEMTRACE not defined.
|
|
No-op if MEMTRACE not defined.
|
|
No-op if MEMTRACE not defined.
|
|
Record a failure without performing a logical test.
|
|
Record a failure without performing a logical test, and abort test.
|
|
Standard free() if MEMTRACE not defined.
|
|
Standard malloc() if MEMTRACE not defined.
|
|
Record a pass condition without performing a logical test.
|
|
Standard realloc() if MEMTRACE not defined.
|
|
NULL CU_suite_info_t to terminate arrays of suites.
|
|
Simple assertion. Reports failure with no other action. |
|
Simple assertion. Reports failure and causes test to abort. |
|
NULL CU_test_info_t to terminate arrays of tests.
|
|
Consistent approach to referencing unused parameters.
|
|
maximum number of characters in a translated xml entity.
|
|
Maximum string length.
|
|
Boolean FALSE for CUnit use.
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Maximim length of a suite name string.
|
|
Maximum length of a test name string.
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Boolean TRUE for CUnit use.
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
|
|
Deprecated (version 1).
|
|
Message handler called at the completion of a test run. The parameter is a pointer to the linked list holding the failure records for the test run. The test run is considered completed when the message handler is called. |
|
Signature for suite cleanup function.
|
|
CUnit error action codes. These are used to set the action desired when an error condition is detected in the CUnit framework. |
|
Data type for holding assertion failure information (linked list).
|
|
Signature for suite initialization function.
|
|
Pointer to CU_FailureRecord.
|
|
Pointer to CU_RunSummary.
|
|
Pointer to a CUnit suite.
|
|
Pointer to CU_SuiteInfo type.
|
|
Pointer to a CUnit test case.
|
|
Pointer to CU_TestInfo type.
|
|
Pointer to a CUnit test registry.
|
|
Data type for holding statistics and assertion failures for a test run.
|
|
CUnit suite data type. CU_Suite is a linked list of CU_Test containers. Each suite has a name and count of associated unit tests. It also holds a pointer to optional initialization and cleanup functions. If non-NULL, these are called before and after running the suite's tests, respectively. In addition, the suite holds a pointer to the head of the linked list of associated CU_Test objects. Finally, pointers to the next and previous suites in the linked list are maintained. Generally, the linked list includes suites which are associated with each other in a CU_TestRegistry. As a result, suites are run in the order in which they are registered (see CU_add_suite()). In the current implementation, the name of each CU_Suite in a test registry must have a unique name. There is no restriction on the contained tests. This means that the same CU_Test could, in principle, be run more than once as long as it is registered with different suites having distinct names.
|
|
Suite parameters. This data type is provided to assist CUnit users manage collections of test and suites. It is intended to be used to build arrays of suite parameters that can be passed to a bulk registration function such as CU_register_suite() or CU_register_suites(). |
|
Message handler called when a suite initializer fails. The test run is considered in progress when the message handler is called. |
|
CUnit test case data type. CU_Test is a linked list of unit tests. Each test has a name and a callable test function, as well as links to the next and previous tests in the list. A test also holds a jmp_buf reference for use in implementing fatal assertions. Generally, the linked list includes tests which are associated with each other in a CU_Suite. As a result, tests are run in the order in which they are added to a suite (see CU_add_test()). In the current implementation, the name of each CU_Test in a suite must have a unique name. There is no restriction on the test function. This means that the same function could, in principle, be called more than once as long as it is registered with different tests having distinct names.
|
|
Message handler called at the completion of a test. The parameters are the test and suite being run, plus a pointer to the first failure record applicable to this test. If the test did not have any assertion failures, pFailure will be NULL. The test run is considered in progress when the message handler is called. |
|
Signature for a testing function in a test case.
|
|
Test case parameters. This data type is provided to assist CUnit users manage collections of test and suites. It is intended to be used to build arrays of test case parameters that can be then be referred to in a CU_suite_info_t variable. |
|
CUnit test registry data type. CU_TestRegisty is the repository for suites containing unit tests. The test registry maintains a count of the number of CU_Suite objects contained in the registry, as well as a count of the total number of CU_Test objects associated with those suites. It also holds a pointer to the head of the linked list of CU_Suite objects. With this structure, the user will normally add suites implictly to the internal test registry using CU_add_suite(), and then add tests to each suite using CU_add_test(). Test runs are then initiated using one of the appropriate functions in TestRun.c via one of the interfaces. Automatic creation and destruction of the internal registry and its objects is available using CU_initialize_registry() and CU_cleanup_registry(), respectively. For internal and testing purposes, the internal registry can be retrieved and assigned. Functions are also provided for creating and destroying independent registries. Note that earlier versions of CUnit also contained a pointer to a linked list of CU_FailureRecord objects (termed _TestResults). This has been removed from the registry and relocated to TestRun.c. |
|
Message handler called at the start of a test. The parameters are the test and suite being run. The test run is considered in progress when the message handler is called. |
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
Deprecated (version 1).
|
|
CUnit error action codes. These are used to set the action desired when an error condition is detected in the CUnit framework. |
|
CUnit error codes. If codes are added or removed, be sure to make a change to the error messages in CUError.c/get_error_desc().
|
|
Record a failed test. This function is called whenever a test fails to record the details of the failure. This includes user assertion failures and system errors such as failure to initialize a suite.
|
|
Free all memory allocated for the linked list of test failure records. pFailure is reset to NULL after its list is cleaned up.
|
|
Internal function to clean up the specified test suite. Each test case registered with pSuite will be freed. Severe problems can occur if this function is called during a test run involving pSuite.
|
|
Internal function to clean up the specified test. All memory associated with the test will be freed. Severe problems can occur if this function is called during a test run involving pTest.
|
|
Internal function to clean up the specified test registry. cleanup_suite() will be called for each registered suite to perform cleanup of the associated test cases. Then, the suite's memory will be freed. Note that any pointers to tests or suites in pRegistry held by the user will be invalidated by this function. Severe problems can occur if this function is called during a test run involving pRegistry. Note that memory held for data members in the registry (e.g. pName) and the registry itself are not freed by this function.
|
|
Initialize the run summary information in the specified structure. Resets the run counts to zero, and calls cleanup_failure_list() if failures were recorded by the last test run. Calling this function multiple times, while inefficient, will not cause an error condition.
|
|
Internal function to create a new test suite having the specified parameters. This function creates a new test suite having the specified name and initialization/cleanup functions. The strName cannot be NULL (checked by assertion), but either or both function pointers can be. A pointer to the newly-created suite is returned, or NULL if there was an error allocating memory for the new suite. It is the responsibility of the caller to destroy the returned suite (use cleanup_suite() before freeing the returned pointer).
|
|
Internal function to create a new test case having the specified parameters. This function creates a new test having the specified name and test function. The strName cannot be NULL (checked by assertion), but the function pointer may be. A pointer to the newly-created test is returned, or NULL if there was an error allocating memory for the new test. It is the responsibility of the caller to destroy the returned test (use cleanup_test() before freeing the returned pointer).
|
|
Create a new test suite and add it to the test registry. This function creates a new test suite having the specified name and initialization/cleanup functions and adds it to the test registry. It returns a pointer to the newly-created suite, which will be NULL if there was a problem with the suite creation or addition.<br /><br /> CU_add_suite() sets the following error codes: -CUE_NOREGISTRY if the registry hasn't been initialized. -CUE_NO_SUITENAME if strName is NULL. -CUE_DUP_SUITE if a suite having strName is already registered. -CUE_NOMEMORY if a memory allocation failed.<BR /><BR /> NOTE - the CU_pSuite pointer returned should NOT BE FREED BY THE USER. The suite is freed by the CUnit system when CU_cleanup_registry() is called. This function must not be called during a test run (checked by assertion).
|
|
Create a new test case and add it to a test suite. This function creates a new test having the specified name and function, and adds it to the specified suite. At present, there is no mechanism for creating a test case independent of a suite, although this function does return a pointer to the newly-created test.<br /><br /> CU_add_test() sets the following error codes: -CUE_NOSUITE if pSuite is NULL. -CUE_NO_TESTNAME if strName is NULL. -CUE_DUP_TEST if a test having strName is already registered to pSuite. -CUE_NOMEMORY if a memory allocation failed.<BR /><BR /> NOTE - the CU_pTest pointer returned should NOT BE FREED BY THE USER. The test is freed by the CUnit system when CU_cleanup_registry() is called. This function must not be called during a test run (checked by assertion).
|
|
Assertion implementation function. All CUnit assertions reduce to a call to this function. It should only be called during an active test run (checked by assertion). This means that CUnit assertions should only be used in registered test functions during a test run.
|
|
Clear the test registry. The active test registry is freed, including all stored suites and associated tests. The most recent stored test results are also cleared. After calling this function, CUnit suites cannot be added until CU_initialize_registry() or CU_set_registry() is called. Further, any pointers to suites or test cases held by the user will be invalidated by calling this function. This function may be called multiple times without generating an error condition. However, this function must not be called during a test run (checked by assertion). |
|
Initialize the run summary information stored from the previous test run. Resets the run counts to zero, and frees any memory associated with failure records. Calling this function multiple times, while inefficient, will not cause an error condition.
|
|
Case-insensitive string comparison.
|
|
Create and initialize a new test registry. Returns a pointer to a new, initialized registry (NULL if memory could not be allocated). It is the caller's responsibility to destroy and free the new registry (unless it is made the active test registry using CU_set_registry(). |
|
Destroy and free all memory for an existing test registry. The active test registry is destroyed by the CUnit system in CU_cleanup_registry(), so only call this function on registries created independently of the internal CUnit system. Once a registry is made the active test registry using CU_set_registry(), its destruction will be handled by the framework. Passing a NULL *ppRegistry will have no effect.
|
|
Retrieve the message handler called after all tests are run.
|
|
Retrieve a pointer to the currently-running suite (NULL if none).
|
|
Retrieve a pointer to the currently-running test (NULL if none).
|
|
Get the error code. CUnit implementation functions set the error code to indicate the status of the most recent operation. In general, the CUnit functions will clear the code to CUE_SUCCESS, then reset it to a specific error code if an exception condition is encountered. Some functions return the code, others leave it to the user to inspect if desired.
|
|
Get the current error action code.
|
|
Get the message corresponding to the error code. CUnit implementation functions set the error code to indicate the of the most recent operation. In general, the CUnit functions will clear the code to CUE_SUCCESS, then reset it to a specific error code if an exception condition is encountered. This function allows the user to retrieve a descriptive error message corresponding to the error code set by the last operation.
|
|
Retrieve the list of failures which occurred during the last test run. Note that the pointer returned is invalidated when the client initiates a run using CU_run_all_tests(), CU_run_suite(), or CU_run_test().
|
|
Retrieve the number of assertions processed during the last run. The count is reset each time the client initiates a run. |
|
Retrieve the number failure records created during the previous run. Note that this may be more than the number of failed assertions, since failure records may also be created for failed suite initialization and cleanup. The count is reset each time the client initiates a run. |
|
Retrieve the number of failed assertions during the last run. The count is reset each time the client initiates a run.
|
|
Retrieve the number of successful assertions during the last run. The count is reset each time the client initiates a run.
|
|
Retrieve the number of suites which failed to initialize during the previous run. The count is reset each time the client initiates a run.
|
|
Retrieve the number of suites completed during the previous run. The count is reset each time the client initiates a run.
|
|
Retrieve the number of tests which contained failed assertions during the previous run. The count is reset each time the client initiates a run.
|
|
Retrieve the number of tests completed during the previous run. The count is reset each time the client initiates a run.
|
|
Retrieve a pointer to the current test registry. Returns NULL if the registry has not been initialized using CU_initialize_registry. Directly accessing the registry should not be necessary for most users. This function is provided primarily for internal and testing purposes.
|
|
Retrieve the entire run summary for the last test run. Note that the pFailure pointer in the run summary is invalidated when the client initiates a run using CU_run_all_tests(), CU_run_suite(), or CU_run_test().
|
|
Retrieve a pointer to the suite having the specified name. Scans the pRegistry and returns a pointer to the first suite located having the specified name.
|
|
Retrieve the message handler called when a suite initialization error occurs.
|
|
Retrieve a pointer to the test case having the specified name. Scans the pSuite and returns a pointer to the first test case located having the specified name.
|
|
Retrieve the message handler called after each test is run.
|
|
Retrieve the message handler called before each test is run.
|
|
Initialize the test registry. Any existing registry is freed, including all stored suites and associated tests. The most recent stored test results are also cleared. This function must not be called during a test run (checked by assertion).
|
|
Returns
|
|
Registers multiple suite arrays in CU_SuiteInfo format. The function accepts a variable number of suite arrays to be registered. The number of arrays is indicated by the value of the 1st argument, suite_count. Each suite in each array is registered with the CUnit test registry, along with all of the associated tests.
|
|
Registers the suites in a single CU_SuiteInfo array.. Multiple arrays can be registered using CU_register_nsuites().
|
|
Run all tests in all suites registered in the test registry. The suites are run in the order registered in the test registry. For each registered suite, any initialization function is first called, the suite is run using run_single_suite(), and finally any suite cleanup function is called. If an error condition (other than CUE_NOREGISTRY) occurs during the run, the action depends on the current error action (see CU_set_error_action()).
|
|
Run all tests in a specified suite. The suite need not be registered in the test registry to be run. Any initialization function for the suite is first called, then the suite is run using run_single_suite(), and any suite cleanup function is called. Note that the run statistics (counts of tests, successes, failures) are initialized each time this function is called. If an error condition occurs during the run, the action depends on the current error action (see CU_set_error_action()).
|
|
Run a specific test in a specified suite. The suite need not be registered in the test registry to be run, although the test must be registered in the specified suite. Any initialization function for the suite is first called, then the test is run using run_single_test(), and any suite cleanup function is called. Note that the run statistics (counts of tests, successes, failures) are initialized each time this function is called.
|
|
Set the message handler to call after all tests have been run.
|
|
Set the error code. This function is used internally by CUnit implementation functions when an error condition occurs within the framework. It should not generally be called by user code. NOTE that if the current error action is CUEA_ABORT, then calling this function will result in exit() being called for the current application.
|
|
Set the action to take when an error condition occurs. This function should be used to specify the action to take when an error condition is encountered. The default action is CUEA_IGNORE, which results in errors being ignored and test runs being continued (if possible). A value of CUEA_FAIL causes test runs to stop as soon as an error condition occurs, while CU_ABORT causes the application to exit on any error.
|
|
Set the registry to an existing CU_pTestRegistry instance. A pointer to the original registry is returned. Note that the original registry is not freed, and it becomes the caller's responsibility to do so. Directly accessing the registry should not be necessary for most users. This function is provided primarily for internal and testing purposes. This function must not be called during a test run (checked by assertion).
|
|
Set the message handler to call when a suite initialization function returns an error.
|
|
Set the message handler to call after each test is run.
|
|
Set the message handler to call before each test is run.
|
|
Convert special characters in the specified string to xml entity codes. The character-entity mappings are contained in the struct bindings. Note that conversion to entities increases the length of the converted string. The worst case conversion would be a string consisting entirely of entity characters of length CUNIT_MAX_ENTITY_LEN. If szDest does not have enough room to convert an entity, it will not be converted. It is the caller's responsibility to make sure there is sufficient room in szDest to hold the converted string.
|
|
Trim leading and trailing whitespace from the specified string.
|
|
Trim leading whitespace from the specified string.
|
|
Trim trailing whitespace from the specified string.
|
|
Internal function to look up the error message for a specified error code. An empty string is returned if iError is not a member of CU_ErrorCode.
|
|
Check whether a character is a special xml character. This function performs a lookup of the specified character in the bindings structure. If it is a special character, its index into the bindings array is returned. If not, -1 is returned.
|
|
Internal function to insert a suite into a registry. The suite name is assumed to be unique. Internally, the list of suites is a double-linked list, which this function manages. Insertion of duplicate (or NULL) pSuites is not allowed. Severe problems can occur if this function is called during a test run involving pRegistry.
|
|
Internal function to insert a test into a suite. The test name is assumed to be unique. Internally, the list of tests in a suite is a double-linked list, which this function manages. Insertion of duplicate tests (or NULL pTest) is not allowed. Severe problems can occur if this function is called during a test run involving pSuite.
|
|
Run all tests in a specified suite. Internal function to run all tests in a suite. The suite need not be registered in the test registry to be run. If the CUnit system is in an error condition after running a test, no additional tests are run.
|
|
Run a specific test. Internal function to run a test case. This includes calling any handler to be run before executing the test, running the test's function (if any), and calling any handler to be run after executing a test.
|
|
Internal function to check whether a suite having a specified name already exists.
|
|
Enable memory allocation for testing purposes.
|
|
|
|
Disable memory allocation for testing purposes.
|
|
Retrieve number of allocations for a given pointer.
|
|
Retrieve number of deallocations for a given pointer.
|
|
Retrieve number of memory events for a given pointer.
|
|
The main internal testing function for MyMem.c.
|
|
|
|
|
|
|
|
Internal function to check whether a test having a specified name is already registered in a given suite.
|
|
Deprecated (version 1).
|
|
Structure containing mappings of special characters to xml entity codes.
|
|
Flag for whether a test run is in progress.
|
|
CU_pFailureRecord to hold head of failure record list of each test run.
|
|
Keeps track of end of f_run_summary list for message handlers.
|
|
Pointer to the function to be called when all tests have been run.
|
|
Pointer to the suite currently being run.
|
|
Pointer to the test currently being run.
|
|
Pointer to the function to be called if a suite initialization function returns an error.
|
|
Pointer to the function to be called after running a test.
|
|
The active internal Test Registry.
|
|
Pointer to the function to be called before running a test.
|
|
CU_RunSummary to hold results of each test run.
|
|
Local variable holding the current error action code.
|
|
Local variable holding the current error code.
|
|
|
|
|