OSDN Git Service

added the English explanation to the section test_runner.
authortsntsumi <tsntsumi@users.sourceforge.jp>
Sun, 22 Aug 2010 10:29:51 +0000 (10:29 +0000)
committertsntsumi <tsntsumi@users.sourceforge.jp>
Sun, 22 Aug 2010 10:29:51 +0000 (10:29 +0000)
doc/cookbook.dox

index f11d8df..9afadbf 100644 (file)
@@ -83,19 +83,19 @@ To make a simple test, here is what you do:
 </li>
 </ol>
 
-@~english
+@english
 For example, see the test of the library of the simple
 complex number as an example.
 (This sample program is in the @c examples/complex directory)
 To test whether the initialization of the complex numeber
 and tow complex numbers are equal.
-@~japanese
+@japanese
 Î㤨¤Ð¡¢´Êñ¤ÊÊ£ÁÇ¿ô¤Î¥é¥¤¥Ö¥é¥ê¤Î¥Æ¥¹¥È¤òÎã¤Ë¤È¤Ã¤Æ¤ß¤Þ¤·¤ç¤¦¡£
 ¡Ê¤³¤³¤Ç»ÈÍѤ¹¤ë@ref sample_programs¤Ï
 @c examples/complex ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ê¤Þ¤¹¡£¡Ë
 Ê£ÁÇ¿ô¤ò½é´ü²½¤¹¤ë¤³¤È¤¬¤Ç¤­¤¿¤«¤ò¥Æ¥¹¥È¤·¤¿¤ê¡¢
 Æó¤Ä¤ÎÊ£ÁÇ¿ô¤¬Åù¤·¤¤¤«¤ò¥Æ¥¹¥È¤·¤¿¤ê¤·¤Þ¤¹¡£
-@~
+@endif
 
 @dontinclude complex/testComplex.c
 
@@ -181,18 +181,18 @@ $ echo $?
 0
 @endcode
 
-@~english
+@english
 When the test case is run, that specific test functions
 will be run.  This is not a useful thing to do, however, as
 no diagnostics will be displayed.  One will normally use a
 @ref ExecutingTest to display the results.
-@~japanese
+@japanese
 ¥Æ¥¹¥È¥±¡¼¥¹¤¬¼Â¹Ô¤µ¤ì¤ë¤È¡¢
 »ØÄꤷ¤¿¥Æ¥¹¥È´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹¡£
 ¤³¤ì¤Ï¤Þ¤À¤¢¤Þ¤êÊØÍø¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡¢
 ¤Ê¤¼¤Ê¤é¡¢¿ÇÃǤ¬É½¼¨¤µ¤ì¤Ê¤¤¤«¤é¤Ç¤¹¡£
 Ä̾ï¤Ï@ref ExecutingTest¤Ç·ë²Ì¤òɽ¼¨¤·¤Þ¤¹¡£
-@~
+@endif
 
 @english
 @section test_runner TestRunner
@@ -204,6 +204,9 @@ no diagnostics will be displayed.  One will normally use a
 How do you run your tests and collect their results?
 The TestCase store result of own tests into
 the @link CCUnitTestResult TestResult@endlink.
+At the same time, the test case informs the
+@link CCUnitTestRunner TestRunner@endlink
+of the executive conditionsn of the test.
 @japanese
 ¥Æ¥¹¥È¤ò¼Â¹Ô¤·¤¿¤È¤­¤Ë¡¢¤É¤¦¤ä¤Ã¤Æ¤½¤Î·ë²Ì¤ò½¸¤á¤¿¤éÎɤ¤¤Ç¤·¤ç¤¦¤«¡£
 ¥Æ¥¹¥È¥±¡¼¥¹¤Ï¥Æ¥¹¥È´Ø¿ô¤Î¼Â¹Ô·ë²Ì
@@ -217,69 +220,72 @@ the @link CCUnitTestResult TestResult@endlink.
 digraph TestResult {
   node [ fontsize=9, fontname=Helvetica ]
   edge [ fontsize=9, dir=back ]
+  TestRunner [ URL="@ref CCUnitTestRunner" ];
   TestRunner -> TestCase [ label="Notify", fontname=Times, 
                           style=dotted, arrowhead=vee ];
   TestRunner -> TestResult [ arrowtail=none ];
   { rank=same;
+    TestCase [ URL="@ref CCUnitTestCase" ];
+    TestResult [ URL="@ref CCUnitTestResult" ];
     TestCase -> TestResult [
       label="TestFailure", fontname=Courier,
       dir=forward, style=dotted, arrowhead=vee
     ];
   }
-  TestCase -> "TestFunc 1..n";
-  TestResult -> "TestFailure 0..m" [ arrowtail=diamond ];
+  TestFunc [ label="TestFunc 1..n", URL="@ref CCUnitTestFunc" ];
+  TestFailure [ label="TestFailure 0..m", URL="@ref CCUnitTestFailure" ];
+  TestCase -> TestFunc;
+  TestResult -> TestFailure [ arrowtail=odiamond ];
 }
 @enddot
 
-@~english
+@english
 Once you have a test suite, you'll want to run it. %CCUnit
 provides @link ExecutingTest TestRunner @endlink
 to define the suite to be run and to display
 its results.
-@~japanese
+@japanese
 °ì¤Ä¥Æ¥¹¥È¥±¡¼¥¹¤ò½ñ¤¤¤¿¤é¡¢
-¤½¤ì¤ò¼Â¹Ô¤·¤¿¤¤¤Ç¤·¤ç¤¦¡£
-CCUnit ¤Ï¥Æ¥¹¥È¥±¡¼¥¹¤ò¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤Þ¤È¤á¤Æ¤ë¤³¤È¤Ç¤³¤ì¤é¤ò¼Â¹Ô¤·¡¢
-·ë²Ì¤òɽ¼¨¤¹¤ë¤¿¤á¤Î @link ExecutingTest TestRunner @endlink ¤òÄ󶡤·¤Þ¤¹¡£
-@~
+¤½¤ì¤ò¼Â¹Ô¤·¤¿¤¤¤È»×¤¦¤Ç¤·¤ç¤¦¡£
+CCUnit ¤Î @link ExecutingTest TestRunner @endlink ¤Ï¡¢
+¥Æ¥¹¥È¥±¡¼¥¹¤ò¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤Þ¤È¤á¤Æ¼Â¹Ô¤··ë²Ì¤òɽ¼¨¤·¤Þ¤¹¡£
+@endif
 
-@~english
-To use the @link CCUnitTestRunner TestRunner @endlink,
-include the header files for the tests in runTestCaseRunner.c:
-@~japanese
+@english
+To use the @link CCUnitTestRunner TestRunner@endlink,
+include the header files for the tests in <code>runTestCaseRunner.c</code>:
+@japanese
 @link CCUnitTestRunner TestRunner @endlink ¤ò»ÈÍѤ¹¤ë¤Ë¤Ï¡¢
-Î㤨¤Ð runTestCaseRunner.c ¤Ç¥Æ¥¹¥È¤Î¤¿¤á¤Î¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Þ¤¹¡£
-@~
+Î㤨¤Ð @c runTestCaseRunner.c ¤Ç¥Æ¥¹¥È¤Î¤¿¤á¤Î¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Þ¤¹¡£
+@endif
 
 @dontinclude complex/runTestCaseRunner.c
 
 @skipline #include
 @until CCUnitTestRunner.h
 
-@until ccunit_addTestCase
-
 @english
+First, make the @link CCUnitTestSuite TestSuite@endlink,
+and register the @link CCUnitTestCase TestCase@endlink.
 @japanese
-¤Þ¤º TestSuite ¤òºîÀ®¤·¡¢
-¤½¤ì¤Ë TestCase ¤òÅÐÏ¿¤·¤Þ¤¹¡£
+¤Þ¤º @link CCUnitTestSuite TestSuite@endlink ¤òºîÀ®¤·¡¢
+¤½¤ì¤Ë @link CCUnitTestCase TestCase@endlink ¤òÅÐÏ¿¤·¤Þ¤¹¡£
 @endif
 
-@until runTestRunner
+@until ccunit_addTestCase
 
-@~english
+@english
 And call to
-@link ccunit_runTestRunner()
-ccunit_runTestRunner (CCUnitTestRunner*, CCUnitTestSuite *) @endlink
-in the <code>main()</code> function:
-@~japanese
-¤½¤·¤Æ @link ccunit_runTestRunner()
-ccunit_runTestRunner (CCUnitTestRunner*, CCUnitTestSuite *) @endlink
+@link ccunit_runTestRunner(CCUnitTestRunner*, CCUnitTestSuite *)@endlink:
+@japanese
+¤½¤·¤Æ @link ccunit_runTestRunner(CCUnitTestRunner*, CCUnitTestSuite *) @endlink
 ¤ò¼Â¹Ô¤·¤Þ¤¹¡£
-@~
+@endif
 
-@until deleteTestCase
+@until runTestRunner
 
 @english
+Deallocate the memories.
 @japanese
 ³ä¤êÅö¤Æ¤¿¥á¥â¥ê¤ò²òÊü¤·¤Þ¤¹¡£
 ¤¿¤À¤·¡¢@c testCase ¤Ï @c suite ¤ËÅÐÏ¿¤·¤Æ¤¢¤ë¤Î¤Ç¡¢
@@ -293,6 +299,8 @@ ccunit_runTestRunner (CCUnitTestRunner*, CCUnitTestSuite *) @endlink
 @english
 The sample code made in the above is in the directory <code>examples/complex</code>,
 the files <code>testComplex.c, complexTestSuite.c</code> and <code>runTestRunner.c</code>.
+
+To compile and run, do the following:
 @japanese
 ¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢<code>examples/complex</code> ¥Ç¥£¥ì¥¯¥È¥ê¤Î
 <code>runTestCaseRunner.c</code>
@@ -310,11 +318,11 @@ Time: 0.000027 sec
 OK (2 tests)
 @endcode
 
-@~english
+@english
 The @link ExecutingTest TestRunner @endlink will run the tests.
 If all the tests pass, you'll get an informative message.
 If any fail, you'll get the following information:
-@~japanese
+@japanese
 @link ExecutingTest TestRunner @endlink ¤Ï¥Æ¥¹¥È¤ò¼Â¹Ô¤·¤Þ¤¹¡£
 ¤â¤·¤¹¤Ù¤Æ¤Î¥Æ¥¹¥È¤¬¥Ñ¥¹¤¹¤ì¤Ð¡¢¤½¤Î¾ðÊó¤Î¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
 ¾å¤ÎÎã¤Ç¤Ï¡¢ºÇ½é¤Î¡Ö<code>..</code>¡×¤Ï¼Â¹Ô¤·¤¿¥Æ¥¹¥È¥±¡¼¥¹¤Ç¤¹¡£
@@ -323,37 +331,39 @@ If any fail, you'll get the following information:
 ¼Â¹Ô¤Ë¤«¤«¤Ã¤¿»þ´Ö¤È¼Â¹Ô¤·¤¿¥Æ¥¹¥È¥±¡¼¥¹¤Î¿ô¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
 
 ¤É¤ì¤«¤¬¼ºÇÔ¤¹¤ì¤Ð¡¢¤½¤ì¤Ë¤Ä¤¤¤Æ°Ê²¼¤Î¤è¤¦¤Ê¾ðÊó¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
-@~
+@endif
 
 <ul>
-<li>@~english
+<li>@english
     The name of the source file that contains the test
-    @~japanese
+    @japanese
     ¥Æ¥¹¥È¤ò´Þ¤ó¤Ç¤¤¤ë¥½¡¼¥¹¥Õ¥¡¥¤¥ë̾
-    @~
+    @endif
 </li>
-<li>@~english
+<li>@english
     The line number where the failure occurred
-    @~japanese
+    @japanese
     ¼ºÇÔ¤¬µ¯¤³¤Ã¤¿¹ÔÈÖ¹æ
-    @~
+    @endif
 </li>
-<li>@~english
+<li>@english
     The name of the test case that failed
-    @~japanese
+    @japanese
     ¼ºÇÔ¤·¤¿¥Æ¥¹¥È¥±¡¼¥¹¤Î̾Á°
-    @~
+    @endif
 </li>
-<li>@~english
+<li>@english
     All of the text inside the call to
-    <code>CCUNIT_ASSERT ()</code> which detected the failure
-    @~japanese
-    ¼ºÇÔ¤ò¸¡ÃΤ·¤¿<code>CCUNIT_ASSERT ()</code>¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿»þ¤Î¾ò·ï¤Îʸ»úÎó¡£
-    @~
+    @link CCUNIT_ASSERT(bool)@endlink which detected the failure
+    @japanese
+    ¼ºÇÔ¤ò¸¡ÃΤ·¤¿ @link CCUNIT_ASSERT(bool)@endlink ¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿»þ¤Î¾ò·ï¤Îʸ»úÎó¡£
+    @endif
 </li>
 </ul>
 
 @english
+For example, try to mistake it in the test case
+of @c testComplex.c on purpose.
 @japanese
 »î¤·¤Ë @c testComplex.c ¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ç¤ï¤¶¤È´Ö°ã¤¨¤Æ¤ß¤Þ¤·¤ç¤¦¡£
 @endif
@@ -384,6 +394,8 @@ testComplex.c:46: complex equals test:
 @endcode
 
 @english
+In this example, two test cases are run.
+Then, you will see that the second is unsuccessful.
 @japanese
 ¤³¤ÎÎã¤Ç¤Ï¥Æ¥¹¥È¥±¡¼¥¹¤ò 2 ¸Ä¼Â¹Ô¤·¤Æ¡¢
 ¤Ò¤È¤Ä¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ç¼ºÇÔ¤·¤Æ¤¤¤ë¤³¤È¤¬¤ï¤«¤ê¤Þ¤¹¡£
@@ -395,17 +407,17 @@ testComplex.c:46: complex equals test:
 É½ÌÀ¤·¤¿¾ò·ï¤Îʸ»úÎó (<code>complex_equals (c10_1, c1_1) != 0</code>) ¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
 @endif
 
-@~english
+@english
 That was a very simple test. Ordinarily, you'll have many
 little test cases that you'll want to run on the same set of
 objects. To do this, use global variables.
-@~japanese
+@japanese
 ¤³¤ì¤ÏÂçÊÑñ½ã¤Ê¥Æ¥¹¥È¤Ç¤¹¡£
 Ä̾
 ¤¿¤¯¤µ¤ó¤Î¾®¤µ¤Ê¥Æ¥¹¥È´Ø¿ô¤òºî¤Ã¤Æ¡¢
 Æ±¤¸¤è¤¦¤Ê¥Ç¡¼¥¿¤Î½¸¤Þ¤ê¤ò»È¤Ã¤Æ¥Æ¥¹¥È¤ò¹Ô¤¦¤Ç¤·¤ç¤¦¡£
 ¤Ä¤Þ¤ê³Æ¥Æ¥¹¥È´Ø¿ô¶¦Ä̤Υ°¥í¡¼¥Ð¥ëÊÑ¿ô¤ò»È¤¦¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
-@~
+@endif
 
 @english
 @section setUp_and_tearDown setUp and tearDown
@@ -413,13 +425,13 @@ objects. To do this, use global variables.
 @section setUp_and_tearDown setUp ¤È tearDown
 @endif
 
-@~english
+@english
 What if you have two or more tests that operate on the same
 similar set of objects?
-@~japanese
+@japanese
 ¤â¤·Ê£¿ô¤Î¥Æ¥¹¥È´Ø¿ô¤¬¤¢¤ë¤Ê¤é¡¢
 Æ±¤¸¥Ç¡¼¥¿¤Î½¸¤Þ¤ê¤ò¤¤¤¯¤Ä¤«»È¤¦¤Î¤Ç¤Ï¤Ê¤¤¤Ç¤·¤ç¤¦¤«¡£
-@~
+@endif
 
 @dot
 digraph TestCase {
@@ -438,18 +450,18 @@ digraph TestCase {
 }
 @enddot
 
-@~english
+@english
 Tests need to run against the background of a known set of
 objects. This set of objects is called a test fixture. When
 you are writing tests you will often find that you spend
 more time writing the code to set up the fixture than you do
 in actually testing values.
-@~japanese
+@japanese
 ¥Æ¥¹¥È¤ÏÃæ¿È¤Î¤ï¤«¤Ã¤Æ¤¤¤ë¥Ç¡¼¥¿¤Î½¸¤Þ¤ê¤òÁ°Äó¤È¤·¤Æ¼Â¹Ô¤µ¤ì¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
 ¥Æ¥¹¥È¤ò½ñ¤¤¤Æ¤¤¤ë¤È¡¢
 ¼ÂºÝ¤Ë¥Æ¥¹¥È¤¹¤ëÃͤò¥»¥Ã¥È¥¢¥Ã¥×¤¹¤ë¥³¡¼¥É¤ò½ñ¤¯Êý¤Ë¡¢
 ¤è¤ê»þ´Ö¤ò¤«¤±¤Æ¤¤¤ë¤³¤È¤Ëµ¤¤Å¤¯¤³¤È¤¬¤è¤¯¤¢¤ê¤Þ¤¹¡£
-@~
+@endif
 
 @english
 @japanese
@@ -457,17 +469,17 @@ in actually testing values.
 ¤¤¤¯¤Ä¤«¤ÎÊ£ÁÇ¿ô¤ò³ä¤êÅö¤Æ¤¿¤ê²òÊü¤·¤¿¤ê¤·¤Æ¤¤¤Þ¤¹¡£
 @endif
 
-@~english
+@english
 Often, you will be able to use the same fixture for several
 different tests. Each case will send slightly different
 messages or parameters to the fixture and will check for
 different results.
-@~japanese
+@japanese
 Â¿¤¯¤Î¾ì¹ç¡¢¤¤¤¯¤Ä¤«¤Î°Û¤Ê¤Ã¤¿¥Æ¥¹¥È¤Î¤¿¤á¤ËƱ¤¸¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
 ¤½¤ì¤¾¤ì¤Î¥Æ¥¹¥È´Ø¿ô¤ò¼Â¹Ô¤¹¤ëÁ°¤ËÊÑ¿ô¤ò½é´ü²½¤·¡¢
 ÃͤòÄ´¤Ù¤ë¤³¤È¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£
 ¤½¤·¤Æ¥Æ¥¹¥È¤¬½ª¤ï¤Ã¤¿¤é¸å»ÏËö¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
-@~
+@endif
 
 @dot
 digraph TestFixture {
@@ -615,15 +627,15 @@ digraph TestCaseCallingSequence {
 @section suite ¥¹¡¼¥Ä
 @endif
 
-@~english
+@english
 How do you set up your tests so that you can run them all at once?
 Once you have several tests, organize them into a suite.
-@~japanese
+@japanese
 Ê£¿ô¤Î¥Æ¥¹¥È¤òÁ´Éô°ìÅ٤˼¹Ԥ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë½àÈ÷¤¹¤ë¤Ë¤Ï¡¢
 ¤É¤Î¤è¤¦¤Ë¤·¤¿¤é¤¤¤¤¤Ç¤·¤ç¤¦¤«¡©
 ¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¤òºî¤Ã¤¿¤é¡¢
 ¤½¤ì¤é¤ò¥¹¡¼¥Ä (¥¹¥¤¡¼¥È) ¤ËÀ°Íý¤·¤Þ¤¹¡£
-@~
+@endif
 
 @dot
 digraph TestStructure {
@@ -641,22 +653,22 @@ digraph TestStructure {
 }
 @enddot
 
-@~english
+@english
 CCUnit provides a @link CCUnitTestSuite TestSuite @endlink
 module that runs any number of TestFuncs together.
 You saw, above, how to run test suite.
-@~japanese
+@japanese
 CCUnit ¤Ï¤¤¤¯¤Ä¤â¤Î @link CCUnitTestFunc TestFuncs @endlink
 ¤ò°ì½ï¤Ë¼Â¹Ô¤¹¤ë
 @link CCUnitTestSuite TestSuite @endlink ¥â¥¸¥å¡¼¥ë¤òÄ󶡤·¤Þ¤¹¡£
 ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼Â¹Ô¤¹¤ëÊýË¡¤Ï¤¹¤Ç¤ËÁ°¤ÎÊý¤Ç¼¨¤·¤Æ¤¢¤ê¤Þ¤¹¡£
-@~
+@endif
 
-@~english
+@english
 To create a suite of two or more tests, you do the following:
-@~japanese
+@japanese
 Æó¤Ä°Ê¾å¤Î¥Æ¥¹¥È¤ò´Þ¤à°ì¤Ä¤Î¥¹¡¼¥Ä¤òºî¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
-@~
+@endif
 
 @dontinclude complex/runTestSuite.c