OSDN Git Service

The convenient function to make TestSuite run was added.
[ccunit/ccunit.git] / src / ccunit / CCUnitTestSuite.h
1 /* -*- 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 /** @file
25  * TestSuite module.
26  */
27 #ifndef CCUNITTESTSUITE_H
28 #define CCUNITTESTSUITE_H
29
30 #include <ccunit/CCUnitConfig.h>
31 #include <ccunit/CCUnitList.h>
32 #include <ccunit/CCUnitTest.h>
33 #include <ccunit/CCUnitTestFixture.h>
34 #include <ccunit/CCUnitTestResult.h>
35
36 /**
37  * @ingroup CCUnitTest
38  * @defgroup CCUnitTestSuite TestSuite
39  *
40  * A <code>Composite</code> class of Tests.
41  * It runs a collection of test cases.
42  * @{
43  */
44
45 /**
46  * A <code>Composite</code> class of Tests.
47  * @ingroup CreatingTestSuite
48  * It runs a collection of test cases. Here is an example.
49  * <pre>
50  *     CCUnitTestSuite* suite = ccunit_newTestSuite ();
51  *     ccunit_addTestCase (suite, <var>TESTCASE_1</var>);
52  *     ccunit_addTestCase (suite, <var>TESTCASE_2</var>);
53  * </pre>
54  * @see CCUnitTest, CCUnitTestCase.
55  */
56 typedef struct CCUnitTestSuite
57 {
58   CCUnitTest test;                  /**< super class */
59   const char* name;                 /**< test suite name */
60   CCUnitList tests;                 /**< added test case/suite list */
61 } CCUnitTestSuite;
62
63 /**
64  * Constructs an empty TestSuite.
65  * @ingroup CreatingTestSuite
66  * @param name test suite name.
67  * @return new test suite.
68  */
69 extern inline CCUnitTestSuite* ccunit_newTestSuite(const char* name);
70
71 /**
72  * Destructs test suite.
73  * @ingroup CreatingTestSuite
74  * @param suite deleting suite.
75  */
76 extern inline void ccunit_deleteTestSuite (CCUnitTestSuite* suite);
77
78 /**
79  * Adds a test to the suite.
80  * @ingroup CreatingTestSuite
81  * @param suite test suite.
82  * @param test test to add.
83  */
84 extern inline void ccunit_addTest (CCUnitTestSuite* suite, CCUnitTest* test);
85
86 /**
87  * Adds a test suite to the suite.
88  * @ingroup CreatingTestSuite
89  * @param suite test suite.
90  * @param testSuite test to add.
91  */
92 extern inline void ccunit_addTestSuite (CCUnitTestSuite* suite,
93                                         CCUnitTestSuite* testSuite);
94
95 /**
96  * Adds a test fixture to the suite.
97  * @ingroup CreatingTestSuite
98  * @param suite test suite.
99  * @param fixture test to add.
100  */
101 extern inline void ccunit_addTestFixture (CCUnitTestSuite* suite,
102                                           CCUnitTestFixture* fixture);
103
104 /**
105  * run test suite and collect its results.
106  * @param suite test suite.
107  * @param result test result. if NULL, create a new result object and return it.
108  * @return test result.
109  */
110 extern inline CCUnitTestResult* ccunit_runTestSuite (CCUnitTestSuite* suite,
111                                                      CCUnitTestResult* result);
112
113 /**
114  * Create a test suite from test source file.
115  * @ingroup CreatingTestSuite
116  * @param name test suite name.
117  * @return new test suite.
118  */
119 extern CCUnitTestSuite* ccunit_suite (const char* name);
120
121 /** @} */
122 #endif