longjmp (_ccunit_runTest_env, (int)f);
}
+/**
+ * @defgroup CCUnitValueToString ToString
+ * Make value to string.
+ * @{
+ */
+
+/**
+ * @name ccunit_assert_format_TYPE
+ * snprintf format string for each types.
+ * @{
+ */
const char* _ccunit_assert_format_char = "%c";
const char* _ccunit_assert_format_u_char = "%c";
const char* _ccunit_assert_format_int = "%d";
const char* _ccunit_assert_format__ccunit_ptr_t = "%p";
const char* _ccunit_assert_format_quad_t = "%lld";
const char* _ccunit_assert_format_u_quad_t = "%llu";
+/** @} */
+/** @name DEF_VALUE_TO_STRING
+ * Make value to string.
+ * @param TYP type of value.
+ * @param CAPACITY string size.
+ * @{
+ */
#define DEF_VALUE_TO_STRING(TYP, CAPACITY) \
static char* TYP ## _to_string (TYP value) \
{ \
DEF_VALUE_TO_STRING(_ccunit_str_t, 32);
DEF_VALUE_TO_STRING(_ccunit_ptr_t, 24);
+/** @}
+ * end of DEF_VALUE_TO_STRING
+ */
+
+/** @}
+ * end of CCUnitValueToString
+ */
+
+/**
+ * @name AssertTest
+ * @{
+ * Assert test function.
+ * @param TYP type of test value.
+ */
#define DEF_CCUNIT_ASSERT_TEST_TYPE(TYP) \
void ccunit_assert_test_ ## TYP (const char* file, \
unsigned int line, \
DEF_CCUNIT_ASSERT_TEST_TYPE(_ccunit_ptr_t);
/** @} */
+
+/** @} */
#endif
/**
+ * @ingroup ModuleHierarchy
* @defgroup CCUnitAssert Assert
*
* A set of assert functions and macros. Messages are only displayed
*/
/**
+ * @ingroup Assertions
* Asserts that a condition is true. If it isn't it longjmp with
* _ccunit_runTest_env.
*
extern void ccunit_assert (const char* file, unsigned int line,
bool condition, const char* condstr);
+#ifndef HAVE_U_CHAR
+typedef unsigned char u_char; /**< u_char */
+#endif
+#ifndef HAVE_U_INT
+typedef unsigned int u_int; /**< u_int */
+#endif
+#ifndef HAVE_U_SHORT
+typedef unsigned short u_short; /**< u_short */
+#endif
+#ifndef HAVE_U_LONG
+typedef unsigned long u_long; /**< u_long */
+#endif
+
+typedef const char* _ccunit_str_t; /**< string type */
+typedef const void* _ccunit_ptr_t; /**< pointer type */
+
/**
+ * @name DCL_CCUNIT_ASSERT_TEST_TYPE
+ * @{
+ * @ingroup Assertions
* Asserts that a condition is true. If it isn't it longjmp with
* _ccunit_runTest_env.
*
DCL_CCUNIT_ASSERT_TEST_TYPE(u_quad_t);
#endif
+/** @} */
+
/**
+ * @ingroup Assertions
* Asserts that a condition is true. If it isn't it longjmp with
* _ccunit_runTest_env.
*
/** @name Assert Macros
* The assert test macros.
+ * @ingroup Assertions
* @{
*/
/**
do { \
const TYP ex = EXPECT; \
const TYP ac = ACTUAL; \
- _CCUNIT_CONCAT(ccunit_assert_test_,TYP) (__FILE__, __LINE__, ex OP ac, \
- (#EXPECT " " #OP " " #ACTUAL), \
- ex, ac); \
+ ccunit_assert_test_ ## TYP (__FILE__, __LINE__, ex OP ac, \
+ (#EXPECT " " #OP " " #ACTUAL), ex, ac); \
} while (0)
#define CCUNIT_ASSERT_TEST_INT(EXPECT, OP, ACTUAL) \
CCUNIT_ASSERT_TEST (u_quad_t, EXPECT, OP, ACTUAL)
#endif
#define CCUNIT_ASSERT_TEST_PTR(EXPECT, OP, ACTUAL) \
- CCUNIT_ASSERT_TEST (ccunit_ptr_t, EXPECT, OP, ACTUAL)
+ CCUNIT_ASSERT_TEST (_ccunit_ptr_t, EXPECT, OP, ACTUAL)
#define CCUNIT_ASSERT_TEST_STR(EXPECT, OP, ACTUAL) \
do { \
- const ccunit_str_t ex = EXPECT; \
- const ccunit_str_t ac = ACTUAL; \
- const ccunit_str_t condstr = "strcmp (" #EXPECT ", " #ACTUAL ") " #OP " 0"; \
- ccunit_assert_test_ccunti_str_t (__FILE__, __LINE__, \
- strcmp(ex, ac) OP 0, condstr, ex, ac); \
+ _ccunit_str_t ex = EXPECT; \
+ _ccunit_str_t ac = ACTUAL; \
+ const char* condstr = "strcmp (" #EXPECT ", " #ACTUAL ") " #OP " 0"; \
+ ccunit_assert_test__ccunit_str_t (__FILE__, __LINE__, \
+ strcmp(ex, ac) OP 0, condstr, ex, ac); \
} while (0)
/** @} */
/** @name Assert Condition Macros
* The assert condition macros.
+ * @ingroup Assertions
* @{
*/
#define CCUNIT_ASSERT_NULL(ACTUAL) \
#endif
/**
+ * @ingroup ModuleHierarchy
* @defgroup CCUnitList List
* Linked list container.
* @{
#include <ccunit/CCUnitConfig.h>
/**
+ * @ingroup ModuleHierarchy
* @defgroup CCUnitLogMessage LogMessage
* Output messages.
* @{
#include <stdio.h>
/**
+ * @ingroup ModuleHierarchy
* @defgroup CCUnitMakeSuite MakeSuite
* Generate test suite making code from test source code.
* @{
/** @} */
/**
- * generate test suite making function code.
+ * Generate test suite making function code.
+ * @ingroup CreatingTestSuite
* @param ac arg count.
* @param av array of arg string.
* @return 0 if succeeded, else error occured.
extern int ccunit_makeSuite (int ac, char** av);
/**
- * generate test suite making function code.
+ * Generate test suite making function code.
+ * @ingroup CreatingTestSuite
* @param prg program name
* @param ... arguments. The last arg must be NULL.
* @return 0 if succeeded, else error occured.
+ * @see ccunit_makeSuite
*/
extern int ccunit_va_makeSuite (const char* prg, ...);
#include <ccunit/CCUnitConfig.h>
/**
+ * @ingroup ModuleHierarchy
* @defgroup CCUnitTest Test
* Test interface module.
* @{
*/
-
/**
* Test class type.
+ * @ingroup BrowsingCollectedTestResult
*/
typedef enum CCUnitTestType_t {
ccunitTypeTest, /**< Test class */
/**
* run Test and collect its results.
+ * @ingroup BrowsingCollectedTestResult
*
* @see CCUnitTestResult
*/
typedef struct CCUnitTest CCUnitTest;
/**
+ * @ingroup BrowsingCollectedTestResult
* run test function pointer type.
*/
typedef void (*ccunit_runtest_func_t) (CCUnitTest* test,
struct CCUnitTestResult* result);
/**
+ * @ingroup BrowsingCollectedTestResult
* test destructor function pointer type.
*/
typedef void (*ccunit_testdtor_t) (CCUnitTest* dt);
/**
+ * @ingroup BrowsingCollectedTestResult
* Run Test and collect its results.
*
* @see CCUnitTestResult
};
/**
+ * @ingroup BrowsingCollectedTestResult
* Initialize Test class.
* @param test test object to initialize.
* @param type test type.
ccunit_testdtor_t dtor);
/**
+ * @ingroup BrowsingCollectedTestResult
* Test class destructor.
* @param test test object to delete.
*/
/**
* A single test object.
+ * @ingroup WritingTestFixture
*/
typedef struct CCUnitTestCase
{
} CCUnitTestCase;
/**
- * create new test case.
+ * Create new test case.
+ * @ingroup WritingTestFixture
* @param name case name.
* @param desc case description.
* @param runTest run test function.
void (*runTest)());
/**
- * delete test case.
+ * Delete test case.
+ * @ingroup WritingTestFixture
* @param testCase deleting case.
*/
extern void ccunit_deleteTestCase (CCUnitTestCase* testCase);
#include <ccunit/CCUnitConfig.h>
/**
+ * @ingroup ModuleHierarchy
* @defgroup CCUnitTestFailure TestFailure
*
* Collects a failed test together with the failed assertion.
/**
* Collects a failed test together with the failed assertion.
+ * @ingroup BrowsingCollectedTestResult
* @see TestResult
*/
typedef struct CCUnitTestFailure CCUnitTestFailure;
/**
* Collects a failed test together with the failed assertion.
+ * @ingroup BrowsingCollectedTestResult
* @see TestResult
*/
struct CCUnitTestFailure
};
/**
- * create new test failure.
+ * Create new test failure.
+ * @ingroup BrowsingCollectedTestResult
*
* @param file file name cause failure.
* @param line line number cause failure.
const char* actual);
/**
- * delete test failure object.
+ * Delete test failure object.
+ * @ingroup BrowsingCollectedTestResult
*
* @param failure failure object.
*/
/**
* @ingroup CCUnitTest
* @defgroup CCUnitTestFixture TestFixture
+ * A test fixture defines the fixture to run multiple tests.
*
+ * @{
+ */
+
+/**
* Wraps a test case with setUp and tearDown methods.
*
+ * @ingroup WritingTestFixture
+ *
* A TestCase is used to provide a common environment for a set
* of test cases.
*
* in src/tools/ccunit_makeSuite.c.
*
* @see CCUnitTestResult, CCUnitTestSuite, CCUnitMakeSuite,
- * @{
- */
-
-/**
- * A test fixture defines the fixture to run multiple tests.
- *
- * @see CCUnitTestResult, CCUnitTestSuite, CCUnitMakeSuite.
*/
typedef struct CCUnitTestFixture
{
/**
* create new test fixture.
+ * @ingroup WritingTestFixture
*
* @param name test fixture name.
* @param setUp test fixture setUp function.
/**
* add new test case to test fixture.
+ * @ingroup WritingTestFixture
*
* @param fixture test fixture.
* @param name test case name.
#include <ccunit/CCUnitTestFixture.h>
/**
+ * @ingroup ModuleHierarchy
* @defgroup CCUnitTestListener TestListener
* A Listener for test progress.
*
/**
* A Listener for test progress.
+ * @ingroup TrackingTestExecution
+ *
+ * Implementing the Observer pattern a CCUnitTestListener may be
+ * registered to a CCUnitTestResult to obtain information on the
+ * testing progress. Use specialized sub classes of CCUnitTestListener
+ * for text output.
+ *
+ * @see CCUnitTestResult
*/
typedef struct CCUnitTestListener CCUnitTestListener;
/**
* A Listener for test progress.
+ * @ingroup TrackingTestExecution
*/
struct CCUnitTestListener
{
#include <ccunit/CCUnitTestCase.h>
/**
+ * @ingroup ModuleHierarchy
* @defgroup CCUnitTestResult TestResult
* Collects the results of a test case module.
*
*/
/**
- * collects the results of a test case.
+ * Collects the results of a test case.
+ * @ingroup TrackingTestExecution
+ *
+ * This module use a CCUnitTestListener to be informed of the ongoing
+ * tests.
*
* @see CCUnitTest, CCUnitTestListener.
*/
/**
* Construct TestResult
+ * @ingroup TrackingTestExecution
*/
extern CCUnitTestResult* ccunit_newTestResult ();
/**
* Destruct TestResult
+ * @ingroup TrackingTestExecution
* @param result result object.
*/
extern void ccunit_deleteTestResult (CCUnitTestResult* result);
/**
- * Adds a failure to the list of failures. The passed in failed
- * assertion caused the failure.
+ * Adds a failure to the list of failures.
+ * @ingroup TrackingTestExecution
+ * The passed in failed assertion caused the failure.
* @param result result object.
* @param failure failure.
*/
/**
* Registers a TestRunner as TestListener.
+ * @ingroup TrackingTestExecution
* @param result result object.
* @param listener adding listener.
*/
/**
* Returns an Iterator for the failures.
+ * @ingroup TrackingTestExecution
* @param result result object.
*/
extern inline CCUnitListIterator* ccunit_failures(CCUnitTestResult* result);
/**
* Gets the number of detected failures.
+ * @ingroup TrackingTestExecution
* @param result result object.
*/
extern inline size_t ccunit_failureCount (CCUnitTestResult* result);
/**
* Returns whether the entire test was successful or not.
+ * @ingroup TrackingTestExecution
* @param result result object.
*/
extern inline bool ccunit_wasSuccessful (CCUnitTestResult* result);
/**
* Marks that the test run should stop.
+ * @ingroup TrackingTestExecution
* @param result result object.
*/
extern inline void ccunit_stopTest (CCUnitTestResult* result);
/**
* Gets the number of run tests.
+ * @ingroup TrackingTestExecution
* @param result result object.
*/
extern inline size_t ccunit_runCount (CCUnitTestResult* result);
/**
* @ingroup CCUnitTestListener
* @defgroup CCUnitTestRunner TestRunner
+ * Runs a single test and collects its results. This method can be
+ * used to start a test run from your program.
+ * @{
+ */
+
+/**
+ * @ingroup ExecutingTest
* A command line based tool to run tests. Runs a single test and
* collects its results. This method can be used to start a test run
* from your program.
* return runner->run (runner, suite);
* }
* </pre>
- * @{
- */
-
-/**
- * Runs a single test and collects its results. This method can be
- * used to start a test run from your program.
*
* @see CCUnitTestSuite, CCUnitTestCase.
*/
};
/**
+ * @ingroup ExecutingTest
* constructor.
* @param output prints test result into this stream.
* @return new CCUnitTestRunner object.
extern CCUnitTestRunner* ccunit_newTestRunner (FILE* output);
/**
+ * @ingroup ExecutingTest
* destructor.
* @param runner TestRunner object to destruct.
*/
-/* -*- mode: C; -*- */
+/* -*- C -*- */
/* Copyright (C) 2003 TSUTSUMI Kikuo.
This file is part of the CCUnit Library.
* @defgroup CCUnitTestSuite TestSuite
*
* A <code>Composite</code> class of Tests.
+ * It runs a collection of test cases.
+ * @{
+ */
+
+/**
+ * A <code>Composite</code> class of Tests.
+ * @ingroup CreatingTestSuite
* It runs a collection of test cases. Here is an example.
* <pre>
* CCUnitTestSuite* suite = ccunit_newTestSuite ();
* ccunit_addTestCase (suite, <var>TESTCASE_1</var>);
* ccunit_addTestCase (suite, <var>TESTCASE_2</var>);
* </pre>
- * @{
- */
-
-/**
- * A <code>Composite</code> class of Tests.
- * It runs a collection of test cases.
* @see CCUnitTest, CCUnitTestCase.
*/
typedef struct CCUnitTestSuite
/**
* Constructs an empty TestSuite.
+ * @ingroup CreatingTestSuite
* @param name test suite name.
* @return new test suite.
*/
/**
* Destructs test suite.
+ * @ingroup CreatingTestSuite
* @param suite deleting suite.
*/
extern inline void ccunit_deleteTestSuite (CCUnitTestSuite* suite);
/**
* Adds a test to the suite.
+ * @ingroup CreatingTestSuite
* @param suite test suite.
* @param test test to add.
*/
/**
* Adds a test suite to the suite.
+ * @ingroup CreatingTestSuite
* @param suite test suite.
* @param testSuite test to add.
*/
/**
* Adds a test fixture to the suite.
+ * @ingroup CreatingTestSuite
* @param suite test suite.
* @param fixture test to add.
*/
/**
* Create a test suite from test source file.
+ * @ingroup CreatingTestSuite
* @param name test suite name.
* @return new test suite.
*/
*/
#include <ccunit/CCUnitConfig.h>
-/** @defgroup CCUnitVersion Version
+/**
+ * @defgroup CCUnitVersion Version
* ccunit library version string definitions.
+ * @ingroup ModuleHierarchy
* @{
*/
-/** package name */
+/**
+ * package name
+ * @ingroup ModuleHierarchy
+ */
const char* const _ccunit_package_name = PACKAGE_NAME;
-/** package version */
+/**
+ * package version
+ * @ingroup ModuleHierarchy
+ */
const char* const _ccunit_package_version = PACKAGE_VERSION;
/** @} */