1 /* -*- Indented-Text -*- */
2 /* Copyright (C) 2003, 2010 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, see <http://www.gnu.org/licenses/>
23 CCUnit is a simple framework to write repeatable tests with C language.
26 [see also <a href="../ja/index.html">Japanese</a> documents]
29 CCUnit ¤Ï C ¸À¸ì¤Ç·«¤êÊÖ¤·²Äǽ¤Ê¥Æ¥¹¥È¤ò½ñ¤¯¤¿¤á¤Î´Êñ¤Ê¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤¹¡£
32 [see also <a href="../../index.html">English</a> documents]
37 @section _installation Installation
39 @section _installation ¥¤¥ó¥¹¥È¡¼¥ë
43 Below are the installation steps for installing CCUnit:
45 °Ê²¼¤Ë CCUnit¤ò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¼ê½ç¤ò¼¨¤·¤Þ¤¹¡£
50 <li>expand the archive file.</li>
51 <li>cd to expanded dir. </li>
52 <li>run the `<code>./configure</code>' file. </li>
53 <li>type <code>make</code> to create ccunit library. </li>
54 <li>type <code>make install</code> to install.</li>
58 <li>¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤òŸ³«¤·¤Þ¤¹¡£</li>
59 <li>Ÿ³«¤·¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Ëcd¤·¤Þ¤¹¡£</li>
60 <li>`<code>./configure</code>' ¥Õ¥¡¥¤¥ë¤ò¼Â¹Ô¤·¤Þ¤¹¡£</li>
61 <li><code>make</code> ¤È¥¿¥¤¥×¤·¤Æ ccunit ¥é¥¤¥Ö¥é¥ê¤òºîÀ®¤·¤Þ¤¹¡£</li>
62 <li><code>make install</code> ¤È¤·¤Æ¥¤¥ó¥¹¥È¡¼¥ë¤·¤Þ¤¹¡£</li>
67 @section _usage Getting Started
69 @section _usage ¤µ¤¢»Ï¤á¤Þ¤·¤ç¤¦
73 <a href="modules.html">Modules</a> give
74 you a organized view of %CCUnit modules.
76 <a href="modules.html">¥â¥¸¥å¡¼¥ë</a>
77 ¥»¥¯¥·¥ç¥ó¤Ï CCUnit ¤Î¥â¥¸¥å¡¼¥ë¤òÀ°Íý¤·¤Æɽ¼¨¤·¤Æ¤¤¤Þ¤¹¡£
81 You find additional samples in the examples directory.
83 examples ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤Ï¥µ¥ó¥×¥ë¥Õ¥¡¥¤¥ë¤¬¤¢¤ê¤Þ¤¹¡£
85 - complex - @~english some complex number library test cases
86 @~japanese Ê£ÁÇ¿ô¤ò·×»»¤¹¤ë¥é¥¤¥Ö¥é¥ê¤È¤½¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Î¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
87 - libcomplex.a - complex number library
90 - runTestFixture @~japanese - ¤â¤Ã¤È¤âñ½ã¤Ê¥Æ¥¹¥È¥±¡¼¥¹¤ò¼Â¹Ô¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
91 - runTestFixture.c - main program
92 - testComplex.c - test cases
93 - runTestSuite @~japanese - ¥Æ¥¹¥È¥¹¡¼¥Ä¤Î¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
94 - runTestSuite.c - main program
95 - testComplex.c - test cases
96 - testComplexMulDiv.c - test cases
97 - complexTestSuite.c - create test suite function
98 - runTestRunner @~japanese - ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¥Æ¥¹¥È¥é¥ó¥Ê¡¼¤Ç¼Â¹Ô¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
99 - runTestRunner.c - main program
100 - testComplex.c - test cases
101 - testComplexMulDiv.c - test cases
102 - complexTestSuite.c - create test suite function
103 - runTest @~japanese - ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼«Æ°À¸À®¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
104 - runTest.c - main program
105 - testComplex.c - test cases
106 - suiteComplex.c - auto generated test suite from testComplex.c
109 @section _documentation Documentation
111 @section _documentation ¥É¥¥å¥á¥ó¥È
115 <dt>CCUnit Cookbook</dt>
117 A <a href="cookbook.html">cookbook</a> for implementing
118 tests with CCUnit. (and <a
119 href="../ja/cookbook.html">cookbook in
122 CCUnit¤Ç¥Æ¥¹¥È¤ò¼ÂÁõ¤¹¤ë¤¿¤á¤Î<a href="cookbook.html">¥¯¥Ã¥¯¥Ö¥Ã¥¯</a>
124 href="../../cookbook.html">Cookbook in
130 @section _license Lincense
132 @section _license ¥é¥¤¥»¥ó¥¹
136 This library is released under the GNU
137 <a href="http://www.gnu.org/copyleft/lesser.html"
138 >Lesser General Public License</a> version 2.
140 ¤³¤Î¥é¥¤¥Ö¥é¥ê¤Ï¡¢GNU <a href="http://www.gnu.org/copyleft/lesser.html"
141 >Lesser General Public License</a> ¥Ð¡¼¥¸¥ç¥ó 2 ¤Î¸µ¤ÇÇÛÉÛ¤·¤Æ¤¤¤Þ¤¹¡£
145 @section _links Related Links
147 @section _links ´ØÏ¢¥ê¥ó¥¯
151 - <a href="http://cunit.sourceforge.net/">CUnit</a>:
152 @~english CUnit is Unit Testing Framework for 'C' language.
153 @~japanese CUnit ¤Ï 'C' ¸À¸ì¤Î¥æ¥Ë¥Ã¥È¥Æ¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤¹¡£
155 - <a href="http://sourceforge.net/projects/embunit/">EmbUnit</a>,
156 <a href="http://sourceforge.jp/projects/embunit/">EmbUnit</a>:
158 Embedded Unit is unit testing framework for Embedded C
159 System. Its design was copied from JUnit and CUnit and
160 more, and then adapted somewhat for Embedded C
161 System. Embedded Unit does not require std C libs. All
162 objects are allocated to const area.
163 @~japanese EmbeddedUnit ¤Ï
164 C ¸À¸ì¤ò»È¤Ã¤¿ÁȤ߹þ¤ß·Ï³«È¯¸þ¤±¤Î¥Æ¥¹¥È¥æ¥Ë¥Ã¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤¹¡£
165 C ɸ½à¥é¥¤¥Ö¥é¥ê¤ò»È¤ï¤Ê¤¤¤Î¤Ç¼Â¹Ô»ñ¸»¤Î¾¯¤Ê¤¤¥¿¡¼¥²¥Ã¥È´Ä¶¤Ç¤âÆ°ºî²Äǽ¤Ç¤¹¡£
167 - <a href="http://junit.org/index.htm">JUnit</a>:
168 @~english JUnit is a regression testing framework written
169 by Erich Gamma and Kent Beck. It is used by the
170 developer who implements unit tests in Java.
171 @~japanese JUnit¤Ï¥ê¥°¥ì¥Ã¥·¥ç¥ó¥Æ¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤¢¤ê¡¢
172 Erich Gamma ¤È Kent Beck ¤Ë¤è¤Ã¤Æ½ñ¤«¤ì¤Þ¤·¤¿¡£
173 ¤³¤ì¤Ï Java ¤Ç¥Æ¥¹¥È¥æ¥Ë¥Ã¥È¤ò¼ÂÁõ¤¹¤ë³«È¯¼Ô¤¬»ÈÍѤ·¤Þ¤¹¡£
176 - <a href="http://cppunit.sourceforge.net/cgi-bin/moin.cgi">CppUnit</a>:
177 @~english CppUnit is a C++ unit testing framework.
178 @~japanese CppUnit ¤Ï C++ ¥æ¥Ë¥Ã¥È¥Æ¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤¹¡£
180 - <a href="http://cxxtest.sourceforge.net/">CxxTest</a>:
181 @~english CxxTest is a JUnit/CppUnit/xUnit-like framework for C++.
182 @~japanese CxxTest ¤Ï JUnit/CppUnit/xUnit ¥é¥¤¥¯¤Î C++Íѥե졼¥à¥ï¡¼¥¯¤Ç¤¹¡£
184 - <a href="http://sourceforge.net/projects/ccunit">ccUnit</a>:
185 @~english ccUnit is a C++ unit testing framework.
186 @~japanese ccUnit ¤Ï C++ ¥æ¥Ë¥Ã¥È¥Æ¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤¹¡£
189 - <a href="http://www.xprogramming.com/index.htm">XProgramming.com</a>:
190 @~english an Extreme Programming Resources.
191 @~japanese ¥¨¥¯¥¹¥È¥ê¡¼¥à¥×¥í¥°¥é¥ß¥ó¥°¤Î¥ê¥½¡¼¥¹½¸¤Ç¤¹¡£
193 - <a href="http://xp.medinfo.m.ehime-u.ac.jp/">XPJUG</a>:
194 @~english Japan XP User Group.
195 @~japanese ÆüËÜXP¥æ¡¼¥¶¥°¥ë¡¼¥×
202 * @defgroup Construction Construction
203 * CCUnit manages test suites, test fixtures, test cases.
205 * @defgroup Construction ¹½À®
206 * CCUnit ¤Ï¥Æ¥¹¥È¥¹¡¼¥Ä¡¢¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¡¢¥Æ¥¹¥È¥±¡¼¥¹¤ò´ÉÍý¤·¤Þ¤¹¡£
209 digraph CCUnitTestStructure {
210 node [ fontsize=9, fontname=Helvetica ];
211 edge [ dir=back, fontsize=9 ];
212 TestSuite -> TestSuite [ label="1..n" ];
213 TestSuite -> TestFixture [ label="1..n" ];
214 TestFixture -> setUp [ label="0..1" ];
215 TestFixture -> TestCase [ label="1..n" ];
216 TestFixture -> tearDown [ label="0..1" ];
221 * Test cases are packaged into a fixture. Fixtures packaged
222 * into a suite. And suites are packaged into a suite.
223 * Fixtures can have @c setUp and @c tearDown functions
224 * which are called before and after running the test cases.
226 * ¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ï¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤Ë¤Þ¤È¤á¤é¤ì¡¢
227 * ¤Þ¤¿¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤Ï¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤Þ¤È¤á¤é¤ì¤Þ¤¹¡£
228 * ¤½¤·¤Æ¥Æ¥¹¥È¥¹¡¼¥Ä¤â¤Þ¤¿¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤Þ¤È¤á¤é¤ì¤Þ¤¹¡£
229 * ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼Â¹Ô¤¹¤ë¤È¡¢¤½¤ì¤Ë¤Þ¤È¤á¤é¤ì¤Æ¤¤¤ë¥Æ¥¹¥È¥¹¡¼¥Ä¡¢
230 * ¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤¬½çÈ֤˼¹Ԥµ¤ì¤Þ¤¹¡£
231 * ¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤Ë¤Ï @c setUp ¤È @c tearDown ´Ø¿ô¤òÅÐÏ¿¤¹¤ë¤³¤È¤¬¤Ç¤¡¢
232 * ¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤¬¼Â¹Ô¤µ¤ì¤ëºÝ¤Ë¤Ï¡¢
233 * ¤½¤ì¤¾¤ì¤Î¥Æ¥¹¥È¥±¡¼¥¹¤ò¼Â¹Ô¤¹¤ëÁ°¤È¸å¤Ë¡¢
234 * @c setUp ¤È @c teaDown ¤¬¼«Æ°Åª¤Ë¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
240 * @defgroup Assertions Making assertions
242 * @defgroup Assertions ¥¢¥µ¡¼¥È¤ÎÀë¸À
243 * ¥Æ¥¹¥È¥±¡¼¥¹¤Ç»ÈÍѤ¹¤ë¥¢¥µ¡¼¥È¥Þ¥¯¥í¤Ç¤¹¡£
249 * @defgroup WritingTestFixture Writing test fixture
251 * @defgroup WritingTestFixture ¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤ò½ñ¤¯
252 * °ìÏ¢¤Î¥Æ¥¹¥È¥±¡¼¥¹¤ò¡¢
253 * ½àÈ÷¤ò¤¹¤ë´Ø¿ô¤È¸å½èÍý¤ò¤¹¤ë´Ø¿ô¤Ç¤Þ¤È¤á¤¿¤â¤Î¤ò¥Õ¥£¥¯¥¹¥Á¥ã¤È¸Æ¤Ó¤Þ¤¹¡£
259 * @defgroup CreatingTestSuite Creating TestSuite
261 * @defgroup CreatingTestSuite ¥Æ¥¹¥È¥¹¡¼¥Ä¤ÎÀ¸À®
262 * ¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤ä¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¤Þ¤È¤á¤Æ¡¢
263 * ¤Ò¤È¤Ä¤Î¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤·¤Þ¤¹¡£
265 * @sa CCUnitMakeSuite
270 * @defgroup ExecutingTest Executing test
272 * @defgroup ExecutingTest ¥Æ¥¹¥È¤Î¼Â¹Ô
273 * ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼Â¹Ô¤·¤Þ¤¹¡£
279 * @defgroup TrackingTestExecution Tracking test execution
281 * @defgroup TrackingTestExecution ¥Æ¥¹¥È¤Î¼Â¹Ô¤ÎÄÉÀ×
282 * ¥Æ¥¹¥È¤Î¼Â¹Ô¤òÄÉÀפ·¤Þ¤¹¡£
288 * @defgroup BrowsingCollectedTestResult Browsing collected test result
290 * @defgroup BrowsingCollectedTestResult ¥Æ¥¹¥È·ë²Ì¤Î»²¾È
291 * ¥Æ¥¹¥È·ë²Ì¤ò»²¾È¤·¤Þ¤¹¡£
297 * @defgroup ModuleHierarchy Module hierarchy
299 * @defgroup ModuleHierarchy ¥â¥¸¥å¡¼¥ë³¬ÁØ