OSDN Git Service

add comment
[ccunit/ccunit.git] / src / ccunit / CCUnitTestCase.h
1 /* -*- mode: C; -*- */
2 /* Copyright (C) 2003 TSUTSUMI Kikuo.
3    This file is part of the CCUnit Library.
4
5    The CCUnit Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public License
7    as published by the Free Software Foundation; either version 2.1 of
8    the License, or (at your option) any later version.
9
10    The CCUnit Library is distributed in the hope that it will be
11    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the CCUnit Library; see the file COPYING.LESSER.
17    If not, write to the Free Software Foundation, Inc., 59 Temple
18    Place - Suite 330, Boston, MA 02111-1307, USA.  
19 */
20
21 /*
22  * $Id$
23  */
24
25 /** @file
26  * TestCase module.
27  */
28
29 #ifndef CCUNITTESTCASE_H
30 #define CCUNITTESTCASE_H
31
32 #include <CCUnit/CCUnitConfig.h>
33
34 /**
35  * @ingroup CCUnitTestFixture
36  * @defgroup CCUnitTestCase TestCase
37  *
38  * A single test object.
39  *
40  * This class is used to implement a simple test case.
41  *
42  * @{
43  */
44
45 /**
46  * A single test object.
47  *
48  * For each test implement a function which interacts with the
49  * case. Verify the expected results with assertions specified by
50  * calling CCUNIT_ASSERT on the expression you want to test:
51  * 
52  * @code
53  * void testAdd ()
54  * {
55  *   int result = value1 + value2;
56  *   CCUNIT_ASSERT (result == 5);
57  * }
58  *
59  * ...
60  *
61  * void MathTest_newTestCase_testAdd ()
62  * {
63  *   return ccunit_newTestCase ("addTest", "add test", addTest);
64  * }
65  * @endcode
66  *
67  * @see CCUnitTestFixture, CCUnitTestSuite, CCUintMakeSuite
68  * 
69  * @ingroup WritingTestFixture
70  */
71 typedef struct CCUnitTestCase
72 {
73   const char* name;                             /**< test case name */
74   const char* desc;                             /**< test description */
75   void (*runTest) ();                           /**< run test function */
76 } CCUnitTestCase;
77
78 /**
79  * Create new test case.
80  * @ingroup WritingTestFixture
81  * @param name case name.
82  * @param desc case description.
83  * @param runTest run test function.
84  * @return new test case
85  */
86 extern CCUnitTestCase* ccunit_newTestCase (const char* name,
87                                            const char* desc,
88                                            void (*runTest)());
89
90 /**
91  * Delete test case.
92  * @ingroup WritingTestFixture
93  * @param testCase deleting case.
94  */
95 extern void ccunit_deleteTestCase (CCUnitTestCase* testCase);
96
97 /** @} */
98
99 #endif  /* !CCUNITTESTCASE_H */