CCUnit  2.1
A C Unit Testing Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions
Creating TestSuite
Collaboration diagram for Creating TestSuite:

Data Structures

struct  CCUnitTestSuite
 A Composite class of Tests. More...

Typedefs

typedef struct CCUnitTestSuite CCUnitTestSuite
 A Composite class of Tests.

Functions

CCUnitTestSuiteccunit_suite (const char *name)
 Create a test suite from test source file.
int main (int ac, char **av)
 To generate a test suite making source code.
int ccunit_makeSuite (int ac, char **av)
 Generate a code to creating test suite code from the test func source codes.
int ccunit_va_makeSuite (const char *prg,...)
 Generate a code to creating test suite code from the test func source codes.
CCUnitTestSuiteccunit_newTestSuite (const char *name)
 Constructs an empty TestSuite.
void ccunit_deleteTestSuite (CCUnitTestSuite *suite)
 Destructs test suite.
void ccunit_addTest (CCUnitTestSuite *suite, CCUnitTest *test)
 Adds a test to the suite.
void ccunit_addTestSuite (CCUnitTestSuite *suite, CCUnitTestSuite *testSuite)
 Adds a test suite to the suite.
void ccunit_addTestCase (CCUnitTestSuite *suite, CCUnitTestCase *testCase)
 Adds a test case to the suite.

Detailed Description

See also:
MakeSuite

Typedef Documentation

A Composite class of Tests.

It runs a collection of test case or suite. Here is an example.

CCUnitTestSuite* suite = ccunit_newTestSuite ("a test suite");
ccunit_addTestCase (suite, TESTCASE);
ccunit_addTestSuite (suite, TESTSUITE);
See also:
CCUnitTest, CCUnitTestCase.

Function Documentation

void ccunit_addTest ( CCUnitTestSuite suite,
CCUnitTest test 
)
inline

Adds a test to the suite.

Parameters:
suitetest suite.
testtest to add.

References ccunit_addList(), and CCUnitTestSuite::tests.

Referenced by ccunit_addTestCase(), and ccunit_addTestSuite().

Here is the call graph for this function:

Here is the caller graph for this function:

void ccunit_addTestCase ( CCUnitTestSuite suite,
CCUnitTestCase testCase 
)
inline

Adds a test case to the suite.

Parameters:
suitetest suite.
testCasetest case to add.

References ccunit_addTest(), and CCUnitTestCase::test.

Referenced by ccunit_newTestSuiteFromDfn().

Here is the call graph for this function:

Here is the caller graph for this function:

void ccunit_addTestSuite ( CCUnitTestSuite suite,
CCUnitTestSuite testSuite 
)
inline

Adds a test suite to the suite.

Parameters:
suitetest suite.
testSuitetest to add.

References ccunit_addTest(), and CCUnitTestSuite::test.

Referenced by ccunit_newTestSuiteFromDfn().

Here is the call graph for this function:

Here is the caller graph for this function:

void ccunit_deleteTestSuite ( CCUnitTestSuite suite)
inline

Destructs test suite.

Parameters:
suitedeleting suite.

References ccunit_deleteTest(), and CCUnitTestSuite::test.

Here is the call graph for this function:

int ccunit_makeSuite ( int  ac,
char **  av 
)

Generate a code to creating test suite code from the test func source codes.

Parameters:
acarg count.
avarray of arg string.
av[] = { PRORGNAME, [OPTIONS]..., FILES... }
OPTIONS:
--output OUTFILE
-o OUTFILE
output file name (default stdout)
--function FUNCTION
-f FUNCTION
creating function name
--verbose
-v
output verbose message
--debug
-d
output debug message
--version
-V
print version
--help
-h
print this message
FILES: the special name '-' means input from stdin.

To generate a code, the test case source codes must be formatted by following pseudo-BNF:

SOURCEFILE ::= SUITE... | TESTCASE...
SUITE ::= SUITE_HEADER
[ any-C-code ]...
TESTCASE...
SUITE_END
SUITE_HEADER ::= JAVADOC_COMMENT_BEGIN 'test suite:' SUITE_NAME COMMENT_END
SUITE_END ::= JAVADOC_COMMENT_BEGIN 'end test suite' wsp string COMMENT_END
TESTCASE ::= TESTCASE_HEADER
[TESTCASE_CODE]...
[TESTFUNC]...
TESTCASE_END
TESTCASE_HEADER ::= JAVADOC_COMMENT_BEGIN
'test case:' TESTCASE_NAME
COMMENT_END
TESTCASE_CODE ::= any C language codes.
TESTFUNC ::= [ FUNC_DESC ] 'void ' FUNC_PREFIX[A-Za-z0-9_]* '()' FUNC_BODY
FUNC_PREFIX ::= 'test' | 'setUp' | 'tearDown' |
'setUpBeforeClass' | 'tearDownAfterClass'
TESTCASE_END ::= JAVADOC_COMMENT_BEGIN 'end test case ' [string] COMMENT_END
FUNC_DESC ::= JAVADOC_COMMENT_BEGIN string COMMENT_END
FUNC_BODY ::= '{' C language codes... '}'
JAVADOC_COMMENT_BEGIN ::= '/' '*' '*'
COMMENT_END ::= '*' '/'

Returns:
0 if succeeded, else error occured.

References _ccunit_debug_message, _ccunit_verbose_message, ccunit_deleteTestSuiteDef(), ccunit_err(), ccunit_newTestSuiteDef(), ccunit_printSuite(), ccunit_readSuite(), DIRSEP, SETVBUF, and usage().

Referenced by ccunit_va_makeSuite(), and main().

Here is the call graph for this function:

Here is the caller graph for this function:

CCUnitTestSuite * ccunit_newTestSuite ( const char *  name)
inline

Constructs an empty TestSuite.

Parameters:
nametest suite name.
Returns:
new test suite.

References ccunit_initList(), ccunit_initTest(), ccunitTypeSuite, destroy(), CCUnitTestSuite::name, run(), safe_strdup, CCUnitTestSuite::test, and CCUnitTestSuite::tests.

Referenced by ccunit_newTestSuiteFromDfn().

Here is the call graph for this function:

Here is the caller graph for this function:

CCUnitTestSuite* ccunit_suite ( const char *  name)

Create a test suite from test source file.

Parameters:
nametest suite name.
Returns:
new test suite.
int ccunit_va_makeSuite ( const char *  prg,
  ... 
)

Generate a code to creating test suite code from the test func source codes.

Parameters:
prgprogram name
...arguments. The last arg must be NULL.
Returns:
0 if succeeded, else error occured.
See also:
ccunit_makeSuite

References ccunit_makeSuite().

Here is the call graph for this function:

int main ( int  ac,
char **  av 
)

To generate a test suite making source code.

See also:
ccunit_makeSuite

References ccunit_makeSuite().

Here is the call graph for this function:

SourceForge.jp hosts this site. Send comments to: CCUnit Developer