@code
$ gcc -o runTestCaseSetup runTestCaseSetup.c testComplexSetup.c complex.c -lccunit
-$ ./runTestCase
-$ echo $?
-0
+$ ./runTestCaseSetup
+..
+Time: 0.000048 sec
+
+OK (2 tests)
@endcode
@english
@section one_time_setUp_tearDown °ì²ó¤À¤±¤Î setUp/tearDown
@endif
-
@english
-Calling sequence of test cases in a fixture is following:
@japanese
-¤Ò¤È¤Ä¤Î¥Õ¥£¥¯¥¹¥Á¥ã¤ÎÃæ¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Î¼Â¹Ô¥·¡¼¥±¥ó¥¹¤Ï¼¡¤Î¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
+Á°¤ÎÀá¤Ç¤Ï¥Æ¥¹¥È¤´¤È¤ËËè²ó½é´ü²½¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤·¤¿¡£
+°ì²ó¤À¤±½é´ü²½¤ò¹Ô¤Ã¤Æ¡¢
+Ê£¿ô¤Î¥Æ¥¹¥È¤ò¼Â¹Ô¤·¤¿¤¤¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡£
+¤½¤·¤Æ¥Æ¥¹¥È¤¬Á´¤Æ½ª¤ï¤Ã¤¿¤È¤¤À¤±¸å»ÏËö¤Î¥³¡¼¥É¤ò¼Â¹Ô¤¹¤ë¤è¤¦¤Ê¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡£
+
+¤½¤Î¤¿¤á¤Ë¤Ï¥Æ¥¹¥È¥±¡¼¥¹¤Ë
+@c setup_setUp/setup_tearDown ´Ø¿ô¤òÅÐÏ¿¤·¤Þ¤¹¡£
+¤¹¤ë¤È¼¡¤Î¤è¤¦¤Ê½ç½ø¤Ç¥Æ¥¹¥È´Ø¿ô¤¬¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
@endif
@dot
}
@enddot
+
@english
-The sample code made in the above is in the directory <code>examples/complex</code>,
-the files <code>testComplex.c</code> and <code>runTestCase.c</code>.
+@section suite Suite
@japanese
-¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢<code>examples/complex</code> ¥Ç¥£¥ì¥¯¥È¥ê¤Î
-<code>testComplex.c, runTestCase.c</code> ¤Ë¤¢¤ê¤Þ¤¹¡£
-
-¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
+@section suite ¥¹¡¼¥Ä
@endif
-@code
-$ gcc -I. -o runTestCase runTestCase.c testComplex.c complex.c -lccunit
-$ ./runTestCase
-@endcode
-
@~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
-°ìÅÙ¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¤òºî¤Ã¤¿¤é¡¢
-¤½¤ì¤é¤ò¥¹¡¼¥Ä¤ËÀ°Íý¤·¤Þ¤¹¡£
+Ê£¿ô¤Î¥Æ¥¹¥È¤òÁ´Éô°ìÅ٤˼¹Ԥ¹¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë½àÈ÷¤¹¤ë¤Ë¤Ï¡¢
+¤É¤Î¤è¤¦¤Ë¤·¤¿¤é¤¤¤¤¤Ç¤·¤ç¤¦¤«¡©
+¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¤òºî¤Ã¤¿¤é¡¢
+¤½¤ì¤é¤ò¥¹¡¼¥Ä (¥¹¥¤¡¼¥È) ¤ËÀ°Íý¤·¤Þ¤¹¡£
@~
-@english
-@section suite Suite
-@japanese
-@section suite ¥¹¡¼¥Ä
-@endif
-
@dot
digraph TestStructure {
node [ fontsize=9, fontname=Helvetica ];
@enddot
@~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 TestFuncs together.
+You saw, above, how to run test suite.
@~japanese
CCUnit ¤Ï¤¤¤¯¤Ä¤â¤Î @link CCUnitTestFunc TestFuncs @endlink
¤ò°ì½ï¤Ë¼Â¹Ô¤¹¤ë
@link CCUnitTestSuite TestSuite @endlink ¥â¥¸¥å¡¼¥ë¤òÄ󶡤·¤Þ¤¹¡£
-@~
-
-@~english
-You saw, above, how to run test testCase.
-@~japanese
-¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤ò¼Â¹Ô¤¹¤ëÊýË¡¤Ï¾å½Ò¤·¤Þ¤·¤¿¡£
+¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼Â¹Ô¤¹¤ëÊýË¡¤Ï¤¹¤Ç¤ËÁ°¤ÎÊý¤Ç¼¨¤·¤Æ¤¢¤ê¤Þ¤¹¡£
@~
@~english
Æó¤Ä°Ê¾å¤Î¥Æ¥¹¥È¤ò´Þ¤à°ì¤Ä¤Î¥¹¡¼¥Ä¤òºî¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
@~
+@dontinclude complex/runTestSuite.c
+
+@skip main
+@until test_complex_div);
+
+@english
+@japanese
+¥Æ¥¹¥È¥±¡¼¥¹¤òÆó¤ÄÀ¸À®¤·¡¢¤½¤ì¤¾¤ì¤Ë¥Æ¥¹¥È´Ø¿ô¤òÅÐÏ¿¤·¤Þ¤¹¡£
+@endif
+
+@until testArith);
+
+@english
+@japanese
+¥Æ¥¹¥È¥¹¡¼¥Ä¤òÀ¸À®¤·¡¢
+¥Æ¥¹¥È¥±¡¼¥¹¤òÅÐÏ¿¤·¤Þ¤¹¡£
+@endif
+
+@until }
+
+@english
+@japanese
+¥Æ¥¹¥È¥é¥ó¥Ê¡¼¤òÀ¸À®¤·¥Æ¥¹¥È¤ò¼Â¹Ô¤·¤Þ¤¹¡£
+@endif
+
+@english
+The sample code made in the above is in the directory <code>examples/complex</code>,
+the files are <code>runTestSuite.c</code>, <code>testComplex.c</code>
+and <code>testComplexArith.c</code>.
+@japanese
+¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢<code>examples/complex</code> ¥Ç¥£¥ì¥¯¥È¥ê¤Î
+<code>runTestSuite.c, testComplex.c, testComplexArith.c</code>
+¤Ë¤¢¤ê¤Þ¤¹¡£
+
+¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
+@endif
+
@code
-int main ()
-{
- CCUnitTestSuite* suite;
- CCUnitTestCase* testCase;
- CCUnitTestResult* result;
- suite = ccunit_newTestSuite ("Complex test suite");
- testCase = ccunit_newTestCase ("Complex Tests",
- CCUNIT_NEWTESTFUNC(setUp_complex_test),
- CCUNIT_NEWTESTFUNC(tearDown_complex_test));
- ccunit_addNewTestFunc (testCase, "test_complex_equals", "complex equals test",
- test_complex_equals);
- ccunit_addNewTestFunc (testCase, "test_complex_add", "complex add test",
- test_complex_add);
- ccunit_addNewTestFunc (testCase, "test_complex_sub", "complex sub test",
- test_complex_sub);
- ccunit_addTestCase (suite, fixtuer);
- result = ccunit_runTestSuite (suite, NULL);
- return 0;
-}
+$ gcc -I. -o runTestSuite runTestSuite.c testComplex.c testComplexArith.c complex.c -lccunit
+$ ./runTestSuite
+......
+Time: 0.000061 sec
+
+OK (6 tests)
@endcode
-@~english
+@english
@link CCUnitTestSuite TestSuites @endlink don't only have to
contain @link CCUnitTestCase TestCases @endlink. They
can contain any object that implements the @link CCUnitTest
Test @endlink interface. For example, you can create a
@link CCUnitTestSuite TestSuite @endlink
-(<code>complex_add_sub_suite ()</code>) in your code and I
-can create one in mine
-(<code>complex_mul_div_suite ()</code>), and we can run them together by
+in your code and I
+can create one in mine, and we can run them together by
creating a @link CCUnitTestSuite TestSuite @endlink that
contains both:
-@~japanese
+@japanese
@link CCUnitTestSuite TestSuites @endlink ¤Ï
@link CCUnitTestCase TestCases @endlink
¤ò´Þ¤à¤À¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
@link CCUnitTestSuite TestSuites @endlink ¼«¿È¤ò´Þ¤à¤³¤È¤â¤Ç¤¤Þ¤¹¡£
-<!--
-¤½¤ì¤é¤Ï @link CCUnitTest Test @endlink
-¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò¼ÂÁõ¤¹¤ë¤É¤ó¤Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤â´Þ¤á¤é¤ì¤Þ¤¹¡£
--->
Î㤨¤Ð¡¢¤¢¤Ê¤¿¤Ï¤¢¤Ê¤¿¤Î¥³¡¼¥É¤Ë @link CCUnitTestSuite TestSuite @endlink
-(<code>complex_add_sub_suite ()</code>)
¤òºî¤ë¤³¤È¤¬¤Ç¤¡¢
¤½¤·¤Æ»ä¤Ï»ä¤Î¥¹¡¼¥Ä
-(<code>complex_mul_div_suite ()</code>)
¤òºî¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡¢
¤½¤·¤Æ»äã¤ÏξÊý¤È¤â¤ò´Þ¤ó¤Ç¤¤¤ë @link CCUnitTestSuite TestSuite @endlink
-¤òºî¤Ã¤Æ°ì½ï¤Ë¤½¤ì¤¾¤ì¤Î¥¹¡¼¥Ä¤òÆ°¤«¤¹¤³¤È¤¬¤Ç¤¤ë¤Î¤Ç¤¹¡£
-@~
+¤òºî¤Ã¤Æ¡¢
+°ì½ï¤Ë¤½¤ì¤¾¤ì¤Î¥¹¡¼¥Ä¤òÆ°¤«¤¹¤³¤È¤¬¤Ç¤¤ë¤Î¤Ç¤¹¡£
+@endif
@code
CCUnitTestSuite* suite;
- CCUnitTestResult* result;
- suite = ccunit_newTestSuite ("Complex add/sub/mul/div test suite");
- ccunit_addTestSuite (suite, complex_add_sub_suite ());
- ccunit_addTestSuite (suite, complex_mul_div_suite ());
- result = ccunit_runTestSuite(suite, NULL);
-@endcode
+ CCUnitTestSuite* suite_a;
+ CCUnitTestSuite* suite_b;
-@english
-The sample code made in the above is in the directory <code>examples/complex</code>,
-the files <code>testComplex.c</code>, <code>testComplexMulDiv.c</code>,
-<code>complexTestSuite.c</code> and <code>runTestSuite.c</code>.
-@japanese
-¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢<code>examples/complex</code> ¥Ç¥£¥ì¥¯¥È¥ê¤Î
-<code>testComplex.c, testComplexMulDiv.c, complexTestSuite.c, runTestSuite.c</code>
-¤Ë¤¢¤ê¤Þ¤¹¡£
+ ...
-¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
-@endif
+ suite = ccunit_newTestSuite ("complex all test suite");
+ suite_a = ccunit_newTestSuite ("complex test suite A");
+ suite_b = ccunit_newTestSuite ("complex test suite B");
-@code
-$ gcc -I. -o runTestSuite runTestSuite.c testComplex.c testComplexMulDiv.c complexTestSuite.c complex.c -lccunit
-$ ./runTestSuite
+ ...
+
+ ccunit_addTestSuite (suite, suite_a);
+ ccunit_addTestSuite (suite, suite_b);
@endcode
@english