[ CCUnit project page ] [ CCUnit home page ]
Data Fields

CCUnitTestFunc Struct Reference
[TestFuncWriting Test Case]

A single test function object. More...

#include <CCUnitTestFunc.h>

Data Fields

const char * name
 test func name
const char * desc
 test description
void(* runTest )()
 run test function

Detailed Description

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:

 void testAdd ()
 {
   int result = value1 + value2;
   CCUNIT_ASSERT (result == 5);
 }

 ...
 int main ()
 {
   CCUnitTestResult* r;
   CCUnitTestCase* c = ccunit_newTestCase ("math test");
   CCUnitTestFunc* f = ccunit_newTestFunc ("testAdd", "add test", testAdd);
   ccunit_addTestFunc (c, f);
   r = ccunit_runTestCase (c);
   return 0;
 }
See also:
CCUnitTestCase, CCUnitTestSuite, MakeSuite

Field Documentation

const char* CCUnitTestFunc::desc

test description

Referenced by printFailures().

const char* CCUnitTestFunc::name

test func name

Referenced by ccunit_addTestFunc().

run test function

Referenced by run(), and runTest().


The documentation for this struct was generated from the following file:
SourceForge.jp hosts this site. Send comments to: CCUnit Developer