OSDN Git Service

removed unused command
[ccunit/ccunit.git] / doc / cookbook.dox
index acc3710..c8b8bb0 100644 (file)
 /* -*- Indented-Text -*- */
 /* $Id$ */
-/** @page cookbook CCUnit Cookbook
-
+/**
+@english
+@page cookbook CCUnit Cookbook
+@japanese
+@page cookbook CCUnit ¥¯¥Ã¥¯¥Ö¥Ã¥¯
+@endif
+
+@~english
 Here is a short cookbook to help you get started.
-
+@~japanese
+¤³¤ì¤Ï CCUnit ¤ò»È¤¤»Ï¤á¤ë¤Ë¤¢¤¿¤Ã¤Æ¡¢
+Íý²ò¤Î½õ¤±¤È¤Ê¤ë¤è¤¦¤Êû¤¤¥¯¥Ã¥¯¥Ö¥Ã¥¯¤Ç¤¹¡£
+@~
+@english
+[see also <a href="../ja/cookbook.html">Japanese</a> documents]
+@japanese
+[see also <a href="../../cookbook.html">English</a> documents]
+@endif
+
+@english
 @section simple_test_case Simple Test Case
+@japanese
+@section simple_test_case ¥·¥ó¥×¥ë¤Ê¥Æ¥¹¥È¥±¡¼¥¹
+@endif
 
+@~english
 Tests in <b>CCUnit</b> can be run automatically.  They are
 easy to set up and once you have written them, they are
 always there to help you keep confidence in the quality of
 your code.
-
+@~japanese
+CCUnit¤ò»È¤Ã¤¿¥Æ¥¹¥È¤Ï¼«Æ°Åª¤Ë¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+CCUnit ¤Î¥Æ¥¹¥È¤Ï´Êñ¤Ë¥»¥Ã¥È¥¢¥Ã¥×¤¹¤ë¤³¤È¤¬¤Ç¤­¡¢
+°ìÅ٥ƥ¹¥È¤ò½ñ¤¤¤Æ¤·¤Þ¤¨¤Ð¡¢
+¤¤¤Ä¤Ç¤â¥×¥í¥°¥é¥à¤ÎÉʼÁ¤ò¿®Íê¤Ç¤­¤ë¤â¤Î¤ËÊݤĤ³¤È¤¬¤Ç¤­¤ë¤Ç¤·¤ç¤¦¡£
+@~
+
+@~english
 To make a simple test, here is what you do:
+@~japanese
+ñ½ã¤Ê¥Æ¥¹¥È¤òºî¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
+@~
 
 <ol>
-<li> Create a test function</li>
-<li> When you want to check a value, call 
+<li> @~english Create a test function
+     @~japanese ¥Æ¥¹¥È´Ø¿ô¤òºî¤ë</li>
+<li> @~english When you want to check a value, call
+     @~japanese Ãͤò¥Á¥§¥Ã¥¯¤·¤¿¤¤¾ì¹ç¤Ï¡¢@~
      @link CCUNIT_ASSERT() CCUNIT_ASSERT(bool) @endlink
-     and pass a bool that is true if the test succeeds</li>
+     @~english and pass a bool that is true if the test succeeds
+     @~japanese ¤ò¸Æ¤Ó½Ð¤·¤Æ¡¢
+     ¤â¤·¥Æ¥¹¥È¤¬À®¸ù¤¹¤ë¤Î¤Ç¤¢¤ì¤Ð¿¿¤òÊÖ¤¹¤è¤¦¤Ê¿¿µ¶ÃͤòÅϤ·¤Þ¤¹</li>
 </ol>
 
-For example, to test that the sum of two Moneys with the
-same currency contains a value which is the sum of the
-values of two Moneys, write:
+@~english
+For example, to test that the sum of two complex number
+which is the sum of the values of two complex numbers,
+write:
+@~japanese
+Î㤨¤Ð¡¢Æó¤Ä¤ÎÊ£ÁÇ¿ô¤Î¹ç·×¤¬¡¢
+Æó¤Ä¤ÎÊ£ÁÇ¿ô¤ÎÃͤò²Ã»»¤·¤¿ÃͤÈƱ¤¸¤Ç¤¢¤ë¤³¤È¤ò¥Æ¥¹¥È¤¹¤ë¤È¤·¤Þ¤¹¡£
+@~
 
 @code
-void testSimpleAdd ()
+void test_complex_add ()
 {
-  Money* m120JPY = Money_new (120, "JPY");
-  Money* m140JPY = Money_new (140, "JPY");
-  Money* expected = Money_new (260, "JPY");
-  Money* result = Money_add (m120JPY, m140JPY);
-  CCUNIT_ASSERT (Money_equals (expected, result));
-  Money_delete (m120JPY);
-  Money_delete (m140JPY);
-  Money_delete (expected);
-  Money_delete (result);
+  complex_t c10_1 = { 10.0, 1.0 };
+  complex_t c1_1 = { 1.0, 1.0 };
+  complex_t result;
+  complex_t c11_2 = { 11.0, 2.0 };
+  CCUNIT_ASSERT (complex_equals (&c11_2, complex_add (&result, c10_1, c1_1)));
 }
 @endcode
 
+@~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 a fixture.
-
+@~japanese
+¤³¤ì¤ÏÂçÊÑñ½ã¤Ê¥Æ¥¹¥È¤Ç¤¹¡£
+Ä̾Ʊ¤¸¥Ç¡¼¥¿¤Î¥»¥Ã¥È¤ÇÁö¤é¤»¤ë¤¿¤á¤Ë¡¢
+¤¿¤¯¤µ¤ó¤Î¾®¤µ¤Ê¥Æ¥¹¥È¥±¡¼¥¹¤òºî¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Ç¤·¤ç¤¦¡£
+¤½¤¦¤¹¤ë¤Ë¤Ï¥Õ¥£¥¯¥¹¥Á¥ã¡ÊÈ÷Éʡˤò»È¤¤¤Þ¤¹¡£
+@~
+
+@english
 @section fixture Fixture
+@japanese
+@section fixture ¥Õ¥£¥¯¥¹¥Á¥ã
+@endif
 
+@~english
 What if you have two or more tests that operate on the same
 similar set of objects?
+@~japanese
+¤â¤·Æó¤Ä°Ê¾å¤Î¥Æ¥¹¥È¤¬¤¢¤ë¤Ê¤é¡¢
+Ʊ¤¸Îà»÷¤Î¥Ç¡¼¥¿¤Î¥»¥Ã¥È¤ÇÁàºî¤¹¤ë¤Î¤Ç¤Ï¤Ê¤¤¤Ç¤·¤ç¤¦¤«¡£
+@~
 
+@~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.
-
-Often, you will be able to use the same fixture for sevral
+@~japanese
+¥Æ¥¹¥È¤Ï¼þÃΤΥǡ¼¥¿¤Î¥»¥Ã¥È¤òÇطʤˤ·¤Æ¼Â¹Ô¤µ¤ì¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
+¤³¤Î¥Ç¡¼¥¿¤Î¥»¥Ã¥È¤ò¥Õ¥£¥¯¥¹¥Á¥ã¤È¸Æ¤Ö¤³¤È¤Ë¤·¤Þ¤¹¡£
+¥Æ¥¹¥È¤ò½ñ¤¤¤Æ¤¤¤ë¤È¡¢
+¼ÂºÝ¤Î¥Æ¥¹¥È¤¹¤ëÃͤò¥Õ¥£¥¯¥¹¥Á¥ã¤Ë¥»¥Ã¥È¥¢¥Ã¥×¤¹¤ë¥³¡¼¥É¤ò½ñ¤¯Êý¤Ë¡¢
+¤â¤Ã¤È»þ´Ö¤ò¤«¤±¤Æ¤¤¤ë¤³¤È¤Ëµ¤¤Å¤¯¤³¤È¤¬¤è¤¯¤¢¤ê¤Þ¤¹¡£
+@~
+
+@~english
+Often, you will be able to use the same fixture for several
 different tests. Each case will send slightly different
-messages or parameteres to the fixture and will check for
+messages or parameters to the fixture and will check for
 different results.
-
+@~japanese
+¿¤¯¤Î¾ì¹ç¡¢¤¤¤¯¤Ä¤«¤Î°Û¤Ê¤Ã¤¿¥Æ¥¹¥È¤Î¤¿¤á¤ËƱ¤¸¥Õ¥£¥¯¥¹¥Á¥ã¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+¤½¤ì¤¾¤ì¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ï¾¯¤·°Û¤Ê¤Ã¤¿¥á¥Ã¥»¡¼¥¸¡¢
+¤¢¤ë¤¤¤Ï¥Ñ¥é¥á¡¼¥¿¤ò¥Õ¥£¥¯¥¹¥Á¥ã¤ËÁ÷¤ê¡¢
+°Û¤Ê¤ë·ë²Ì¤òÄ´¤Ù¤Þ¤¹¡£
+@~
+
+@~english
 When you have a common fixture, here is what you do:
+@~japanese
+¤â¤·¶¦Ä̤¹¤ë¥Õ¥£¥¯¥¹¥Á¥ã¤¬¤¢¤ì¤Ð¡¢¤³¤ó¤Ê¤Õ¤¦¤Ë¤¹¤ë¤³¤È¤Ë¤Ê¤ê
+¤Þ¤¹¡£
+@~
 
 <ol>
-<li>Create a @link CCUnitTestCase TestCase @endlink object</li>
-<li>Add an global variable for each part of the fixture</li>
-<li>Write <code>setUp()</code> function to initialize the valiables</li>
-<li>Write <code>tearDown()</code> to release any permanent
-    resources you allocated in <code>setUp</code></li>
-<li>Create a @link CCUnitTestFixture TestFixture @endlink object</li>
-<li>Add test case objects to fixture object</li>
+<li>@~english
+    Create a @link CCUnitTestCase TestCase @endlink object
+    @~japanese
+    @link CCUnitTestCase TestCase @endlink ¹½Â¤ÂΤ˥á¥â¥ê¤ò³ä¤êÅö¤Æ¤Þ¤¹
+    ¡Ê°Ê¹ß¡¢¹½Â¤ÂΤ˳ä¤êÅö¤Æ¤¿¥á¥â¥ê¤ò¡¢¥ª¥Ö¥¸¥§¥¯¥È¤È¸Æ¤Ö¤³¤È¤Ë¤·¤Þ¤¹¡Ë
+</li>
+<li>@~english
+    Add an global variable for each part of the fixture
+    @~japanese
+    ¥Õ¥£¥¯¥¹¥Á¥ã¤Î¤½¤ì¤¾¤ì¤ÎÉôʬ¤ËÂç°èÊÑ¿ô¤òÄɲä·¤Þ¤¹
+</li>
+<li>@~english
+    Write <code>setUp()</code> function to initialize the valiables
+    @~japanese
+    <code>setUp()</code> ´Ø¿ô¤ò½ñ¤¤¤ÆÊÑ¿ô¤ò½é´ü²½¤·¤Þ¤¹
+</li>
+<li>@~english
+    Write <code>tearDown()</code> to release any permanent
+    resources you allocated in <code>setUp</code>
+    @~japanese
+    <code>tearDown()</code> ´Ø¿ô¤ò½ñ¤¤¤Æ<code>setUp</code>
+    ¤Ç³ä¤êÅö¤Æ¤¿±Ê³Ū¥ê¥½¡¼¥¹¤ò²òÊü¤·¤Þ¤¹
+</li>
+<li>@~english
+    Create a @link CCUnitTestFixture TestFixture @endlink object
+    @~japanese
+    @link CCUnitTestFixture CCUnitTestFixture @endlink
+    ¹½Â¤ÂΤ˥á¥â¥ê¤ò³ä¤êÅö¤Æ¤Þ¤¹
+</li>
+<li>@~english
+    Add @link GGUnitTestCase TestCase @endlink objects to fixture object
+    @~japanese
+    @link CCUnitTestCase TestCase @endlink
+    ¥ª¥Ö¥¸¥§¥¯¥È¤ò@link CCUnitTestFixture TestFixture @endlink
+    ¥Õ¥£¥¯¥¹¥Á¥ã¥ª¥Ö¥¸¥§¥¯¥È¤ËÅÐÏ¿¤·¤Þ¤¹¡£
+</li>
 </ol>
 
-For example, to write several test cases that want to work
-with different combinations of 120 Japanese Yen, 140
-Japanese Yen, and 28 US Dollars, first create a fixture:
+@~english
+For example, to write several test cases, first create a
+fixture:
+@~japanese
+Î㤨¤Ð¡¢¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¥±¡¼¥¹¤ò½ñ¤¯¾ì¹ç¡¢
+ºÇ½é¤Ë¥Õ¥£¥¯¥¹¥Á¥ã¤òºîÀ®¤·¤Þ¤¹¡£
+@~
 
 @code
-//** TEST CASE: Money test *\/
+//** TEST CASE: complex number test *\/
 
-#include "Money.h"
+#include "complex.h"
 
-static Money* s120JPY;
-static Money* s140JPY;
-static Money* s23USD;
+static complex_t* s10_1;
+static complex_t* s1_1;
+static complex_t* s11_2;
 
-void setUp_moneyTest ()
+void setUp_ComplexTest ()
 {
-  s120JPY = Money_new (120, "JPY");
-  s140JPY = Money_new (140, "JPY");
-  s23USD = Money_new (23, "USD");
+  s10_1 = complex_new (10, 1);
+  s1_1 = complex_new (1, 1);
+  s11_2 = complex_new (11, 2);
 }
-void tearDown_moneyTest ()
+
+void tearDown_ComplexTest ()
 {
-  Money_delete (s120JPY);
-  Money_delete (s140JPY);
-  Money_delete (s23USD);
+  complex_delete (s10_1);
+  complex_delete (s1_1);
+  complex_delete (s11_2);
 }
 
 ...
 
   CCUnitTestFixture* fixture;
-  fixture = ccunit_newTestFixture ("MoneyTest", 
-                                   CCUNIT_NEWTESTFUNC(setUp_MoneyTest),
-                                   CCUNIT_NEWTESTFUNC(tearDown_MoneyTest));
+  fixture = ccunit_newTestFixture ("ComplexTest",
+                                   CCUNIT_NEWTESTFUNC(setUp_ComplexTest),
+                                   CCUNIT_NEWTESTFUNC(tearDown_ComplexTest));
 @endcode
 
-Once you have the Fixture in place, you can write as many
+@~english
+Once you have the Fixture in place, you can write as complex
 Test Cases as you'd like.
+@~japanese
+°ìÅÙ·è¤Þ¤Ã¤¿¤È¤³¤í¤Ë¥Õ¥£¥¯¥¹¥Á¥ã¤ò½ñ¤¤¤Æ¤·¤Þ¤¨¤Ð¡¢
+¤¢¤Ê¤¿¤¬¹¥¤­¤Ê¤è¤¦¤ËÊ£ÁÇ¿ô¤Î¥Æ¥¹¥È¥±¡¼¥¹¤ò½ñ¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+@~
 
+@english
 @section test_case Test Case
+@japanese
+@section test_case ¥Æ¥¹¥È¥±¡¼¥¹
+@endif
 
+@~english
 How do you write and invoke an individual test case when you
 have a Fixture?
+@~japanese
+¥Õ¥£¥¯¥¹¥Á¥ã¤ò°ì¤Ä½ñ¤¤¤¿¤È¤·¤Æ¡¢
+¤É¤¦¤ä¤Ã¤Æ¸Ä¡¹¤Î¥Æ¥¹¥È¥±¡¼¥¹¤ò½ñ¤¤¤Æ¼Â¹Ô¤¹¤ì¤ÐÎɤ¤¤Ç¤·¤ç¤¦¤«¡£
+@~
 
-For example, to test the addition of a Money and a MoneyBag,
+@~english
+For example, to test the equality of two complex number,
 write:
+@~japanese
+Î㤨¤Ð¡¢Æó¤Ä¤ÎÊ£ÁÇ¿ô¤¬Åù¤·¤¤¡Ê¤Þ¤¿¤ÏÅù¤·¤¯¤Ê¤¤¡Ë¤³¤È¤ò¥Æ¥¹¥È¤¹¤ë¤Ë¤Ï¡¢
+¼¡¤Î¤è¤¦¤Ë½ñ¤­¤Þ¤¹¡£
+@~
 
 @code
-void testMoneyMoneyBag ()
+void test_complex_equals ()
 {
-  Money* bag[] = { s260JPY, s28USD };
-  MoneyBag expected = MoneyBag_new (2, bag);
-  Money* subtotal = Money_add (s120JPY, s28USD);
-  Money* total = Money_add (subtotal, s140JPY);
-  CCUNIT_ASSERT (MoneyBag_equals (expected, total));
-  MoneyBag_delete (expected);
-  Money_delete (subtotal);
-  Money_delete (total);
+  CCUNIT_ASSERT_TEST_OBJ (s10_1, complex_equals, s10_1, complex_to_string);
+  CCUNIT_ASSERT_TEST_OBJ (s10_1, !complex_equals, s1_1, complex_to_string);
 }
 
 ...
 
   ccunit_addNewTestCase (fixture,
-                         "testSimpleAdd",
-                         "simple add test",
-                         testSympleAdd);
-  ccunit_addNewTestCase (fixture, 
-                         "testMoneyMoneyBag",
-                         "money bag test",
-                         testMoneyMoneyBag);
-@endcode  
+                         "test_complex_equals",
+                         "complex equals test",
+                         test_complex_equals);
+@endcode
 
+@~english
 One may create and run objects for each test case like this:
+@~japanese
+°ì¤Ä¤Ë¤Ï¼¡¤Î¤è¤¦¤Ë¡¢
+¥Õ¥£¥¯¥¹¥Á¥ã¤òºîÀ®¤·¤Æ¤½¤ì¤¾¤ì¤Î¥Æ¥¹¥È¥±¡¼¥¹¤ò¼Â¹Ô¤µ¤»¤ë¤³¤È
+¤¬¤Ç¤­¤Þ¤¹¡£
+@~
 
 @code
   CCUnitTestResult* result;
   result = ccunit_runTestFixture (fixture);
 @endcode
 
+@~english
 When the test fixture 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
 @link ExecutingTest TestRunner @endlink (see below) to
 display the results.
-
+@~japanese
+¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤¬¼Â¹Ô¤µ¤ì¤ë¤È¡¢
+ÆÃÄê¤Î¥Æ¥¹¥È´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹¡£
+¤³¤ì¤Ï¤¢¤Þ¤êÊØÍø¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡¢
+¤Ê¤¼¤Ê¤é¡¢¿ÇÃǤ¬É½¼¨¤µ¤ì¤Ê¤¤¤«¤é¤Ç¤¹¡£
+Ä̾ï¤Ï @link ExecutingTest TestRunner @endlink
+(@ref test_runner ¸å½Ò)
+¤Ç·ë²Ì¤òɽ¼¨¤·¤Þ¤¹¡£
+@~
+
+@~english
 Once you have several tests, organize them into a suite.
+@~japanese
+°ìÅÙ¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¤òºî¤Ã¤¿¤é¡¢
+¤½¤ì¤é¤ò¥¹¥¤¡¼¥È¤ËÀ°Íý¤·¤Þ¤¹¡£
+@~
 
+@english
 @section suite Suite
+@japanese
+@section suite ¥¹¥¤¡¼¥È
+@endif
 
+@~english
 How do you set up your tests so that you can run them all at once?
+@~japanese
+¤É¤Î¤è¤¦¤Ë¤·¤Æ¡¢°ìÅ٤˥ƥ¹¥È¤ò¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¡¢
+½àÈ÷¤·¤¿¤é¤¤¤¤¤Ç¤·¤ç¤¦¤«¡©
+@~
 
+@~english
 %CCUnit provides a @link CCUnitTestSuite TestSuite @endlink
 module that runs any number of TestCases together.
+@~japanese
+CCUnit ¤Ï¤¤¤¯¤Ä¤â¤Î @link CCUnitTestCase TestCases @endlink
+¤ò°ì½ï¤Ë¼Â¹Ô¤¹¤ë
+@link CCUnitTestSuite TestSuite @endlink ¥â¥¸¥å¡¼¥ë¤òÄ󶡤·¤Þ¤¹¡£
+@~
 
+@~english
 You saw, above, how to run test fixture.
+@~japanese
+¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤ò¼Â¹Ô¤¹¤ëÊýË¡¤Ï¾å½Ò¤·¤Þ¤·¤¿¡£
+@~
 
+@~english
 To create a suite of two or more tests, you do the following:
+@~japanese
+Æó¤Ä°Ê¾å¤Î¥Æ¥¹¥È¤ò´Þ¤à°ì¤Ä¤Î¥¹¥¤¡¼¥È¤òºî¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
+@~
 
 @code
 CCUnitTestSuite* suite;
 CCUnitTestFixture* fixture;
 CCUnitTestResult* result;
-suite = ccunit_newTestSuite ("Money test suite");
-fixture = ccunit_newTestFixture ("Money Tests", 
-                                 CCUNIT_NEWTESTFUNC(setUp_moneyTest),
-                                 CCUNIT_NEWTESTFUNC(tearDown_moneyTest));
-ccunit_addNewTestCase (fixture,
-                       "testSimpleAdd", "simple add test", testSympleAdd);
-ccunit_addNewTestCase (fixture, 
-                       "testMoneyMoneyBag", "money bag test", testMoneyMoneyBag);
+suite = ccunit_newTestSuite ("Complex test suite");
+fixture = ccunit_newTestFixture ("Complex Tests",
+                                 CCUNIT_NEWTESTFUNC(setUp_complex_test),
+                                 CCUNIT_NEWTESTFUNC(tearDown_complex_test));
+ccunit_addNewTestCase (fixture, "test_complex_equals", "complex equals test",
+                       test_complex_equals);
+ccunit_addNewTestCase (fixture, "test_complex_add", "complex add test",
+                       test_complex_add);
+ccunit_addNewTestCase (fixture, "test_complex_sub", "complex sub test",
+                       test_complex_sub);
 ccunit_addTestFixture (suite, fixtuer);
 result = ccunit_runTestSuite (suite, NULL);
-@endcode         
+@endcode
 
+@~english
 @link CCUnitTestSuite TestSuites @endlink don't only have to
 contain @link CCUnitTestFixture TestFixtures @endlink.  They
 can contain any object that implements the @link CCUnitTest
@@ -192,205 +352,346 @@ Test @endlink interface.  For example, you can create a
 can create one in mine, and we can run them together by
 creating a @link CCUnitTestSuite TestSuite @endlink that
 contains both:
+@~japanese
+@link CCUnitTestSuite TestSuites @endlink ¤Ï
+@link CCUnitTestFixture TestFixtures @endlink
+¤ò´Þ¤à¤À¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
+¤½¤ì¤é¤Ï @link CCUnitTest Test @endlink
+¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò¼ÂÁõ¤¹¤ë¤É¤ó¤Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤â´Þ¤á¤é¤ì¤Þ¤¹¡£
+Î㤨¤Ð¡¢¤¢¤Ê¤¿¤Ï¤¢¤Ê¤¿¤Î¥³¡¼¥É¤Ë@link CCUnitTestSuite TestSuite @endlink
+¤òºî¤ë¤³¤È¤¬¤Ç¤­¡¢¤½¤·¤Æ»ä¤Ï»ä¤Î¥¹¥¤¡¼¥È¤òºî¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¢
+¤½¤·¤Æ»äã¤ÏξÊý¤È¤â¤ò´Þ¤ó¤Ç¤¤¤ë @link CCUnitTestSuite TestSuite @endlink
+¤òºî¤Ã¤Æ°ì½ï¤Ë¸Ä¡¹¤Î¥¹¥¤¡¼¥È¤òÆ°¤«¤¹¤³¤È¤¬¤Ç¤­¤ë¤Î¤Ç¤¹¡£
+@~
 
 @code
 CCUnitTestSuite* suite;
 CCUnitTestResult* result;
 suite = ccunit_newTestSuite ("suite");
-ccunit_addTestSuite (suite, moneyTestSuite);
-ccunit_addTestSuite (suite, complexNumberTestSuite);
+ccunit_addTestSuite (suite, complex_add_sub_suite ());
+ccunit_addTestSuite (suite, complex_mul_div_suite ());
 result = ccunit_runTestSuite(suite, NULL);
 @endcode
 
 
+@english
 @section test_runner TestRunner
+@japanese
+@section test_runner ¥Æ¥¹¥È¥é¥ó¥Ê¡¼
+@endif
 
+@~english
 How do you run your tests and collect their results?
+@~japanese
+¤É¤¦¤ä¤Ã¤Æ¥Æ¥¹¥È¤ò¼Â¹Ô¤·¡¢¤½¤Î·ë²Ì¤ò½¸¤á¤¿¤éÎɤ¤¤Ç¤·¤ç¤¦¤«¡£
+@~
 
+@~english
 Once you have a test suite, you'll want to run it. %CCUnit
 provides tools to define the suite to be run and to display
 its results.  You make your suite accessible to a @link
 CreatingTestSuite ccunit_makeSuite @endlink tool that generate a
 creating test suite code.
-
-For example, to make a MoneyTest suite available to a 
-@link CreatingTestSuite ccunit_makeSuite @endlink, 
-excute the following tool to 
-MoneyTest.c:
+@~japanese
+°ì¤Ä¥Æ¥¹¥È¥¹¥¤¡¼¥È¤ò½ñ¤¤¤¿¤é¡¢
+¤½¤ì¤ò¼Â¹Ô¤·¤¿¤¤¤Ç¤·¤ç¤¦¡£
+CCUnit ¤Ï¥¹¥¤¡¼¥È¤ò¼Â¹Ô¤¹¤ë¤¿¤á¤ËÄêµÁ¤·¡¢
+·ë²Ì¤òɽ¼¨¤¹¤ë¤¿¤á¤Î¥Ä¡¼¥ë¤òÄ󶡤·¤Þ¤¹¡£
+¥¹¡¼¥Ä¤ò@link CreatingTestSuite ccunit_makeSuite @endlink
+¥Ä¡¼¥ë¤ËÆþÎϤǤ­¤ë¤è¤¦¤Ê·Á¼°¤Ç½ñ¤¯¤³¤È¤Ç¡¢
+¥Æ¥¹¥È¥¹¡¼¥Ä¤òºîÀ®¤¹¤ë¥³¡¼¥É¤ò¼«Æ°Åª¤ËÀ¸À®¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+@~
+
+@~english
+For example, to make a ComplexTest suite available to a
+@link CreatingTestSuite ccunit_makeSuite @endlink,
+excute the following tool to
+ComplexTest.c:
+@~japanese
+Î㤨¤Ð¡¢ComplexTest ¥¹¥¤¡¼¥È¤ò
+@link CreatingTestSuite ccunit_makeSuite @endlink
+¤ò»È¤Ã¤Æ»ÈÍѤǤ­¤ë¤è¤¦¤Ë¤¹¤ë¤Ë¤Ï¡¢
+°Ê²¼¤Î¥Ä¡¼¥ë¤ò ComplexTest.c ¤Ë¼Â¹Ô¤·¤Þ¤¹¡£
+@~
 
 @code
-$ ccunit_makeSuite -f MoneyTest_suite -o makeMoneyTestSuite.c MoneyTest.c
+$ ccunit_makeSuite -f complex_suite -o suiteComplex.c ComplexTest.c
 @endcode
 
 @anchor test_runner_code
+@~english
 To use the TestRunner, include the header files for the tests in Main.c:
+@~japanese
+TestRunner ¤ò»ÈÍѤ¹¤ë¤Ë¤Ï¡¢
+Main.c¤Ç¥Æ¥¹¥È¤Î¤¿¤á¤Î¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Þ¤¹¡£
+@~
 
 @code
 #include <ccunit/CCUnitTestRunner.h>
 #include <ccunit/CCUnitTestSuite.h>
 @endcode
 
+@~english
 And call to
 @link ccunit_runTestRunner()
-ccunit_runTestRunner (CCUnitTestRunner*, CCUnitTestSuite *) @endlink 
+ccunit_runTestRunner (CCUnitTestRunner*, CCUnitTestSuite *) @endlink
 in the <code>main()</code> function:
+@~japanese
+¤½¤·¤Æ@link ccunit_runTestRunner()
+ccunit_runTestRunner (CCUnitTestRunner*, CCUnitTestSuite *) @endlink
+¤ò<code>main()</code>´Ø¿ô¤Ç¼Â¹Ô¤·¤Þ¤¹¡£
+@~
 
 @code
-extern CCUnitTestSuite* MoneyTest_suite(const char* name);
+extern CCUnitTestSuite* complex_suite(const char* name);
 
 int main( int argc, char **argv)
 {
   CCUnitTestRunner* runner;
   CCUnitTestSuite* suite;
   runner = ccunit_newTestRunner (stdout);
-  suite = MoneyTest_suite ("MathTest Suite");
-  ccunit_runTestRunner (runner, suite);
-  return 0;
+  suite = complex_suite ("complex test suite");
+  return ccunit_runTestRunner (runner, suite);
 }
 @endcode
 
-The @link ExecutingTest TestRunner @endlink will run the tests. 
-If all the tests pass, you'll get an informative message. 
+@~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
+@link ExecutingTest TestRunner @endlink ¤Ï¥Æ¥¹¥È¤ò¼Â¹Ô¤·¤Þ¤¹¡£
+¤â¤·¤¹¤Ù¤Æ¤Î¥Æ¥¹¥È¤¬¥Ñ¥¹¤¹¤ì¤Ð¡¢¤½¤Î¾ðÊó¤Î¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
+¤â¤·¤É¤ì¤«¤¬¼ºÇÔ¤¹¤ì¤Ð¡¢¤½¤ì¤Ë¤Ä¤¤¤Æ°Ê²¼¤Î¤è¤¦¤Ê¾ðÊó¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
+@~
 
 <ul>
-<li> The name of the source file that contains the test</li>
-<li> The line number where the failure occurred</li>
-<li> The name of the test case that failed</li>
-<li> All of the text inside the call to
-     <code>CCUNIT_ASSERT ()</code> which detected the failure</li>
+<li>@~english
+    The name of the source file that contains the test
+    @~japanese
+    ¥Æ¥¹¥È¤ò´Þ¤ó¤Ç¤¤¤ë¥½¡¼¥¹¥Õ¥¡¥¤¥ë̾
+</li>
+<li>@~english
+    The line number where the failure occurred
+    @~japanese
+    ¼ºÇÔ¤¬Åܤ俹ÔÈÖ¹æ
+</li>
+<li>@~english
+    The name of the test case that failed
+    @~japanese
+    ¼ºÇÔ¤·¤¿¥Æ¥¹¥È¥±¡¼¥¹¤Î̾Á°
+</li>
+<li>@~english
+    All of the text inside the call to
+    <code>CCUNIT_ASSERT ()</code> which detected the failure
+    @~japanese
+    ¼ºÇÔ¤ò¸¡ÃΤ·¤¿<code>CCUNIT_ASSERT ()</code>¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿»þ¤Î¾ò·ï¤Îʸ»úÎó¡£
+</li>
 </ul>
 
+@english
 @section helper_macros Helper Tool
+@japanese
+@section helper_macros ¥Ø¥ë¥Ñ¡¼¥Ä¡¼¥ë
+@endif
 
-As you might have noticed, implementing the fixture
-<code>suite ()</code> function is a repetitive and error
+@~english
+As you might have noticed, implementing the <code>suite
+()</code> function of fixture is a repetitive and error
 prone task. A @ref CreatingTestSuite set of functions and
 command have been created to automatically implements the
-<code>suite()</code> method.
-
-The following code is a rewrite of MoneyTest using those command:
+<code>suite()</code> function.
+@~japanese
+¤ªµ¤¤Å¤­¤Î¤è¤¦¤Ë¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤Î <code>suite ()</code>´Ø¿ô¤ò¼ÂÁõ¤¹¤ë¤Î¤Ï¡¢
+È¿ÉüŪ¤Ç´Ö°ã¤¤¤ä¤¹¤¤ºî¶È¤Ç¤¹¡£
+@ref CreatingTestSuite ¤Î´Ø¿ô¤Î¥»¥Ã¥È¤È¥³¥Þ¥ó¥É¤Ï<code>suite ()</code>
+´Ø¿ô¤Î¼ÂÁõ¤ò¼«Æ°Åª¤ËºîÀ®¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+@~
+
+@dontinclude complex/testComplex.c
+
+@~english
+The following code is a rewrite of ComplexTest using those command:
+@~japanese
+°Ê²¼¤Î¥³¡¼¥É¤Ï¤½¤ì¤é¤Î¥³¥Þ¥ó¥É¤¬»È¤¦¤è¤¦¤ËComplexTest¤ò½ñ´¹¤¨¤¿¤â¤Î¤Ç¤¹¡£
+@~
 
 @code
 #include <cppunit/CCUnitAssert.h>
 @endcode
 
+@~english
 First, you declare the fixture, passing the test fixture
 name to the javaDoc style comment, which consist of a
 C-style comment block starting with two <tt>*</tt>'s:
+@~japanese
+ºÇ½é¤Ë¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤òÀë¸À¤·¤Þ¤¹¡£
+¤³¤ì¤ÏjavaDoc¥¹¥¿¥¤¥ë¤Î¥³¥á¥ó¥ÈÆâ¤Ë¥Õ¥£¥¯¥¹¥Á¥ã¤Î̾Á°¤òµ­½Ò¤·¤Þ¤¹¡£
+javaDoc¥¹¥¿¥¤¥ë¤Î¥³¥á¥ó¥È¤È¤Ï C ¥¹¥¿¥¤¥ë¤Î¥³¥á¥ó¥È¥Ö¥í¥Ã¥¯¤Î³«»Ï¤¬
+Æó¤Ä¤Î¥¢¥¹¥¿¥ê¥¹¥¯<tt>*</tt>¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤â¤Î¤Ç¤¹¡£
+@~
 
 @code
-//** test case: Money test *\/
+//** test case: complex number test *\/
 @endcode
 
-The suite created by the <code>ccunit_suite()</code>
-function is specified <code>-f</code> option of command
-<code>ccunit_makeSuite</code>.  Then, you define each test
-case of the fixture with prefix <code>test</code>,
-<code>setUp</code>, <code>tearDown</code>:
+@~english
+The function to make @link CCUnitTestSuite TestSuite
+@endlink is <code>ccunit_suite</code>.
+But, it can be changed to another
+name by the <code>-f</code> option of the
+<code>ccunit_makeSuite</code> command, too.
+Then, you define each test case of the fixture with prefix
+<code>test</code>, <code>setUp</code>,
+<code>tearDown</code>:
+
+@~japanese
+@link CCUnitTestSuite TestSuite @endlink
+¤òºîÀ®¤¹¤ë´Ø¿ô¤Ï <code>ccunit_suite</code> ¤Ç¤¹¡¢
+¤·¤«¤· <code>ccunit_makeSuite</code> ¥³¥Þ¥ó¥É¤Î
+<code>-f</code> ¥ª¥×¥·¥ç¥ó¤ÇÊ̤Î̾Á°¤ËÊѤ¨¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£
+¤½¤·¤Æ¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ë¤Ï¤½¤ì¤¾¤ì̾Á°¤ÎÀèƬ¤Ë¡¢
+<code>test</code>, <code>setUp</code>,
+<code>tearDown</code> ¤ò¤Ä¤±¤Æ¤¯¤À¤µ¤¤¡£
+@~
 
 @code
-static Money* s120JPY;
-static Money* s140JPY;
-static Money* s260JPY;
-static Money* s23USD;
+#include <complex.h>
 
-void setUp_MathTest ()
+static complex_t* s10_1;
+static complex_t* s1_1;
+static complex_t* s11_2;
+
+void setUp_complex_test ()
 {
-  s120JPY = Money_new (120, "JPY");
-  s140JPY = Money_new (140, "JPY");
-  s260JPY = Money_new (260, "JPY");
-  s23USD = Money_new (23, "USD");
+  s10_1 = complex_new (10, 1);
+  s1_1 = complex_new (1, 1);
+  s11_2 = complex_new (11, 2);
 }
 
-void tearDown_Mathtest ()
+void tearDown_complex_test ()
 {
-  Money_delete (s120JPY);
-  Money_delete (s140JPY);
-  Money_delete (s260JPY);
-  Money_delete (s23USD);
+  complex_delete (s10_1);
+  complex_delete (s1_1);
+  complex_delete (s11_2);
 }
 
-//** simple add test *\/
-void test_simpleAdd ()
+//** test equals *\/
+void test_complex_equals ()
 {
-  Money* result = Money_add (s120JPY, s140JPY);
-  CCUNIT_ASSERT (Money_equals (s260JPY, result));
-  Money_delete (result);
+  CCUNIT_ASSERT_TEST_OBJ (s10_1, complex_equals, s10_1, complex_to_string);
+  CCUNIT_ASSERT_TEST_OBJ (s10_1, !complex_equals, s1_1, complex_to_string);
 }
 
-//** money bug test *\/
-void test_moneyBag()
+//** test add *\/
+void test_complex_add ()
 {
-  Money* bag[] = { s260JPY, s28USD };
-  MoneyBag expected = MoneyBag_new (2, bag);
-  Money* subtotal = Money_add (s120JPY, s28USD);
-  Money* total = Money_add (subtotal, s140JPY);
-  CCUNIT_ASSERT (MoneyBag_equals (expected, total));
-  MoneyBag_delete (expected);
-  Money_delete (subtotal);
-  Money_delete (total);
+  complex_t c10_1 = { 10.0, 1.0 };
+  complex_t c1_1 = { 1.0, 1.0 };
+  complex_t result;
+  complex_t c11_2 = { 11.0, 2.0 };
+  CCUNIT_ASSERT (complex_equals (&c11_2, complex_add (&result, &c10_1, &c1_1)));
+}
+
+//** test sub *\/
+void test_complex_sub ()
+{
+  complex_t c9_0 = { 9, 0 };
+  complex_t result;
+  CCUNIT_ASSERT_TEST_OBJ (&c9_0, complex_equals,
+                         complex_sub (&result, s10_1, s1_1),
+                         complex_to_string);
 }
 @endcode
 
+@~english
 Finally, you end the fixture declaration:
+@~japanese
+ºÇ¸å¤Ë¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤Î½ª¤ê¤òÀë¸À¤·¤Þ¤¹¡£
+@~
 
 @code
 //** end test case *\/
 @endcode
 
+@~english
 To generate creating suite function code, run
 <code>ccunit_makeSuite</code> tool.
+@~japanese
+¥¹¥¤¡¼¥ÈºîÀ®´Ø¿ô¤Î¥³¡¼¥É¤òÀ¸À®¤¹¤ë¤Ë¤Ï¡¢
+<code>ccunit_makeSuite</code>¥Ä¡¼¥ë¤ò¼Â¹Ô¤·¤Þ¤¹¡£
+@~
 
 @code
-$ ccunit_makeSuite MoneyTest.c
+$ ccunit_makeSuite -f complex_suite -o suiteComplex.c testComplex.c
+$ cat suiteComplex.c
 
 #include <ccunit/CCUnitTestSuite.h>
 #include <ccunit/CCUnitTestFixture.h>
 #include <ccunit/CCUnitTestCase.h>
 
-//* test fixture: Money test *\/
-//* setUp_MathTest *\/
-extern void setUp_MathTest ();
-//* tearDown_Mathtest *\/
-extern void tearDown_Mathtest ();
-//* simple add test *\/
-extern void test_simpleAdd ();
-//* money bug test *\/
-extern void test_moneyBag ();
+//* test fixture: complex number test *\/
+//* setUp_complex_test *\/
+extern void setUp_complex_test ();
+//* tearDown_complex_test *\/
+extern void tearDown_complex_test ();
+//* test_complex_equals *\/
+extern void test_complex_equals ();
+//* test_complex_add *\/
+extern void test_complex_add ();
+//* test_complex_sub *\/
+extern void test_complex_sub ();
+
+static CCUnitTestFunc fx_001_cases[] = {
+  {
+    "test_complex_equals",
+    "test equals",
+    test_complex_equals
+  },
+  {
+    "test_complex_add",
+    "test add",
+    test_complex_add
+  },
+  {
+    "test_complex_sub",
+    "test sub",
+    test_complex_sub
+  },
+  {
+    NULL, NULL, NULL
+  },
+};
 
 static CCUnitTestFixtureDfn fx_001 = {
   { ccunitTypeFixture },
-  "Money test",
+  "complex number test",
   {
-    "setUp_MathTest", "setUp_MathTest", setUp_MathTest,
+    "setUp_complex_test",
+    "setUp_complex_test",
+    setUp_complex_test
   },
   {
-    "tearDown_Mathtest", "tearDown_Mathtest", tearDown_Mathtest,
+    "tearDown_complex_test",
+    "tearDown_complex_test",
+    tearDown_complex_test
   },
-  {
-    {
-      "test_simpleAdd", "simple add test", test_simpleAdd,
-    },
-    {
-      "test_moneyBag", "money bug test", test_moneyBag,
-    },
-    {
-      NULL, NULL, NULL
-    },
-  }
+  fx_001_cases,
+};
+
+static CCUnitTestDfn* suite_001_test[] = {
+    &fx_001.test,
+    NULL,
 };
 
 static CCUnitTestSuiteDfn suite_001 = {
   { ccunitTypeSuite },
   "",
-  {
-    &fx_001.test,
-    NULL,
-  },
+  suite_001_test
 };
 
-CCUnitTestSuite* ccunit_suite (const char* name)
+
+CCUnitTestSuite* complex_suite (const char* name)
 {
   if (!suite_001.name[0])
     suite_001.name = name;
@@ -399,18 +700,43 @@ CCUnitTestSuite* ccunit_suite (const char* name)
 $
 @endcode
 
+@english
 @section post_build_check Post-build check
+@japanese
+@section post_build_check ¥Ó¥ë¥É¸å¤Î¥Á¥§¥Ã¥¯
+@endif
 
+@~english
 Now that we have our unit tests running, how about
 integrating unit testing to our build process ?
+@~japanese
+¤µ¤¢¥æ¥Ë¥Ã¥È¥Æ¥¹¥È¤ò¼Â¹Ô¤¹¤ë½àÈ÷¤¬¤Ç¤­¤Þ¤·¤¿¡£
+¤Ç¤Ï¥Ó¥ë¥É¥×¥í¥»¥¹¤Ë¥æ¥Ë¥Ã¥È¥Æ¥¹¥È¤òÅý¹ç¤¹¤ë¤Ë¤Ï¤É¤¦¤·¤¿¤é¤¤
+¤¤¤Ç¤·¤ç¤¦¡£
+@~
 
+@~english
 To do that, the application must returns a value different than 0 to indicate that
 there was an error.
+@~japanese
+¤½¤¦¤¹¤ë¤Ë¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¡¢¥¨¥é¡¼¤¬È¯À¸¤·¤¿¤³¤È¤ò¼¨¤¹
+£°°Ê³°¤ÎÃͤòÊÖ¤µ¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
+@~
 
-@link ccunit_runTestRunner() ccunit_runTestRunner() @endlink returns 
+@~english
+@link ccunit_runTestRunner() ccunit_runTestRunner() @endlink returns
 a integer indicating if the run was successful.
+@~japanese
+@link ccunit_runTestRunner() ccunit_runTestRunner() @endlink
+¤Ï¡¢¼Â¹Ô¤¬À®¸ù¤·¤¿¤«¤É¤¦¤«¤ò¼¨¤¹À°¿ô¤òÊÖ¤·¤Þ¤¹¡£
+@~
 
+@~english
 Updating our main programm, we obtains:
+@~japanese
+¼¡¤Î¤è¤¦¤Ë¥á¥¤¥ó¥×¥í¥°¥é¥à¤ò¹¹¿·¤·¤Þ¤¹¡£
+@~
+
 @code
 #include <ccunit/CCUnitTestRunner.h>
 
@@ -426,6 +752,14 @@ int main (int argc, char** argv)
 }
 @endcode
 
+@~english
 Now, you need to run your application after compilation.
+The sample program made in the above is in the examples/complex directory.
+@~japanese
+¤½¤ì¤Ç¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¥³¥ó¥Ñ¥¤¥ë¤·¤¿¸å¤Ë¼Â¹Ô¤·¤Æ¤ß¤Þ¤·¤ç
+¤¦¡£
+°Ê¾å¤ÇºîÀ®¤·¤¿¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ï examples/complex ¥Ç¥£¥ì¥¯
+¥È¥ê¤Ë¤¢¤ê¤Þ¤¹¡£
+@~
 
 */