2 /* Copyright (C) 2003 TSUTSUMI Kikuo.
3 This file is part of the CCUnit Library.
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.
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.
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.
27 #ifndef CCUNITTESTSUITE_H
28 #define CCUNITTESTSUITE_H
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>
38 * @defgroup CCUnitTestSuite TestSuite
40 * A <code>Composite</code> class of Tests.
41 * It runs a collection of test cases.
46 * A <code>Composite</code> class of Tests.
47 * @ingroup CreatingTestSuite
48 * It runs a collection of test cases. Here is an example.
50 * CCUnitTestSuite* suite = ccunit_newTestSuite ();
51 * ccunit_addTestCase (suite, <var>TESTCASE_1</var>);
52 * ccunit_addTestCase (suite, <var>TESTCASE_2</var>);
54 * @see CCUnitTest, CCUnitTestCase.
56 typedef struct CCUnitTestSuite
58 CCUnitTest test; /**< super class */
59 const char* name; /**< test suite name */
60 CCUnitList tests; /**< added test case/suite list */
64 * Constructs an empty TestSuite.
65 * @ingroup CreatingTestSuite
66 * @param name test suite name.
67 * @return new test suite.
69 extern inline CCUnitTestSuite* ccunit_newTestSuite(const char* name);
72 * Destructs test suite.
73 * @ingroup CreatingTestSuite
74 * @param suite deleting suite.
76 extern inline void ccunit_deleteTestSuite (CCUnitTestSuite* suite);
79 * Adds a test to the suite.
80 * @ingroup CreatingTestSuite
81 * @param suite test suite.
82 * @param test test to add.
84 extern inline void ccunit_addTest (CCUnitTestSuite* suite, CCUnitTest* test);
87 * Adds a test suite to the suite.
88 * @ingroup CreatingTestSuite
89 * @param suite test suite.
90 * @param testSuite test to add.
92 extern inline void ccunit_addTestSuite (CCUnitTestSuite* suite,
93 CCUnitTestSuite* testSuite);
96 * Adds a test fixture to the suite.
97 * @ingroup CreatingTestSuite
98 * @param suite test suite.
99 * @param fixture test to add.
101 extern inline void ccunit_addTestFixture (CCUnitTestSuite* suite,
102 CCUnitTestFixture* fixture);
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.
110 extern inline CCUnitTestResult* ccunit_runTestSuite (CCUnitTestSuite* suite,
111 CCUnitTestResult* result);
114 * Create a test suite from test source file.
115 * @ingroup CreatingTestSuite
116 * @param name test suite name.
117 * @return new test suite.
119 extern CCUnitTestSuite* ccunit_suite (const char* name);