CCUnit
2.1
A C Unit Testing Library
|
![]() |
Data Structures | |
struct | CCUnitTestCase |
Wraps a test case with setUp and tearDown function. More... | |
struct | CCUnitTestFunc |
A single test function object. More... |
Typedefs | |
typedef struct CCUnitTestCase | CCUnitTestCase |
Wraps a test case with setUp and tearDown function. | |
typedef struct CCUnitTestFunc | CCUnitTestFunc |
A single test function object. |
Functions | |
CCUnitTestCase * | ccunit_newTestCase (const char *name) |
create new test case. | |
void | ccunit_deleteTestCase (CCUnitTestCase *testCase) |
Destructs test case. | |
void | ccunit_addTestFunc (CCUnitTestCase *testCase, CCUnitTestFunc *f) |
add test function to test case. | |
CCUnitTestFunc * | ccunit_addNewTestFunc (CCUnitTestCase *testCase, const char *name, const char *desc, void(*runTest)()) |
add new test func to test case. | |
CCUnitTestFunc * | ccunit_newTestFunc (const char *name, const char *desc, void(*runTest)()) |
Create new test function. | |
void | ccunit_deleteTestFunc (CCUnitTestFunc *f) |
Delete test function. |
typedef struct CCUnitTestCase CCUnitTestCase |
Wraps a test case with setUp and tearDown function.
A TestCase is used to provide a common environment for a set of test cases.
To define a test case, do the following:
Each test runs in its own case so there can be no side effects among test runs. Here is an example:
For each test implement a function which interacts with the case. Verify the expected results with assertions specified by calling CCUNIT_ASSERT on the expression you want to test:
The tests to be run can be collected into a TestSuite.
Once the functions are defined you can run them. To do this, use a TestRunner.
A command line tool have been created for convenience. It is located in src/tools/ccunit_makeSuite.c.
typedef struct CCUnitTestFunc CCUnitTestFunc |
A single test function object.
For each test implement a function which interacts with the case. Verify the expected results with assertions specified by calling CCUNIT_ASSERT on the expression you want to test:
CCUnitTestFunc* ccunit_addNewTestFunc | ( | CCUnitTestCase * | testCase, |
const char * | name, | ||
const char * | desc, | ||
void(*)() | runTest | ||
) |
add new test func to test case.
testCase | test case. |
name | test case name. |
desc | test case description. |
runTest | run test function. |
References ccunit_addTestFunc(), ccunit_newTestFunc(), and runTest().
Referenced by ccunit_newTestSuiteFromDfn().
void ccunit_addTestFunc | ( | CCUnitTestCase * | testCase, |
CCUnitTestFunc * | f | ||
) |
add test function to test case.
testCase | test case. |
f | test function. |
References ccunit_addList(), ccunit_deleteTestFunc(), CCUnitTestFunc::name, CCUnitTestCase::setUp, CCUnitTestCase::setUpBeforeClass, CCUnitTestCase::tearDown, CCUnitTestCase::tearDownAfterClass, and CCUnitTestCase::testFuncs.
Referenced by ccunit_addNewTestFunc().
|
inline |
Destructs test case.
testCase | deleting case. |
References ccunit_deleteTest(), and CCUnitTestCase::test.
|
inline |
Delete test function.
f | deleting function. |
References CCUnitTestFunc::desc, CCUnitTestFunc::name, and safe_free.
Referenced by ccunit_addTestFunc(), and destroy().
CCUnitTestCase* ccunit_newTestCase | ( | const char * | name | ) |
create new test case.
name | test case name. |
References ccunit_initList(), ccunit_initTest(), ccunitTypeTestCase, destroy(), CCUnitTestCase::name, run(), safe_strdup, CCUnitTestCase::test, and CCUnitTestCase::testFuncs.
Referenced by ccunit_newTestSuiteFromDfn().
CCUnitTestFunc * ccunit_newTestFunc | ( | const char * | name, |
const char * | desc, | ||
void(*)() | runTest | ||
) |
Create new test function.
name | function name. |
desc | function description. |
runTest | run test function. |
References CCUnitTestFunc::desc, CCUnitTestFunc::name, CCUnitTestFunc::runTest, runTest(), and safe_strdup.
Referenced by ccunit_addNewTestFunc().
|
hosts this site. | Send comments to: CCUnit Developer |
Generated on Sat Jul 13 2013 15:09:16 for CCUnit by
![]() |