/**
* receive startTest notification.
* @param listener notification listener.
- * @param fixture starting test fixture
+ * @param test starting test case
*/
static void startTest (CCUnitTestListener* listener, CCUnitTestCase* test)
{
/**
* receive endTest notification.
* @param listener notification listener.
- * @param fixture end test fixture
+ * @param test ended test case
*/
static void endTest (CCUnitTestListener* listener, CCUnitTestCase* test)
{
/**
* Prints the header of the report.
+ * @param runner test runner.
+ * @param result test result.
*/
static void printHeader (CCUnitTestRunner* runner, CCUnitTestResult* result)
{
/**
* Prints failures.
+ * @param runner test runner.
+ * @param result test result.
*/
static void printFailures (CCUnitTestRunner* runner, CCUnitTestResult* result)
{
itor = ccunit_failures (result);
while ((f = ccunit_nextListIterator (itor)) != NULL)
{
- const char* str = f->toString (f);
- fprintf (runner->ofp, "%s", str);
- safe_free ((char*)str);
+ fprintf (runner->ofp, "%s:%u: %s:\n\t%s\n",
+ f->file, f->line,
+ f->testCase != NULL ? f->testCase->desc : "",
+ f->condstr);
+ if (f->expect || f->actual)
+ fprintf (runner->ofp, "\texpect: %s\n\tactual: %s\n", f->expect, f->actual);
}
ccunit_deleteListIterator (itor);
}
/**
* Prints failures.
+ * @param runner test runner
+ * @param result test result
*/
static inline void print (CCUnitTestRunner* runner, CCUnitTestResult* result)
{
/**
* Runs a single test and collects its results.
+ * @param runner test runner
+ * @param suite test suite
+ * @return 0 if succeeded. -1 if error occurd.
*/
static int doRun (CCUnitTestRunner* runner, CCUnitTestSuite* suite)
{
timerclear (&endTime);
timerclear (&runTime);
gettimeofday (&startTime, NULL);
- suite->test.run (&suite->test, runner->result);
+ ccunit_runTestSuite (suite, runner->result);
gettimeofday (&endTime, NULL);
timersub (&endTime, &startTime, &runTime);
fprintf (runner->ofp,
free (runner);
}
+inline int ccunit_runTestRunner (CCUnitTestRunner* runner, CCUnitTestSuite* suite)
+{
+ return runner->run (runner, suite);
+}
+
+inline CCUnitTestResult* ccunit_getResult (CCUnitTestRunner* runner)
+{
+ return runner->result;
+}
+
/** @} */