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.
24 #ifndef CCUNITTESTRESULT_H
25 #define CCUNITTESTRESULT_H
27 #include <ccunit/CCUnitConfig.h>
28 #include <ccunit/CCUnitList.h>
29 #include <ccunit/CCUnitFailure.h>
30 #include <ccunit/CCUnitTestListener.h>
31 #include <ccunit/CCUnitTestCase.h>
34 * collects the results of a test case.
38 typedef struct CCUnitTestResult
40 CCUnitList failures; /**< failure objects */
41 CCUnitList listeners; /**< testCase objects */
42 size_t runCount; /**< number of run test */
43 bool shouldStop; /**< test run should stop flag */
46 /** Construct TestResult */
47 extern CCUnitTestResult* ccunit_newTestResult ();
49 /** Destruct TestResult */
50 extern void ccunit_deleteTestResult (CCUnitTestResult* result);
53 * Adds a failure to the list of failures. The passed in failed
54 * assertion caused the failure.
56 extern void ccunit_addFailure (CCUnitTestResult* result,
57 struct CCUnitFailure* failure);
60 * Registers a TestRunner as TestListener.
62 extern inline void ccunit_addResultListener (CCUnitTestResult* result,
63 CCUnitTestListener* listener);
68 * @param testCase test case to be run.
70 extern void ccunit_runResult (CCUnitTestResult* result,
71 struct CCUnitTestCase* testCase);
74 * Returns an Iterator for the failures.
76 extern inline CCUnitListIterator* ccunit_failures(CCUnitTestResult* result);
79 * Gets the number of detected failures.
81 extern inline size_t ccunit_failureCount (CCUnitTestResult* result);
84 * Returns whether the entire test was successful or not.
86 extern inline bool ccunit_wasSuccessful (CCUnitTestResult* result);
89 * Gets the number of run tests.
91 extern inline size_t ccunit_runCount (CCUnitTestResult* result);