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/>
22 @page cookbook CCUnit Cookbook
24 @page cookbook CCUnit ¥¯¥Ã¥¯¥Ö¥Ã¥¯
28 Here is a short cookbook to help you get started.
30 ¤³¤ì¤Ï CCUnit ¤ò»È¤¤»Ï¤á¤ë¤Ë¤¢¤¿¤Ã¤Æ¡¢
31 Íý²ò¤Î½õ¤±¤È¤Ê¤ë¤è¤¦¤Êû¤¤¥¯¥Ã¥¯¥Ö¥Ã¥¯¤Ç¤¹¡£
34 [see also <a href="../ja/cookbook.html">Japanese</a> documents]
36 [see also <a href="../../cookbook.html">English</a> documents]
40 @section simple_test_case Simple Test Case
42 @section simple_test_case ¥·¥ó¥×¥ë¤Ê¥Æ¥¹¥È¥±¡¼¥¹
46 Tests in <b>CCUnit</b> can be run automatically. They are
47 easy to set up and once you have written them, they are
48 always there to help you keep confidence in the quality of
51 CCUnit¤ò»È¤Ã¤¿¥Æ¥¹¥È¤Ï¼«Æ°Åª¤Ë¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
52 CCUnit ¤Î¥Æ¥¹¥È¤Ï´Êñ¤Ë¥»¥Ã¥È¥¢¥Ã¥×¤¹¤ë¤³¤È¤¬¤Ç¤¡¢
53 °ìÅ٥ƥ¹¥È¤ò½ñ¤¤¤Æ¤·¤Þ¤¨¤Ð¡¢
54 ¤¤¤Ä¤Ç¤â¥×¥í¥°¥é¥à¤ÎÉʼÁ¤ò¿®Íê¤Ç¤¤ë¤â¤Î¤ËÊݤĤ³¤È¤¬¤Ç¤¤ë¤Ç¤·¤ç¤¦¡£
58 To make a simple test, here is what you do:
60 ñ½ã¤Ê¥Æ¥¹¥È¤òºî¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
64 <li> @english Create a test function
65 @japanese ¥Æ¥¹¥È´Ø¿ô¤òºî¤ê¤Þ¤¹¡£
68 <li> @english When you want to check a value, call
69 @link CCUNIT_ASSERT() CCUNIT_ASSERT(bool) @endlink
70 and pass a bool that is true if the test succeeds
72 ASSERT macro is listed in others as well in
73 @link Assertions Making assertions @endlink.
75 Ãͤò¥Á¥§¥Ã¥¯¤·¤¿¤¤¾ì¹ç¤Ï¡¢
76 @link CCUNIT_ASSERT() CCUNIT_ASSERT(bool) @endlink
78 ¥Æ¥¹¥È¤¬À®¸ù¤¹¤ë¤Ê¤é¿¿¤òÊÖ¤¹¤è¤¦¤Ê¿¿µ¶ÃͤòÅϤ·¤Þ¤¹¡£
80 ASSERT ´Ø·¸¤Î¥Þ¥¯¥í¤Ï¾¤Ë¤â
81 @link Assertions ¥¢¥µ¡¼¥È¤ÎÀë¸À @endlink
82 ¤Ë¥ê¥¹¥È¤·¤Æ¤¢¤ê¤Þ¤¹¡£
88 For example, to test that the sum of two complex number
89 which is the sum of the values of two complex numbers,
90 write (This sample program is in the @c examples/complex directory):
92 Î㤨¤Ð¡¢´Êñ¤ÊÊ£ÁÇ¿ô¤Î¥é¥¤¥Ö¥é¥ê¤ò¥Æ¥¹¥È¤¹¤ë¤³¤È¤òÎã¤Ë¤È¤Ã¤Æ¤ß¤Þ¤·¤ç¤¦¡£
93 ¡Ê¤³¤³¤Ç»ÈÍѤ¹¤ë¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ï
94 examples/complex ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ê¤Þ¤¹¡£¡Ë
95 Ê£ÁÇ¿ô¤ò½é´ü²½¤¹¤ë¤³¤È¤¬¤Ç¤¤¿¤«¤ò¥Æ¥¹¥È¤·¤¿¤ê¡¢
96 Æó¤Ä¤ÎÊ£ÁÇ¿ô¤¬Åù¤·¤¤¤«¤ò¥Æ¥¹¥È¤¹¤ë¤È¤·¤Þ¤¹¡£
99 @dontinclude complex/testComplex.c
101 @skip test_complex_new
103 @skip test_complex_equals
108 ¤³¤ÎÆó¤Ä¤Î¥Æ¥¹¥È´Ø¿ô¤ò¤Þ¤È¤á¤Æ¤Ò¤È¤Ä¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ë¤·¤Æ¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
111 @dontinclude complex/runTestCase.c
114 @until ccunit_newTestCase
118 ¤Þ¤º¥Æ¥¹¥È¥±¡¼¥¹¤Ë¥á¥â¥ê¤ò³ä¤êÅö¤Æ¤Þ¤¹¡£
121 @until test_complex_equals);
125 ¤½¤·¤Æ¥Æ¥¹¥È¥±¡¼¥¹¤Ë¥Æ¥¹¥È´Ø¿ô¤òÅÐÏ¿¤·¤Þ¤¹¡£
126 ɽÌÀ (ASSERT) ¤¬¼ºÇÔ¤·¤¿»þ¤Ëɽ¼¨¤¹¤ë¤¿¤á¤Î´Ø¿ô̾¤È´Ø¿ô¤ÎÀâÌÀ¤ò°ì½ï¤Ë»ØÄꤷ¤Æ¤¤¤Þ¤¹¡£
133 ¥Æ¥¹¥È¥±¡¼¥¹¤ò¼Â¹Ô¤·¡¢
138 The sample code made in the above is in the directory <code>examples/complex</code>,
139 the files are @c testComplex.c and <code>runTestCase.c</code>.
141 ¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢@c examples/complex ¥Ç¥£¥ì¥¯¥È¥ê¤Î
142 <code>testComplex.c, runTestCase.c</code> ¤Ë¤¢¤ê¤Þ¤¹¡£
144 ¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
148 $ gcc -o runTestCase runTestCase.c testComplex.c complex.c -lccunit
155 That was a very simple test. Ordinarily, you'll have many
156 little test cases that you'll want to run on the same set of
157 objects. To do this, use global variables.
159 ¤³¤ì¤ÏÂçÊÑñ½ã¤Ê¥Æ¥¹¥È¤Ç¤¹¡£
161 ¤¿¤¯¤µ¤ó¤Î¾®¤µ¤Ê¥Æ¥¹¥È´Ø¿ô¤òºî¤Ã¤Æ¡¢
162 Ʊ¤¸¤è¤¦¤Ê¥Ç¡¼¥¿¤Î½¸¤Þ¤ê¤ò»È¤Ã¤Æ¥Æ¥¹¥È¤ò¹Ô¤¦¤³¤È¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£
163 ¤Ä¤Þ¤ê³Æ¥Æ¥¹¥È´Ø¿ô¶¦Ä̤Υ°¥í¡¼¥Ð¥ëÊÑ¿ô¤ò»È¤¦¤ÈÊØÍø¤Ç¤¹¡£
167 @section setUp_and_tearDown setUp and tearDown
169 @section setUp_and_tearDown setUp ¤È tearDown
173 What if you have two or more tests that operate on the same
174 similar set of objects?
176 ¤â¤·Ê£¿ô¤Î¥Æ¥¹¥È´Ø¿ô¤¬¤¢¤ë¤Ê¤é¡¢
177 Ʊ¤¸¥Ç¡¼¥¿¤Î½¸¤Þ¤ê¤ò¤¤¤¯¤Ä¤«»È¤¦¤Î¤Ç¤Ï¤Ê¤¤¤Ç¤·¤ç¤¦¤«¡£
182 node [ fontsize=9, fontname=Helvetica ]
183 edge [ fontsize=9, dir=back, arrowtail=vee ]
184 gv [ label="Global Variables", shape=box ]
186 tc1 [ label="Test case 1" ];
187 tcn [ label="Test case n" ];
191 tc1 -> tcn [ style=dotted, arrowtail=none ];
196 Tests need to run against the background of a known set of
197 objects. This set of objects is called a test fixture. When
198 you are writing tests you will often find that you spend
199 more time writing the code to set up the fixture than you do
200 in actually testing values.
202 ¥Æ¥¹¥È¤ÏÃæ¿È¤Î¤ï¤«¤Ã¤Æ¤¤¤ë¥Ç¡¼¥¿¤Î½¸¤Þ¤ê¤òÁ°Äó¤È¤·¤Æ¼Â¹Ô¤µ¤ì¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
203 ¥Æ¥¹¥È¤ò½ñ¤¤¤Æ¤¤¤ë¤È¡¢
204 ¼ÂºÝ¤Ë¥Æ¥¹¥È¤¹¤ëÃͤò¥»¥Ã¥È¥¢¥Ã¥×¤¹¤ë¥³¡¼¥É¤ò½ñ¤¯Êý¤Ë¡¢
205 ¤è¤ê»þ´Ö¤ò¤«¤±¤Æ¤¤¤ë¤³¤È¤Ëµ¤¤Å¤¯¤³¤È¤¬¤è¤¯¤¢¤ê¤Þ¤¹¡£
210 Î㤨¤ÐÁ°Àá¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ç¤Ï¡¢
211 ¤¤¤¯¤Ä¤«¤ÎÊ£ÁÇ¿ô¤ò³ä¤êÅö¤Æ¤¿¤ê²òÊü¤·¤¿¤ê¤·¤Æ¤¤¤Þ¤¹¡£
215 Often, you will be able to use the same fixture for several
216 different tests. Each case will send slightly different
217 messages or parameters to the fixture and will check for
220 ¿¤¯¤Î¾ì¹ç¡¢¤¤¤¯¤Ä¤«¤Î°Û¤Ê¤Ã¤¿¥Æ¥¹¥È¤Î¤¿¤á¤ËƱ¤¸¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤ò»È¤¦¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
221 ¤½¤ì¤¾¤ì¤Î¥Æ¥¹¥È´Ø¿ô¤ò¼Â¹Ô¤¹¤ëÁ°¤ËÊÑ¿ô¤ò½é´ü²½¤·¡¢
222 ÃͤòÄ´¤Ù¤ë¤³¤È¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£
223 ¤½¤·¤Æ¥Æ¥¹¥È¤¬½ª¤ï¤Ã¤¿¤é¸å»ÏËö¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
227 digraph TestFixture {
228 node [ fontsize=9, fontname=Helvetica ]
229 edge [ fontsize=9, dir=back, arrowtail=vee ]
231 gv [ label="Global Variables", shape=box ]
233 su [ label="setUp" ];
234 tc [ label="TestCase" ];
235 td [ label="tearDown" ];
237 gv -> su [ label="initialize" ];
238 gv -> tc [ label="access" ];
239 gv -> td [ label="clean-up" ];
244 When you have a common fixture, here is what you do:
246 ¤â¤·³Æ¥Æ¥¹¥È¤Ë¶¦Ä̤Υ°¥í¡¼¥Ð¥ëÊÑ¿ô¤¬¤¢¤ì¤Ð¡¢
247 ¼¡¤Î¤è¤¦¤Ë¤¹¤ë¤³¤È¤Ç¤·¤ç¤¦¡£
252 Create a @link CCUnitTestCase TestCase @endlink object
254 @link CCUnitTestCase TestCase @endlink ¤òºîÀ®¤·¤Þ¤¹
258 Add an global variable for each part of the case
260 TestCase ¤Î¥¹¥³¡¼¥×Æâ¤Ë¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤òÄêµÁ¤·¤Þ¤¹
264 Write @c setUp() function to initialize the valiables
266 ¥Õ¥£¥¯¥¹¥Á¥ã¤ò½é´ü²½¤¹¤ë @c setUp() ´Ø¿ô¤ò½ñ¤¤Þ¤¹
270 Write @c tearDown() to release any permanent
271 resources you allocated in @c setUp
273 @c setUp() ¤Ç³ä¤êÅö¤Æ¤¿±Ê³Ū¥ê¥½¡¼¥¹¤ò²òÊü¤¹¤ë¤¿¤á¤Î
274 @c tearDown() ´Ø¿ô¤ò½ñ¤¤Þ¤¹
277 <li>@english Write TestFunc.
279 ¥Æ¥¹¥È´Ø¿ô (TestFunc) ¤ò½ñ¤¤Þ¤¹¡£
283 Add @link CCUnitTestFunc TestFunc @endlink objects to case object
285 @link CCUnitTestFunc TestFunc @endlink ¤ò
286 @link CCUnitTestCase TestCase @endlink ¤ËÅÐÏ¿¤·¤Þ¤¹¡£
292 For example, to write several test cases, first create a
297 @dontinclude complex/testComplexSetup.c
302 @dontinclude complex/runTestCaseSetup.c
305 @until setUp_test_complex);
306 @until tearDown_test_complex);
310 @c setUp() ¤È @c tearDown() ¤òÅÐÏ¿¤·¤Þ¤¹¡£
311 ¤³¤Î»þ¡¢´Ø¿ô¤Î̾Á°¤¬ @c setUp/tearDown ¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
318 ¥Æ¥¹¥È¥±¡¼¥¹¤ò¼Â¹Ô¤·¡¢
323 The sample code made in the above is in the directory <code>examples/complex</code>,
324 the files are @c testComplexSetup.c and <code>runTestCaseSetup.c</code>.
326 ¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢@c examples/complex ¥Ç¥£¥ì¥¯¥È¥ê¤Î
327 <code>testComplexSetup.c, runTestCaseSetup.c</code> ¤Ë¤¢¤ê¤Þ¤¹¡£
329 ¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
333 $ gcc -o runTestCaseSetup runTestCaseSetup.c testComplexSetup.c complex.c -lccunit
340 @section one_time_setUp_tearDown setUp/tearDown of only one time
342 @section one_time_setUp_tearDown °ì²ó¤À¤±¤Î setUp/tearDown
347 Calling sequence of test cases in a fixture is following:
349 ¤Ò¤È¤Ä¤Î¥Õ¥£¥¯¥¹¥Á¥ã¤ÎÃæ¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Î¼Â¹Ô¥·¡¼¥±¥ó¥¹¤Ï¼¡¤Î¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
353 digraph TestCaseCallingSequence {
354 node [ fontsize=9, fontname=Helvetica ]
359 setUp2 [ label="setUp" ];
361 setup_setUp -> setUp [ weight=8 ];
362 setup_setUp -> setUp2 [ style=invis ];
363 setUp -> "TestFunc 1" [ weight=8 ];
364 "TestFunc 1" -> tearDown [ weight=8 ];
365 setUp2 -> "TestFunc n" [ weight=8 ];
366 tearDown2 [ label="tearDown" ];
367 "TestFunc n" -> tearDown2;
368 tearDown2 -> setup_tearDown;
374 The sample code made in the above is in the directory <code>examples/complex</code>,
375 the files <code>testComplex.c</code> and <code>runTestCase.c</code>.
377 ¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢<code>examples/complex</code> ¥Ç¥£¥ì¥¯¥È¥ê¤Î
378 <code>testComplex.c, runTestCase.c</code> ¤Ë¤¢¤ê¤Þ¤¹¡£
380 ¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
384 $ gcc -I. -o runTestCase runTestCase.c testComplex.c complex.c -lccunit
389 Once you have several tests, organize them into a suite.
391 °ìÅÙ¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¤òºî¤Ã¤¿¤é¡¢
392 ¤½¤ì¤é¤ò¥¹¡¼¥Ä¤ËÀ°Íý¤·¤Þ¤¹¡£
398 @section suite ¥¹¡¼¥Ä
402 digraph TestStructure {
403 node [ fontsize=9, fontname=Helvetica ];
404 edge [ dir=back, fontsize=9 ];
405 TestSuite -> TestSuite [ label="1..n" ];
407 TestSuite -> TestCase [ label="1..n" ];
408 TestCase -> setup_setUp [ label="0..1" ];
409 TestCase -> setUp [ label="0..1" ];
411 TestCase -> TestFunc [ label="1..n" ];
412 TestCase -> tearDown [ label="0..1" ];
413 TestCase -> setup_tearDown [ label="0..1" ];
418 How do you set up your tests so that you can run them all at once?
420 °ìÅ٤˥ƥ¹¥È¤ò¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë½àÈ÷¤¹¤ë¤Ë¤Ï¡¢
421 ¤É¤Î¤è¤¦¤Ë¤·¤¿¤é¤¤¤¤¤Ç¤·¤ç¤¦¤«¡©
425 CCUnit provides a @link CCUnitTestSuite TestSuite @endlink
426 module that runs any number of TestFuncs together.
428 CCUnit ¤Ï¤¤¤¯¤Ä¤â¤Î @link CCUnitTestFunc TestFuncs @endlink
430 @link CCUnitTestSuite TestSuite @endlink ¥â¥¸¥å¡¼¥ë¤òÄ󶡤·¤Þ¤¹¡£
434 You saw, above, how to run test testCase.
436 ¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤ò¼Â¹Ô¤¹¤ëÊýË¡¤Ï¾å½Ò¤·¤Þ¤·¤¿¡£
440 To create a suite of two or more tests, you do the following:
442 Æó¤Ä°Ê¾å¤Î¥Æ¥¹¥È¤ò´Þ¤à°ì¤Ä¤Î¥¹¡¼¥Ä¤òºî¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
448 CCUnitTestSuite* suite;
449 CCUnitTestCase* testCase;
450 CCUnitTestResult* result;
451 suite = ccunit_newTestSuite ("Complex test suite");
452 testCase = ccunit_newTestCase ("Complex Tests",
453 CCUNIT_NEWTESTFUNC(setUp_complex_test),
454 CCUNIT_NEWTESTFUNC(tearDown_complex_test));
455 ccunit_addNewTestFunc (testCase, "test_complex_equals", "complex equals test",
456 test_complex_equals);
457 ccunit_addNewTestFunc (testCase, "test_complex_add", "complex add test",
459 ccunit_addNewTestFunc (testCase, "test_complex_sub", "complex sub test",
461 ccunit_addTestCase (suite, fixtuer);
462 result = ccunit_runTestSuite (suite, NULL);
468 @link CCUnitTestSuite TestSuites @endlink don't only have to
469 contain @link CCUnitTestCase TestCases @endlink. They
470 can contain any object that implements the @link CCUnitTest
471 Test @endlink interface. For example, you can create a
472 @link CCUnitTestSuite TestSuite @endlink
473 (<code>complex_add_sub_suite ()</code>) in your code and I
474 can create one in mine
475 (<code>complex_mul_div_suite ()</code>), and we can run them together by
476 creating a @link CCUnitTestSuite TestSuite @endlink that
479 @link CCUnitTestSuite TestSuites @endlink ¤Ï
480 @link CCUnitTestCase TestCases @endlink
481 ¤ò´Þ¤à¤À¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
482 @link CCUnitTestSuite TestSuites @endlink ¼«¿È¤ò´Þ¤à¤³¤È¤â¤Ç¤¤Þ¤¹¡£
484 ¤½¤ì¤é¤Ï @link CCUnitTest Test @endlink
485 ¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò¼ÂÁõ¤¹¤ë¤É¤ó¤Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤â´Þ¤á¤é¤ì¤Þ¤¹¡£
487 Î㤨¤Ð¡¢¤¢¤Ê¤¿¤Ï¤¢¤Ê¤¿¤Î¥³¡¼¥É¤Ë @link CCUnitTestSuite TestSuite @endlink
488 (<code>complex_add_sub_suite ()</code>)
491 (<code>complex_mul_div_suite ()</code>)
492 ¤òºî¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡¢
493 ¤½¤·¤Æ»äã¤ÏξÊý¤È¤â¤ò´Þ¤ó¤Ç¤¤¤ë @link CCUnitTestSuite TestSuite @endlink
494 ¤òºî¤Ã¤Æ°ì½ï¤Ë¤½¤ì¤¾¤ì¤Î¥¹¡¼¥Ä¤òÆ°¤«¤¹¤³¤È¤¬¤Ç¤¤ë¤Î¤Ç¤¹¡£
498 CCUnitTestSuite* suite;
499 CCUnitTestResult* result;
500 suite = ccunit_newTestSuite ("Complex add/sub/mul/div test suite");
501 ccunit_addTestSuite (suite, complex_add_sub_suite ());
502 ccunit_addTestSuite (suite, complex_mul_div_suite ());
503 result = ccunit_runTestSuite(suite, NULL);
507 The sample code made in the above is in the directory <code>examples/complex</code>,
508 the files <code>testComplex.c</code>, <code>testComplexMulDiv.c</code>,
509 <code>complexTestSuite.c</code> and <code>runTestSuite.c</code>.
511 ¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢<code>examples/complex</code> ¥Ç¥£¥ì¥¯¥È¥ê¤Î
512 <code>testComplex.c, testComplexMulDiv.c, complexTestSuite.c, runTestSuite.c</code>
515 ¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
519 $ gcc -I. -o runTestSuite runTestSuite.c testComplex.c testComplexMulDiv.c complexTestSuite.c complex.c -lccunit
524 @section test_runner TestRunner
526 @section test_runner ¥Æ¥¹¥È¥é¥ó¥Ê¡¼
530 How do you run your tests and collect their results?
531 The testCases store result of own tests into
532 the @link CCUnitTestResult TestResult @endlink.
534 ¤É¤¦¤ä¤Ã¤Æ¥Æ¥¹¥È¤ò¼Â¹Ô¤·¡¢¤½¤Î·ë²Ì¤ò½¸¤á¤¿¤éÎɤ¤¤Ç¤·¤ç¤¦¤«¡£
535 ¥Õ¥£¥¯¥¹¥Á¥ã¤Ï¥Æ¥¹¥È¥±¡¼¥¹¤Î¼Â¹Ô·ë²Ì¤ò
536 @link CCUnitTestResult TestResult @endlink ¤Ë³ÊǼ¤·¤Þ¤¹¡£
541 node [ fontsize=9, fontname=Helvetica ]
543 edge [ fontsize=9, fontname=Courier ]
544 TestCase -> TestResult [ label="TestFailure", style=dotted, arrowhead=vee ];
546 edge [ fontsize=9, dir=back ]
548 TestCase -> "TestFunc 1..n";
549 TestCase -> tearDown;
550 TestResult -> "TestFailure 0..m";
555 Once you have a test suite, you'll want to run it. %CCUnit
556 provides @link ExecutingTest TestRunner @endlink
557 to define the suite to be run and to display
560 °ì¤Ä¥Æ¥¹¥È¥¹¡¼¥Ä¤ò½ñ¤¤¤¿¤é¡¢
561 ¤½¤ì¤ò¼Â¹Ô¤·¤¿¤¤¤Ç¤·¤ç¤¦¡£
562 CCUnit ¤Ï¥¹¡¼¥Ä¤ò¼Â¹Ô¤¹¤ë¤¿¤á¤ËÄêµÁ¤·¡¢
563 ·ë²Ì¤òɽ¼¨¤¹¤ë¤¿¤á¤Î @link ExecutingTest TestRunner @endlink ¤òÄ󶡤·¤Þ¤¹¡£
567 To use the @link CCUnitTestRunner TestRunner @endlink,
568 include the header files for the tests in runTestRunner.c:
570 @link CCUnitTestRunner TestRunner @endlink ¤ò»ÈÍѤ¹¤ë¤Ë¤Ï¡¢
571 Î㤨¤Ð runTestRunner.c ¤Ç¥Æ¥¹¥È¤Î¤¿¤á¤Î¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Þ¤¹¡£
575 #include <ccunit/CCUnitTestRunner.h>
576 #include <ccunit/CCUnitTestSuite.h>
581 @link ccunit_runTestRunner()
582 ccunit_runTestRunner (CCUnitTestRunner*, CCUnitTestSuite *) @endlink
583 in the <code>main()</code> function:
585 ¤½¤·¤Æ@link ccunit_runTestRunner()
586 ccunit_runTestRunner (CCUnitTestRunner*, CCUnitTestSuite *) @endlink
587 ¤ò<code>main()</code>´Ø¿ô¤Ç¼Â¹Ô¤·¤Þ¤¹¡£
591 extern CCUnitTestSuite* complex_add_sub_suite ();
592 extern CCUnitTestSuite* complex_mul_div_suite ();
594 int main( int argc, char **argv)
596 CCUnitTestRunner* runner;
597 CCUnitTestSuite* suite;
598 suite = ccunit_newTestSuite ("complex test suite");
599 ccunit_addTestSuite (suite, complex_add_sub_suite ());
600 ccunit_addTestSuite (suite, complex_mul_div_suite ());
601 runner = ccunit_newTestRunner (stdout);
602 return ccunit_runTestRunner (runner, suite);
607 The sample code made in the above is in the directory <code>examples/complex</code>,
608 the files <code>testComplex.c, complexTestSuite.c</code> and <code>runTestRunner.c</code>.
610 ¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢<code>examples/complex</code> ¥Ç¥£¥ì¥¯¥È¥ê¤Î
611 <code>testComplex.c, complexTestSuite.c, runTestRunner.c</code>
614 ¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
618 $ gcc -I. -o runTestRunner runTestRunner.c testComplex.c testComplexMulDiv.c complexTestSuite.c complex.c -lccunit
627 The @link ExecutingTest TestRunner @endlink will run the tests.
628 If all the tests pass, you'll get an informative message.
629 If any fail, you'll get the following information:
631 @link ExecutingTest TestRunner @endlink ¤Ï¥Æ¥¹¥È¤ò¼Â¹Ô¤·¤Þ¤¹¡£
632 ¤â¤·¤¹¤Ù¤Æ¤Î¥Æ¥¹¥È¤¬¥Ñ¥¹¤¹¤ì¤Ð¡¢¤½¤Î¾ðÊó¤Î¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
633 ¾å¤ÎÎã¤Ç¤Ï¡¢ºÇ½é¤Î¡Ö<code>.....</code>¡×¤Ï¼Â¹Ô¤·¤¿¥Æ¥¹¥È¥±¡¼¥¹¤Ç¤¹¡£
634 ¼Â¹Ô¤¹¤ëľÁ°¤Ë¡Ö<code>.</code>¡×¤¬½ÐÎϤµ¤ì¤Þ¤¹¡£
635 Á´¤Æ¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Î¼Â¹Ô¤¬½ªÎ»¤¹¤ë¤È¡¢
636 ¼Â¹Ô¤Ë¤«¤«¤Ã¤¿»þ´Ö¤È¼Â¹Ô¤·¤¿¥Æ¥¹¥È¥±¡¼¥¹¤Î¿ô¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
638 ¤É¤ì¤«¤¬¼ºÇÔ¤¹¤ì¤Ð¡¢¤½¤ì¤Ë¤Ä¤¤¤Æ°Ê²¼¤Î¤è¤¦¤Ê¾ðÊó¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
643 The name of the source file that contains the test
645 ¥Æ¥¹¥È¤ò´Þ¤ó¤Ç¤¤¤ë¥½¡¼¥¹¥Õ¥¡¥¤¥ë̾
649 The line number where the failure occurred
655 The name of the test case that failed
657 ¼ºÇÔ¤·¤¿¥Æ¥¹¥È¥±¡¼¥¹¤Î̾Á°
661 All of the text inside the call to
662 <code>CCUNIT_ASSERT ()</code> which detected the failure
664 ¼ºÇÔ¤ò¸¡ÃΤ·¤¿<code>CCUNIT_ASSERT ()</code>¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿»þ¤Î¾ò·ï¤Îʸ»úÎó¡£
671 »î¤·¤Ë @c testComplex.c ¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ç¤ï¤¶¤È´Ö°ã¤¨¤Æ¤ß¤Þ¤·¤ç¤¦¡£
672 <code>!complex_equals</code> ¤Î <code>!</code> ¤ò¤È¤Ã¤Æ¤ß¤Þ¤¹¡£
676 //* testComplex.c *\/
678 void test_complex_equals ()
680 CCUNIT_ASSERT_TEST_OBJ (s10_1, complex_equals, s10_1, complex_to_string);
681 //*CCUNIT_ASSERT_TEST_OBJ (s10_1, !complex_equals, s1_1, complex_to_string);*\/
682 CCUNIT_ASSERT_TEST_OBJ (s10_1, complex_equals, s1_1, complex_to_string);
687 $ gcc -I. -o runTestRunner runTestRunner.c testComplex.c testComplexMulDiv.c complexTestSuite.c complex.c -lccunit
696 testComplex.c:53: complex equals test:
697 complex_equals (s10_1, s1_1)
704 ¤³¤ÎÎã¤Ç¤Ï¥Æ¥¹¥È¥±¡¼¥¹¤ò 5 ¸Ä¼Â¹Ô¤·¤Æ¡¢
705 ¤Ò¤È¤Ä¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ç¼ºÇÔ¤·¤Æ¤¤¤ë¤³¤È¤¬¤ï¤«¤ê¤Þ¤¹¡£
706 ºÇ½é¤Î¡Ö<code>.F....</code>¡×¤Ç¤Ï¡¢
707 ¤Ò¤È¤ÄÌܤΥƥ¹¥È¥±¡¼¥¹¤¬¼ºÇÔ¤·¤Æ¤¤¤ë¤³¤È¤ò¤¢¤é¤ï¤·¤Æ¤¤¤Þ¤¹¡£
710 ¼ºÇÔ¤·¤¿¥Õ¥¡¥¤¥ë̾¡¢¹ÔÈֹ桢¥Æ¥¹¥È¥±¡¼¥¹¤Î̾Á° (<code>complex equals test</code>)¡¢
711 ɽÌÀ¤·¤¿¾ò·ï¤Îʸ»úÎó (<code>complex_equals (s10_1, s1_1)</code>)¡¢
712 ´üÂÔ¤·¤¿ÃÍ (<code>10+1i</code>)¡¢
713 ¼ÂºÝ¤ÎÃÍ (<code>1+1i</code>)
718 @section helper_macros Helper Tool
720 @section helper_macros ¥Ø¥ë¥Ñ¡¼¥Ä¡¼¥ë
724 As you might have noticed, implementing the <code>suite
725 ()</code> function of testCase is a repetitive and error
726 prone task. A @ref CreatingTestSuite set of functions and
727 command have been created to automatically implements the
728 <code>suite()</code> function.
730 ¤ªµ¤¤Å¤¤Î¤è¤¦¤Ë¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤Î <code>suite ()</code>´Ø¿ô¤ò¼ÂÁõ¤¹¤ë¤Î¤Ï¡¢
731 È¿ÉüŪ¤Ç´Ö°ã¤¤¤ä¤¹¤¤ºî¶È¤Ç¤¹¡£
732 @ref CreatingTestSuite ¤Î´Ø¿ô¤Î½¸¤Þ¤ê¤È¥³¥Þ¥ó¥É¤Ï<code>suite ()</code>
733 ´Ø¿ô¤Î¼ÂÁõ¤ò¼«Æ°Åª¤ËºîÀ®¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
736 @dontinclude complex/testComplex.c
739 The following code is a rewrite of ComplexTest using those command:
741 °Ê²¼¤Î¥³¡¼¥É¤Ï¤½¤ì¤é¤Î¥³¥Þ¥ó¥É¤¬»È¤¦¤è¤¦¤Ë testComplex.c ¤ò½ñ´¹¤¨¤¿¤â¤Î¤Ç¤¹¡£
745 First, you declare the testCase, passing the test testCase
746 name to the javaDoc style comment, which consist of a
747 C-style comment block starting with two <tt>*</tt>'s:
749 ºÇ½é¤Ë¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤òÀë¸À¤·¤Þ¤¹¡£
750 ¤³¤ì¤ÏjavaDoc¥¹¥¿¥¤¥ë¤Î¥³¥á¥ó¥ÈÆâ¤Ë¥Õ¥£¥¯¥¹¥Á¥ã¤Î̾Á°¤òµ½Ò¤·¤Þ¤¹¡£
751 javaDoc¥¹¥¿¥¤¥ë¤Î¥³¥á¥ó¥È¤È¤Ï C ¥¹¥¿¥¤¥ë¤Î¥³¥á¥ó¥È¥Ö¥í¥Ã¥¯¤Î³«»Ï¤¬
752 Æó¤Ä¤Î¥¢¥¹¥¿¥ê¥¹¥¯ <tt>**</tt> ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤â¤Î¤Ç¤¹¡£
756 #include <ccunit/CCUnitAssert.h>
758 //** test case: complex number test *\/
762 The function to make @link CCUnitTestSuite TestSuite
763 @endlink is <code>ccunit_suite</code>.
764 But, it can be changed to another
765 name by the <code>-f</code> option of the
766 <code>ccunit_makeSuite</code> command, too.
767 Then, you define each test case of the testCase with prefix
768 <code>test</code>, <code>setUp</code>,
769 <code>tearDown</code>:
771 @link CCUnitTestSuite TestSuite @endlink
772 ¤òºîÀ®¤¹¤ë´Ø¿ô¤Ï <code>ccunit_suite</code> ¤Ç¤¹¡¢
773 ¤·¤«¤· <code>ccunit_makeSuite</code> ¥³¥Þ¥ó¥É¤Î
774 <code>-f</code> ¥ª¥×¥·¥ç¥ó¤ÇÊ̤Î̾Á°¤ËÊѤ¨¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£
775 ¤½¤·¤Æ¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ë¤Ï¤½¤ì¤¾¤ì̾Á°¤ÎÀèƬ¤Ë¡¢
776 <code>test</code>, <code>setUp</code>,
777 <code>tearDown</code> ¤ò¤Ä¤±¤Æ¤¯¤À¤µ¤¤¡£
783 static complex_t* s10_1;
784 static complex_t* s1_1;
785 static complex_t* s11_2;
786 static complex_t* sc;
788 void setup_setUp_complex_test ()
790 sc = complex_new (1, 1);
793 void setup_tearDown_complex_test ()
798 void setUp_complex_test ()
800 s10_1 = complex_new (10, 1);
801 s1_1 = complex_new (1, 1);
802 s11_2 = complex_new (11, 2);
805 void tearDown_complex_test ()
807 complex_delete (s10_1);
808 complex_delete (s1_1);
809 complex_delete (s11_2);
813 void test_complex_equals ()
815 CCUNIT_ASSERT_TEST_OBJ (s10_1, complex_equals, s10_1, complex_to_string);
816 CCUNIT_ASSERT_TEST_OBJ (s10_1, !complex_equals, s1_1, complex_to_string);
820 void test_complex_add ()
822 complex_t c10_1 = { 10.0, 1.0 };
823 complex_t c1_1 = { 1.0, 1.0 };
825 complex_t c11_2 = { 11.0, 2.0 };
826 CCUNIT_ASSERT (complex_equals (&c11_2, complex_add (&result, &c10_1, &c1_1)));
830 void test_complex_sub ()
832 complex_t c9_0 = { 9, 0 };
834 CCUNIT_ASSERT_TEST_OBJ (&c9_0, complex_equals,
835 complex_sub (&result, s10_1, s1_1),
841 Finally, you end the testCase declaration:
843 ºÇ¸å¤Ë¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤Î½ª¤ê¤òÀë¸À¤·¤Þ¤¹¡£
847 //** end test case *\/
852 ¤Ò¤È¤Ä¤Î¥Õ¥¡¥¤¥ë¤ÎÃæ¤ËÊ£¿ô¤Î¥Õ¥£¥¯¥¹¥Á¥ã¤òÄêµÁ¤¹¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£
853 ¤½¤Î¾ì¹ç¤Ï¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤Î½ª¤ï¤ê¤ÎÀë¸À¤Î¸å¤Ë³¤±¤Æ¥Õ¥£¥¯¥¹¥Á¥ã¤òÄêµÁ¤·¤Æ¤¯¤À¤µ¤¤¡£
857 To generate creating suite function code, run
858 <code>ccunit_makeSuite</code> tool.
860 ¥¹¡¼¥ÄºîÀ®´Ø¿ô¤Î¥³¡¼¥É¤òÀ¸À®¤¹¤ë¤Ë¤Ï¡¢
861 <code>ccunit_makeSuite</code>¥Ä¡¼¥ë¤ò¼Â¹Ô¤·¤Þ¤¹¡£
865 $ ccunit_makeSuite -f complex_suite -o suiteComplex.c testComplex.c
868 #include <ccunit/CCUnitTestSuite.h>
869 #include <ccunit/CCUnitTestCase.h>
870 #include <ccunit/CCUnitTestFunc.h>
872 //* test testCase: complex number test *\/
873 //* setUp_complex_test *\/
874 extern void setUp_complex_test ();
875 //* tearDown_complex_test *\/
876 extern void tearDown_complex_test ();
877 //* test_complex_equals *\/
878 extern void test_complex_equals ();
879 //* test_complex_add *\/
880 extern void test_complex_add ();
881 //* test_complex_sub *\/
882 extern void test_complex_sub ();
884 static CCUnitTestFunc fx_001_cases[] = {
886 "test_complex_equals",
905 static CCUnitTestCaseDfn fx_001 = {
906 { ccunitTypeTestCase },
907 "complex number test",
909 "setup_setUp_complex_test",
910 "setup_setUp_complex_test",
911 setup_setUp_complex_test
914 "setup_tearDown_complex_test",
915 "setup_tearDown_complex_test",
916 setup_tearDown_complex_test
919 "setUp_complex_test",
920 "setUp_complex_test",
924 "tearDown_complex_test",
925 "tearDown_complex_test",
926 tearDown_complex_test
931 static CCUnitTestDfn* suite_001_test[] = {
936 static CCUnitTestSuiteDfn suite_001 = {
943 CCUnitTestSuite* complex_suite (const char* name)
945 if (!suite_001.name[0])
946 suite_001.name = name;
947 return ccunit_newTestSuiteFromDfn (&suite_001);
953 TestCases can be packaged into test suite.
954 You declare the suite before testCases.
956 ¤Ê¤ª¡¢¤¤¤¯¤Ä¤«¤Î¥Õ¥£¥¯¥¹¥Á¥ã¤ò¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤Þ¤È¤á¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£
957 ¤½¤Î¤¿¤á¤Ë¤Ï¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤ÎÄêµÁ¤ÎÁ°¤Ë¥Æ¥¹¥È¥¹¡¼¥Ä¤òÀë¸À¤·¤Þ¤¹¡£
961 //** test suite: complex number test suite *\/
962 //** test case: complex number equality test *\/
964 //** test case: complex number compute test *\/
968 @copydetails CCUnitMakeSuite
971 @section post_build_check Post-build check
973 @section post_build_check ¥Ó¥ë¥É¸å¤Î¥Á¥§¥Ã¥¯
977 Now that we have our unit tests running, how about
978 integrating unit testing to our build process ?
980 ¤µ¤¢¥æ¥Ë¥Ã¥È¥Æ¥¹¥È¤ò¼Â¹Ô¤¹¤ë½àÈ÷¤¬¤Ç¤¤Þ¤·¤¿¡£
981 ¤Ç¤Ï¥Ó¥ë¥É¥×¥í¥»¥¹¤Ë¥æ¥Ë¥Ã¥È¥Æ¥¹¥È¤òÅý¹ç¤¹¤ë¤Ë¤Ï¤É¤¦¤·¤¿¤é¤¤¤¤¤Ç¤·¤ç¤¦¡£
985 To do that, the application must returns a value different than 0 to indicate that
988 ¤½¤¦¤¹¤ë¤Ë¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¡¢¥¨¥é¡¼¤¬È¯À¸¤·¤¿¤³¤È¤ò¼¨¤¹
989 0 °Ê³°¤ÎÃͤòÊÖ¤µ¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
993 @link ccunit_runTestRunner() ccunit_runTestRunner() @endlink returns
994 a integer indicating if the run was successful.
996 @link ccunit_runTestRunner() ccunit_runTestRunner() @endlink
997 ¤Ï¡¢¼Â¹Ô¤¬À®¸ù¤·¤¿¤«¤É¤¦¤«¤ò¼¨¤¹À°¿ô¤òÊÖ¤·¤Þ¤¹¡£
1001 Updating our main programm, we obtains:
1003 ¼¡¤Î¤è¤¦¤Ë¥á¥¤¥ó¥×¥í¥°¥é¥à¤ò¹¹¿·¤·¤Þ¤¹¡£
1007 #include <ccunit/CCUnitTestRunner.h>
1009 extern CCUnitTestSuite* complex_suite(const char* name);
1011 int main (int argc, char** argv)
1013 CCUnitTestRunner* runner;
1014 CCUnitTestSuite* suite;
1016 runner = ccunit_newTestRunner (stdout);
1017 suite = complex_suite ("complex test suite");
1018 wasSucessful = ccunit_runTestRunner (runner, suite);
1019 return wasSucessful;
1024 Now, you need to run your application after compilation.
1026 ¤½¤ì¤Ç¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¥³¥ó¥Ñ¥¤¥ë¤·¤¿¸å¤Ë¼Â¹Ô¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£
1030 $ gcc -I. -o runTest runTest.c testComplex.c suiteComplex.c complex.c -lccunit
1039 $ ccunit_makeSuite -f complex_suite -o suiteComplex.c testComplex.c testComplexMulDiv.c
1040 $ gcc -I. -o runTest runTest.c testComplex.c testComplexMulDiv.c suiteComplex.c complex.c -lccunit
1049 The sample program made in the above is in the @c examples/complex directory.
1051 °Ê¾å¤ÇºîÀ®¤·¤¿¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ï @c examples/complex ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ê¤Þ¤¹¡£
1054 - complex - @~english some complex number library test cases
1055 @~japanese Ê£ÁÇ¿ô¤ò·×»»¤¹¤ë¥é¥¤¥Ö¥é¥ê¤È¤½¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Î¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
1056 - libcomplex.a - complex number library
1059 - runTestCase @~japanese - ¤â¤Ã¤È¤âñ½ã¤Ê¥Æ¥¹¥È¥±¡¼¥¹¤ò¼Â¹Ô¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
1060 - runTestCase.c - main program
1061 - testComplex.c - test cases
1062 - runTestSuite @~japanese - ¥Æ¥¹¥È¥¹¡¼¥Ä¤Î¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
1063 - runTestSuite.c - main program
1064 - testComplex.c - test cases
1065 - testComplexMulDiv.c - test cases
1066 - complexTestSuite.c - create test suite function
1067 - runTestRunner @~japanese - ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¥Æ¥¹¥È¥é¥ó¥Ê¡¼¤Ç¼Â¹Ô¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
1068 - runTestRunner.c - main program
1069 - testComplex.c - test cases
1070 - testComplexMulDiv.c - test cases
1071 - complexTestSuite.c - create test suite function
1072 - runTest @~japanese - ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼«Æ°À¸À®¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
1073 - runTest.c - main program
1074 - testComplex.c - test cases
1075 - suiteComplex.c - auto generated test suite from testComplex.c