<ol>
<li> @~english Create a test function
- @~japanese ¥Æ¥¹¥È´Ø¿ô¤òºî¤ë
+ @~japanese ¥Æ¥¹¥È´Ø¿ô¤òºî¤ê¤Þ¤¹¡£
@~
</li>
<li> @~english When you want to check a value, call
- @~japanese Ãͤò¥Á¥§¥Ã¥¯¤·¤¿¤¤¾ì¹ç¤Ï¡¢@~
@link CCUNIT_ASSERT() CCUNIT_ASSERT(bool) @endlink
- @~english and pass a bool that is true if the test succeeds
- @~japanese ¤ò¸Æ¤Ó½Ð¤·¤Æ¡¢
- ¤â¤·¥Æ¥¹¥È¤¬À®¸ù¤¹¤ë¤Ê¤é¿¿¤òÊÖ¤¹¤è¤¦¤Ê¿¿µ¶ÃͤòÅϤ·¤Þ¤¹@~
+ and pass a bool that is true if the test succeeds
+ @~japanese Ãͤò¥Á¥§¥Ã¥¯¤·¤¿¤¤¾ì¹ç¤Ï¡¢
+ @link CCUNIT_ASSERT() CCUNIT_ASSERT(bool) @endlink
+ ¤ò¸Æ¤Ó½Ð¤·¤Æ¡¢
+ ¥Æ¥¹¥È¤¬À®¸ù¤¹¤ë¤Ê¤é¿¿¤òÊÖ¤¹¤è¤¦¤Ê¿¿µ¶ÃͤòÅϤ·¤Þ¤¹¡£
+ @~
@~english ASSERT macro is listed in others as well in
@link Assertions Making assertions @endlink.
</ol>
@~english
-For example, to test that the sum of two complex number
+!!!For example, to test that the sum of two complex number
which is the sum of the values of two complex numbers,
-write:
+write (This sample program is in the @c examples/complex directory):
@~japanese
-Î㤨¤Ð¡¢Æó¤Ä¤ÎÊ£ÁÇ¿ô¤Î¹ç·×¤¬¡¢
-Æó¤Ä¤ÎÊ£ÁÇ¿ô¤ÎÃͤò²Ã»»¤·¤¿ÃͤÈƱ¤¸¤Ç¤¢¤ë¤³¤È¤ò¥Æ¥¹¥È¤¹¤ë¤È¤·¤Þ¤¹¡£
+Î㤨¤Ð¡¢´Êñ¤ÊÊ£ÁÇ¿ô¤Î¥é¥¤¥Ö¥é¥ê¤ò¥Æ¥¹¥È¤¹¤ë¤³¤È¤òÎã¤Ë¤È¤Ã¤Æ¤ß¤Þ¤·¤ç¤¦¡£
¡Ê¤³¤³¤Ç»ÈÍѤ¹¤ë¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ï
examples/complex ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ê¤Þ¤¹¡£¡Ë
+Ê£ÁÇ¿ô¤ò½é´ü²½¤¹¤ë¤³¤È¤¬¤Ç¤¤¿¤«¤ò¥Æ¥¹¥È¤·¤¿¤ê¡¢
+Æó¤Ä¤ÎÊ£ÁÇ¿ô¤¬Åù¤·¤¤¤«¤ò¥Æ¥¹¥È¤¹¤ë¤È¤·¤Þ¤¹¡£
@~
-@~english
-This sample program is in the examples/complex directory.
-@~
+@dontinclude complex/testComplex.c
+
+@skip test_complex_new
+@until }
+@skip test_complex_equals
+@until }
+
+@english
+@japanese
+¤³¤ÎÆó¤Ä¤Î¥Æ¥¹¥È´Ø¿ô¤ò¤Þ¤È¤á¤Æ¤Ò¤È¤Ä¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ë¤·¤Æ¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
+@endif
+
+@dontinclude complex/runTestCase.c
+
+@skip main
+@until ccunit_newTestCase
+
+@english
+@japanese
+¤Þ¤º¥Æ¥¹¥È¥±¡¼¥¹¤Ë¥á¥â¥ê¤ò³ä¤êÅö¤Æ¤Þ¤¹¡£
+@endif
+
+@until test_complex_equals);
+
+@english
+@japanese
+¤½¤·¤Æ¥Æ¥¹¥È¥±¡¼¥¹¤Ë¥Æ¥¹¥È´Ø¿ô¤òÅÐÏ¿¤·¤Þ¤¹¡£
+ɽÌÀ (ASSERT) ¤¬¼ºÇÔ¤·¤¿»þ¤Ëɽ¼¨¤¹¤ë¤¿¤á¤Î´Ø¿ô̾¤È´Ø¿ô¤ÎÀâÌÀ¤ò°ì½ï¤Ë»ØÄꤷ¤Æ¤¤¤Þ¤¹¡£
+@endif
+
+@until }
+
+@english
+@japanese
+¥Æ¥¹¥È¥±¡¼¥¹¤ò¼Â¹Ô¤·¡¢
+·ë²Ì¤òÊÖ¤·¤Þ¤¹¡£
+@endif
+
+@english
+The sample code made in the above is in the directory <code>examples/complex</code>,
+the files are @c testComplex.c and <code>runTestCase.c</code>.
+@japanese
+¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢@c examples/complex ¥Ç¥£¥ì¥¯¥È¥ê¤Î
+<code>testComplex.c, runTestCase.c</code> ¤Ë¤¢¤ê¤Þ¤¹¡£
+
+¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
+@endif
@code
-void test_complex_add ()
-{
- 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)));
-}
+$ gcc -o runTestCase runTestCase.c testComplex.c complex.c -lccunit
+$ ./runTestCase
+$ echo $?
+0
@endcode
@~english
objects. To do this, use a fixture.
@~japanese
¤³¤ì¤ÏÂçÊÑñ½ã¤Ê¥Æ¥¹¥È¤Ç¤¹¡£
-Ä̾Ʊ¤¸¥Ç¡¼¥¿¤Î¥»¥Ã¥È¤ÇÁö¤é¤»¤ë¤¿¤á¤Ë¡¢
-¤¿¤¯¤µ¤ó¤Î¾®¤µ¤Ê¥Æ¥¹¥È¥±¡¼¥¹¤òºî¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Ç¤·¤ç¤¦¡£
-¤½¤³¤Ç¥Õ¥£¥¯¥¹¥Á¥ã¡ÊÈ÷Éʡˤò»È¤¤¤Þ¤¹¡£
+Ä̾
+¤¿¤¯¤µ¤ó¤Î¾®¤µ¤Ê¥Æ¥¹¥È´Ø¿ô¤òºî¤Ã¤Æ¡¢
+Ʊ¤¸¤è¤¦¤Ê¥Ç¡¼¥¿¤Î½¸¤Þ¤ê¤ò»È¤Ã¤Æ¥Æ¥¹¥È¤ò¹Ô¤¦¤³¤È¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£
+¤Ä¤Þ¤ê³Æ¥Æ¥¹¥È´Ø¿ô¶¦Ä̤Υ°¥í¡¼¥Ð¥ëÊÑ¿ô¤ò»È¤¦¤ÈÊØÍø¤Ç¤¹¡£
+¤³¤Î¤è¤¦¤Ê¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤ò¥Õ¥£¥¯¥¹¥Á¥ã (È÷ÉÊ) ¤È¸À¤¤¤Þ¤¹¡£
@~
@english
What if you have two or more tests that operate on the same
similar set of objects?
@~japanese
-¤â¤·Æó¤Ä°Ê¾å¤Î¥Æ¥¹¥È¤¬¤¢¤ë¤Ê¤é¡¢
-Ʊ¤¸Îà»÷¤Î¥Ç¡¼¥¿¤Î½¸¤Þ¤ê¤ò»È¤¦¤Î¤Ç¤Ï¤Ê¤¤¤Ç¤·¤ç¤¦¤«¡£
+¤â¤·Ê£¿ô¤Î¥Æ¥¹¥È´Ø¿ô¤¬¤¢¤ë¤Ê¤é¡¢
+Ʊ¤¸¥Ç¡¼¥¿¤Î½¸¤Þ¤ê¤ò¤¤¤¯¤Ä¤«»È¤¦¤Î¤Ç¤Ï¤Ê¤¤¤Ç¤·¤ç¤¦¤«¡£
@~
@dot
digraph TestCase {
node [ fontsize=9, fontname=Helvetica ]
edge [ fontsize=9, dir=back, arrowtail=vee ]
- gv [ label="Data\n(Global variables)", shape=box ]
+ gv [ label="Fixture\n(Global variables)", shape=box ]
{ rank=same;
tc1 [ label="Test case 1" ];
tcn [ label="Test case n" ];
°Û¤Ê¤ë·ë²Ì¤òÄ´¤Ù¤ë¤³¤È¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£
¤½¤·¤Æ¥Æ¥¹¥È¤¬½ª¤ï¤Ã¤¿¤é¡¢
¥Õ¥£¥¯¥¹¥Á¥ã¤ò¸å»ÏËö¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
-¤³¤ì¤é¤Î¥Õ¥£¥¯¥¹¥Á¥ã¤È¡¢
-¥Õ¥£¥¯¥¹¥Á¥ã¤ò½é´ü²½¡¦ÍøÍÑ¡¦¸å»ÏËö¤¹¤ë¥Æ¥¹¥È´Ø¿ô¤Î½¸¤Þ¤ê¤ò¡¢
-¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤È¸Æ¤Ö¤³¤È¤Ë¤·¤Þ¤¹
-(¤â¤·¤¯¤Ïά¤·¤Æñ¤Ë¥Õ¥£¥¯¥¹¥Á¥ã¤È¸Æ¤Ó¤Þ¤¹¡£)
@~
@dot
node [ fontsize=9, fontname=Helvetica ]
edge [ fontsize=9, dir=back, arrowtail=vee ]
rankdir=TB;
- subgraph cluster_fixture {
- fontsize=9;
- label="Test Fixture";
- gv [ label="Fixture\n(Data)", shape=box ]
- { rank=same;
- ssu [ label="setup_setUp" ];
- su [ label="setUp" ];
- tc [ label="TestCases" ];
- td [ label="tearDown" ];
- std [ label="setup_tearDown" ];
- }
- gv -> ssu [ label="initialize" ];
- gv -> su [ label="initialize\neach test" ];
- gv -> tc [ label="access" ];
- gv -> td [ label="clean-up\neach test" ];
- gv -> std [ label="clean-up" ];
+ gv [ label="Fixture\n(Data)", shape=box ]
+ { rank=same;
+ su [ label="setUp" ];
+ tc [ label="TestCases" ];
+ td [ label="tearDown" ];
}
+ gv -> su [ label="initialize\neach test" ];
+ gv -> tc [ label="access" ];
+ gv -> td [ label="clean-up\neach test" ];
}
@enddot
@~english
When you have a common fixture, here is what you do:
@~japanese
-¤â¤·³Æ¥Æ¥¹¥È¤Ë¶¦Ä̤¹¤ë¥Ç¡¼¥¿¤¬¤¢¤ì¤Ð¡¢
-°Ê²¼¤Î¤è¤¦¤Ë¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤òºî¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
+¤â¤·³Æ¥Æ¥¹¥È¤Ë¶¦Ä̤Υե£¥¯¥¹¥Á¥ã¤¬¤¢¤ì¤Ð¡¢
+¼¡¤Î¤è¤¦¤Ë¤¹¤ë¤³¤È¤Ç¤·¤ç¤¦¡£
@~
<ol>
<li>@~english
- Create a @link CCUnitTestCase TestCase @endlink object
+ Create a @link CCUnitTestFunc TestFunc @endlink object
@~japanese
- @link CCUnitTestCase TestCase @endlink ¹½Â¤ÂΤ˥á¥â¥ê¤ò³ä¤êÅö¤Æ¤Þ¤¹
+ @link CCUnitTestFunc TestFunc @endlink ¹½Â¤ÂΤ˥á¥â¥ê¤ò³ä¤êÅö¤Æ¤Þ¤¹
¡Ê°Ê¹ß¡¢¹½Â¤ÂΤ˳ä¤êÅö¤Æ¤¿¥á¥â¥ê¤ò¡¢¥ª¥Ö¥¸¥§¥¯¥È¤È¸Æ¤Ö¤³¤È¤Ë¤·¤Þ¤¹¡Ë
@~
</li>
<li>@~english
- Add an global variable for each part of the fixture
+ Add an global variable for each part of the case
@~japanese
¥Õ¥£¥¯¥¹¥Á¥ã¤Î¥¹¥³¡¼¥×Æâ¤ËÂç°èÊÑ¿ô¤òÄêµÁ¤·¤Þ¤¹
@~
@endif
</li>
<li>@~english
- Create a @link CCUnitTestFixture TestFixture @endlink object
+ Create a @link CCUnitTestCase TestCase @endlink object
@~japanese
- @link CCUnitTestFixture TestFixture @endlink
+ @link CCUnitTestCase TestCase @endlink
¹½Â¤ÂΤ˥á¥â¥ê¤ò³ä¤êÅö¤Æ¤Þ¤¹
@~
</li>
<li>@~english
- Add @link CCUnitTestCase TestCase @endlink objects to fixture object
+ Add @link CCUnitTestFunc TestFunc @endlink objects to case object
@~japanese
- @link CCUnitTestCase TestCase @endlink ¥ª¥Ö¥¸¥§¥¯¥È¤ò
- @link CCUnitTestFixture TestFixture @endlink
+ @link CCUnitTestFunc TestFunc @endlink ¥ª¥Ö¥¸¥§¥¯¥È¤ò
+ @link CCUnitTestCase TestCase @endlink
¥ª¥Ö¥¸¥§¥¯¥È¤ËÅÐÏ¿¤·¤Þ¤¹¡£
@~
</li>
@~english
For example, to write several test cases, first create a
-fixture:
+case:
@~japanese
Î㤨¤Ð¡¢¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¥±¡¼¥¹¤ò½ñ¤¯¾ì¹ç¡¢
ºÇ½é¤Ë¥Õ¥£¥¯¥¹¥Á¥ã¤òºîÀ®¤·¤Þ¤¹¡£
int main ()
{
- CCUnitTestFixture* fixture;
- fixture = ccunit_newTestFixture ("complex test",
+ CCUnitTestCase* testCase;
+ testCase = ccunit_newTestCase ("complex test",
CCUNIT_NEWTESTFUNC(setUp_complex_test),
CCUNIT_NEWTESTFUNC(tearDown_complex_test));
- ccunit_setTestFixturSetup (fixture,
+ ccunit_setTestFixturSetup (testCase,
CCUNIT_NEWTESTFUNCTION(setup_setUp_complex_test),
CCUNIT_NEWTESTFUNCTION(setup_tearDown_complex_test));
@endcode
@~english
-Once you have the Fixture in place, you can write as complex
+Once you have the TestCase in place, you can write as complex
Test Cases as you'd like.
@~japanese
°ìÅÙ·è¤Þ¤Ã¤¿¤È¤³¤í¤Ë¥Õ¥£¥¯¥¹¥Á¥ã¤ò½ñ¤¤¤Æ¤·¤Þ¤¨¤Ð¡¢
{
...
- ccunit_addNewTestCase (fixture,
+ ccunit_addNewTestFunc (testCase,
"test_complex_equals",
"complex equals test",
test_complex_equals);
@code
CCUnitTestResult* result;
- result = ccunit_runTestFixture (fixture);
+ result = ccunit_runTestCase (testCase);
return 0;
}
@endcode
@endif
@dot
-digraph FixtureCallingSequence {
+digraph TestCaseCallingSequence {
node [ fontsize=9, fontname=Helvetica ]
edge [ fontsize=9 ]
rankdir = LR;
}
setup_setUp -> setUp [ weight=8 ];
setup_setUp -> setUp2 [ style=invis ];
- setUp -> "TestCase 1" [ weight=8 ];
- "TestCase 1" -> tearDown [ weight=8 ];
- setUp2 -> "TestCase n" [ weight=8 ];
+ setUp -> "TestFunc 1" [ weight=8 ];
+ "TestFunc 1" -> tearDown [ weight=8 ];
+ setUp2 -> "TestFunc n" [ weight=8 ];
tearDown2 [ label="tearDown" ];
- "TestCase n" -> tearDown2;
+ "TestFunc n" -> tearDown2;
tearDown2 -> setup_tearDown;
tearDown -> setUp2;
}
@english
The sample code made in the above is in the directory <code>examples/complex</code>,
-the files <code>testComplex.c</code> and <code>runTestFixture.c</code>.
+the files <code>testComplex.c</code> and <code>runTestCase.c</code>.
@japanese
¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢<code>examples/complex</code> ¥Ç¥£¥ì¥¯¥È¥ê¤Î
-<code>testComplex.c, runTestFixture.c</code> ¤Ë¤¢¤ê¤Þ¤¹¡£
+<code>testComplex.c, runTestCase.c</code> ¤Ë¤¢¤ê¤Þ¤¹¡£
¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
@endif
@code
-$ gcc -I. -o runTestFixture runTestFixture.c testComplex.c complex.c -lccunit
-$ ./runTestFixture
+$ gcc -I. -o runTestCase runTestCase.c testComplex.c complex.c -lccunit
+$ ./runTestCase
@endcode
@~english
-When the test fixture is run, that specific test functions
+When the test testCase 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
node [ fontsize=9, fontname=Helvetica ];
edge [ dir=back, fontsize=9 ];
TestSuite -> TestSuite [ label="1..n" ];
- TestFixture;
- TestSuite -> TestFixture [ label="1..n" ];
- TestFixture -> setup_setUp [ label="0..1" ];
- TestFixture -> setUp [ label="0..1" ];
TestCase;
- TestFixture -> TestCase [ label="1..n" ];
- TestFixture -> tearDown [ label="0..1" ];
- TestFixture -> setup_tearDown [ label="0..1" ];
+ TestSuite -> TestCase [ label="1..n" ];
+ TestCase -> setup_setUp [ label="0..1" ];
+ TestCase -> setUp [ label="0..1" ];
+ TestFunc;
+ TestCase -> TestFunc [ label="1..n" ];
+ TestCase -> tearDown [ label="0..1" ];
+ TestCase -> setup_tearDown [ label="0..1" ];
}
@enddot
@~english
CCUnit provides a @link CCUnitTestSuite TestSuite @endlink
-module that runs any number of TestCases together.
+module that runs any number of TestFuncs together.
@~japanese
-CCUnit ¤Ï¤¤¤¯¤Ä¤â¤Î @link CCUnitTestCase TestCases @endlink
+CCUnit ¤Ï¤¤¤¯¤Ä¤â¤Î @link CCUnitTestFunc TestFuncs @endlink
¤ò°ì½ï¤Ë¼Â¹Ô¤¹¤ë
@link CCUnitTestSuite TestSuite @endlink ¥â¥¸¥å¡¼¥ë¤òÄ󶡤·¤Þ¤¹¡£
@~
@~english
-You saw, above, how to run test fixture.
+You saw, above, how to run test testCase.
@~japanese
¥Æ¥¹¥È¥Õ¥£¥¯¥¹¥Á¥ã¤ò¼Â¹Ô¤¹¤ëÊýË¡¤Ï¾å½Ò¤·¤Þ¤·¤¿¡£
@~
int main ()
{
CCUnitTestSuite* suite;
- CCUnitTestFixture* fixture;
+ CCUnitTestCase* testCase;
CCUnitTestResult* result;
suite = ccunit_newTestSuite ("Complex test suite");
- fixture = ccunit_newTestFixture ("Complex Tests",
+ testCase = ccunit_newTestCase ("Complex Tests",
CCUNIT_NEWTESTFUNC(setUp_complex_test),
CCUNIT_NEWTESTFUNC(tearDown_complex_test));
- ccunit_addNewTestCase (fixture, "test_complex_equals", "complex equals test",
+ ccunit_addNewTestFunc (testCase, "test_complex_equals", "complex equals test",
test_complex_equals);
- ccunit_addNewTestCase (fixture, "test_complex_add", "complex add test",
+ ccunit_addNewTestFunc (testCase, "test_complex_add", "complex add test",
test_complex_add);
- ccunit_addNewTestCase (fixture, "test_complex_sub", "complex sub test",
+ ccunit_addNewTestFunc (testCase, "test_complex_sub", "complex sub test",
test_complex_sub);
- ccunit_addTestFixture (suite, fixtuer);
+ ccunit_addTestCase (suite, fixtuer);
result = ccunit_runTestSuite (suite, NULL);
return 0;
}
@~english
@link CCUnitTestSuite TestSuites @endlink don't only have to
-contain @link CCUnitTestFixture TestFixtures @endlink. They
+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
contains both:
@~japanese
@link CCUnitTestSuite TestSuites @endlink ¤Ï
-@link CCUnitTestFixture TestFixtures @endlink
+@link CCUnitTestCase TestCases @endlink
¤ò´Þ¤à¤À¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
@link CCUnitTestSuite TestSuites @endlink ¼«¿È¤ò´Þ¤à¤³¤È¤â¤Ç¤¤Þ¤¹¡£
<!--
@~english
How do you run your tests and collect their results?
-The fixtures store result of own tests into
+The testCases store result of own tests into
the @link CCUnitTestResult TestResult @endlink.
@~japanese
¤É¤¦¤ä¤Ã¤Æ¥Æ¥¹¥È¤ò¼Â¹Ô¤·¡¢¤½¤Î·ë²Ì¤ò½¸¤á¤¿¤éÎɤ¤¤Ç¤·¤ç¤¦¤«¡£
node [ fontsize=9, fontname=Helvetica ]
{ rank=same;
edge [ fontsize=9, fontname=Courier ]
- TestFixture -> TestResult [ label="TestFailure", style=dotted, arrowhead=vee ];
+ TestCase -> TestResult [ label="TestFailure", style=dotted, arrowhead=vee ];
}
edge [ fontsize=9, dir=back ]
- TestFixture -> setUp;
- TestFixture -> "TestCase 1..n";
- TestFixture -> tearDown;
+ TestCase -> setUp;
+ TestCase -> "TestFunc 1..n";
+ TestCase -> tearDown;
TestResult -> "TestFailure 0..m";
}
@enddot
@~english
As you might have noticed, implementing the <code>suite
-()</code> function of fixture is a repetitive and error
+()</code> function of testCase 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> function.
@~
@~english
-First, you declare the fixture, passing the test fixture
+First, you declare the testCase, passing the test testCase
name to the javaDoc style comment, which consist of a
C-style comment block starting with two <tt>*</tt>'s:
@~japanese
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
+Then, you define each test case of the testCase with prefix
<code>test</code>, <code>setUp</code>,
<code>tearDown</code>:
@~japanese
@endcode
@~english
-Finally, you end the fixture declaration:
+Finally, you end the testCase declaration:
@~japanese
ºÇ¸å¤Ë¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤Î½ª¤ê¤òÀë¸À¤·¤Þ¤¹¡£
@~
$ cat suiteComplex.c
#include <ccunit/CCUnitTestSuite.h>
-#include <ccunit/CCUnitTestFixture.h>
#include <ccunit/CCUnitTestCase.h>
+#include <ccunit/CCUnitTestFunc.h>
-//* test fixture: complex number test *\/
+//* test testCase: complex number test *\/
//* setUp_complex_test *\/
extern void setUp_complex_test ();
//* tearDown_complex_test *\/
},
};
-static CCUnitTestFixtureDfn fx_001 = {
- { ccunitTypeFixture },
+static CCUnitTestCaseDfn fx_001 = {
+ { ccunitTypeTestCase },
"complex number test",
{
"setup_setUp_complex_test",
@endcode
@english
-Fixtures can be packaged into test suite.
-You declare the suite before fixtures.
+TestCases can be packaged into test suite.
+You declare the suite before testCases.
@japanese
¤Ê¤ª¡¢¤¤¤¯¤Ä¤«¤Î¥Õ¥£¥¯¥¹¥Á¥ã¤ò¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤Þ¤È¤á¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£
¤½¤Î¤¿¤á¤Ë¤Ï¡¢¥Õ¥£¥¯¥¹¥Á¥ã¤ÎÄêµÁ¤ÎÁ°¤Ë¥Æ¥¹¥È¥¹¡¼¥Ä¤òÀë¸À¤·¤Þ¤¹¡£
- libcomplex.a - complex number library
- complex.c
- complex.h
- - runTestFixture @~japanese - ¤â¤Ã¤È¤âñ½ã¤Ê¥Æ¥¹¥È¥±¡¼¥¹¤ò¼Â¹Ô¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
- - runTestFixture.c - main program
+ - runTestCase @~japanese - ¤â¤Ã¤È¤âñ½ã¤Ê¥Æ¥¹¥È¥±¡¼¥¹¤ò¼Â¹Ô¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
+ - runTestCase.c - main program
- testComplex.c - test cases
- runTestSuite @~japanese - ¥Æ¥¹¥È¥¹¡¼¥Ä¤Î¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
- runTestSuite.c - main program