and tow complex numbers are equal.
@japanese
Î㤨¤Ð¡¢´Êñ¤ÊÊ£ÁÇ¿ô¤Î¥é¥¤¥Ö¥é¥ê¤Î¥Æ¥¹¥È¤òÎã¤Ë¤È¤Ã¤Æ¤ß¤Þ¤·¤ç¤¦¡£
-¡Ê¤³¤³¤Ç»ÈÍѤ¹¤ë@ref sample_programs¤Ï
+¡Ê¤³¤³¤Ç»ÈÍѤ¹¤ë@ref sample_programs ¤Ï
@c examples/complex ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ê¤Þ¤¹¡£¡Ë
Ê£ÁÇ¿ô¤ò½é´ü²½¤¹¤ë¤³¤È¤¬¤Ç¤¤¿¤«¤ò¥Æ¥¹¥È¤·¤¿¤ê¡¢
Æó¤Ä¤ÎÊ£ÁÇ¿ô¤¬Åù¤·¤¤¤«¤ò¥Æ¥¹¥È¤·¤¿¤ê¤·¤Þ¤¹¡£
»ØÄꤷ¤¿¥Æ¥¹¥È´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹¡£
¤³¤ì¤Ï¤Þ¤À¤¢¤Þ¤êÊØÍø¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡¢
¤Ê¤¼¤Ê¤é¡¢¿ÇÃǤ¬É½¼¨¤µ¤ì¤Ê¤¤¤«¤é¤Ç¤¹¡£
-Ä̾ï¤Ï@ref ExecutingTest¤Ç·ë²Ì¤òɽ¼¨¤·¤Þ¤¹¡£
+Ä̾ï¤Ï@ref ExecutingTest ¤Ç·ë²Ì¤òɽ¼¨¤·¤Þ¤¹¡£
@endif
@english
°ì¤Ä¥Æ¥¹¥È¥±¡¼¥¹¤ò½ñ¤¤¤¿¤é¡¢
¤½¤ì¤ò¼Â¹Ô¤·¤¿¤¤¤È»×¤¦¤Ç¤·¤ç¤¦¡£
CCUnit ¤Î @link ExecutingTest TestRunner @endlink ¤Ï¡¢
-¥Æ¥¹¥È¥±¡¼¥¹¤ò¥Æ¥¹¥È¥¹¥¤¡¼¥È¤Ë¤Þ¤È¤á¤Æ¼Â¹Ô¤··ë²Ì¤òɽ¼¨¤·¤Þ¤¹¡£
+¥Æ¥¹¥È¥±¡¼¥¹¤ò¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤Þ¤È¤á¤Æ¼Â¹Ô¤··ë²Ì¤òɽ¼¨¤·¤Þ¤¹¡£
@endif
@english
ÃͤòÄ´¤Ù¤ë¤³¤È¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£
¤½¤·¤Æ¥Æ¥¹¥È¤¬½ª¤ï¤Ã¤¿¤é¸å»ÏËö¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
-@c setUp ¤È @c tearDown ´Ø¿ô¤Ï¤½¤ó¤Ê»þ¤Ë»ÈÍѤ¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
+@c setUp ¤È @c tearDown ´Ø¿ô¤Ï¤½¤Î¤è¤¦¤Ê¾ì¹ç¤Ë»ÈÍѤ¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
@endif
@dot
When you have a common global variables, here is what you do:
@japanese
¤â¤·³Æ¥Æ¥¹¥È¤Ë¶¦Ä̤Υ°¥í¡¼¥Ð¥ëÊÑ¿ô¤¬¤¢¤ì¤Ð¡¢
-¼¡¤Î¤è¤¦¤Ë¤¹¤ë¤³¤È¤Ç¤·¤ç¤¦¡£
+¼¡¤Î¤è¤¦¤Ë¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
@endif
@dontinclude complex/testComplexSetup.c
¤½¤·¤Æ¥Æ¥¹¥È¤¬Á´¤Æ½ª¤ï¤Ã¤¿¤È¤¤À¤±¸å»ÏËö¤Î¥³¡¼¥É¤ò¼Â¹Ô¤¹¤ë¤è¤¦¤Ê¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡£
¤½¤Î¤¿¤á¤Ë¤Ï¥Æ¥¹¥È¥±¡¼¥¹¤Ë
-@c setup_setUp, @c setup_tearDown ´Ø¿ô¤òÅÐÏ¿¤·¤Þ¤¹¡£
+@c setUpBeforeClass, @c tearDownAfterClass ´Ø¿ô¤òÅÐÏ¿¤·¤Þ¤¹¡£
¤¹¤ë¤È¼¡¤Î¤è¤¦¤Ê½ç½ø¤Ç¥Æ¥¹¥È´Ø¿ô¤¬¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
@endif
setUp;
setUp2 [ label="setUp" ];
}
- setup_setUp -> setUp [ weight=8 ];
- setup_setUp -> setUp2 [ style=invis ];
+ setUpBeforeClass -> setUp [ weight=8 ];
+ setUpBeforeClass -> setUp2 [ style=invis ];
setUp -> "TestFunc 1" [ weight=8 ];
"TestFunc 1" -> tearDown [ weight=8 ];
setUp2 -> "TestFunc n" [ weight=8 ];
tearDown2 [ label="tearDown" ];
"TestFunc n" -> tearDown2;
- tearDown2 -> setup_tearDown;
+ tearDown2 -> tearDownAfterClass;
tearDown -> setUp2 [ style=dotted ];
}
@enddot
Ê£¿ô¤Î¥Æ¥¹¥È¤òÁ´Éô°ìÅ٤˼¹Ԥ¹¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë½àÈ÷¤¹¤ë¤Ë¤Ï¡¢
¤É¤Î¤è¤¦¤Ë¤·¤¿¤é¤¤¤¤¤Ç¤·¤ç¤¦¤«¡©
¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¤òºî¤Ã¤¿¤é¡¢
-¤½¤ì¤é¤ò¥¹¡¼¥Ä (¥¹¥¤¡¼¥È) ¤ËÀ°Íý¤·¤Þ¤¹¡£
+¤½¤ì¤é¤ò¥¹¡¼¥Ä¤ËÀ°Íý¤·¤Þ¤¹¡£
@endif
@dot
label="Test Functions"; labelloc=t; labeljust=l;
style=dashed;
rank=same;
- setup_setUp;
+ setUpBeforeClass;
setUp;
TestFunc;
tearDown;
- setup_tearDown;
+ tearDownAfterClass;
}
TestSuite [ URL="@ref CCUnitTestSuite" ];
TestCase [ URL="@ref CCUnitTestCase" ];
TestFunc [ URL="@ref CCUnitTestFunc" ];
- setup_setUp [ URL="@ref CCUnitTestFunc" ];
+ setUpBeforeClass [ URL="@ref CCUnitTestFunc" ];
setUp [ URL="@ref CCUnitTestFunc" ];
tearDown [ URL="@ref CCUnitTestFunc" ];
- setup_tearDown [ URL="@ref CCUnitTestFunc" ];
+ tearDownAfterClass [ URL="@ref CCUnitTestFunc" ];
TestSuite -> TestSuite [ label="1..n" ];
TestSuite -> TestCase [ headlabel="1..n", labeldistance=1, labelangle=-45 ];
- TestCase -> setup_setUp [ headlabel="0..1", labelangle=45 ];
+ TestCase -> setUpBeforeClass [ headlabel="0..1", labelangle=45 ];
TestCase -> setUp [ headlabel="0..1", labelangle=45 ];
TestCase -> TestFunc [ headlabel="1..n", labelangle=-45 ];
TestCase -> tearDown [ headlabel="0..1", labelangle=-45 ];
- TestCase -> setup_tearDown [ headlabel="0..1", labelangle=-45 ];
+ TestCase -> tearDownAfterClass [ headlabel="0..1", labelangle=-45 ];
}
@enddot
CCUnit ¤Ï¤¤¤¯¤Ä¤â¤Î @link CCUnitTestFunc TestFuncs @endlink
¤ò°ì½ï¤Ë¼Â¹Ô¤¹¤ë
@link CCUnitTestSuite TestSuite @endlink ¥â¥¸¥å¡¼¥ë¤òÄ󶡤·¤Þ¤¹¡£
-¥Æ¥¹¥È¥¹¥¤¡¼¥È¤ò¼Â¹Ô¤¹¤ëÊýË¡¤Ï¤¹¤Ç¤ËÁ°¤ÎÊý¤Ç¼¨¤·¤Æ¤¢¤ê¤Þ¤¹¡£
+¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼Â¹Ô¤¹¤ëÊýË¡¤Ï¤¹¤Ç¤ËÁ°¤ÎÊý¤Ç¼¨¤·¤Æ¤¢¤ê¤Þ¤¹¡£
@endif
@english
Create a test suite,
then register that two test cases to it.
@japanese
-¥Æ¥¹¥È¥¹¥¤¡¼¥È¤òÀ¸À®¤·¡¢
+¥Æ¥¹¥È¥¹¡¼¥Ä¤òÀ¸À®¤·¡¢
¥Æ¥¹¥È¥±¡¼¥¹¤òÅÐÏ¿¤·¤Þ¤¹¡£
@endif
@japanese
¤ªµ¤¤Å¤¤Î¤è¤¦¤Ë¡¢
¥Æ¥¹¥È¥±¡¼¥¹¤Ë¥Æ¥¹¥È´Ø¿ô¤òÅÐÏ¿¤·¤¿¤ê¡¢
-¥Æ¥¹¥È¥¹¥¤¡¼¥È¤Ë¥Æ¥¹¥È¥±¡¼¥¹¤òÅÐÏ¿¤·¤¿¤ê¤¹¤ëºî¶È¤Ï¡¢
+¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¥Æ¥¹¥È¥±¡¼¥¹¤òÅÐÏ¿¤·¤¿¤ê¤¹¤ëºî¶È¤Ï¡¢
È¿ÉüŪ¤Ç´Ö°ã¤¤¤ä¤¹¤¤¤â¤Î¤Ç¤¹¡£
Î㤨¤Ð @c testComplexSetup.c ¤Ë¤Ï
¤³¤Î¤è¤¦¤ÊÅÐϿϳ¤ì¤ò¤Ê¤¯¤¹¤¿¤á¤Ë
@ref CreatingTestSuite ¤Î´Ø¿ô¤È¥³¥Þ¥ó¥É¤Ï¡¢
-¥Æ¥¹¥È¥±¡¼¥¹¤ä¥Æ¥¹¥È¥¹¥¤¡¼¥È¤òÅÐÏ¿¤¹¤ë´Ø¿ô¤Î¼ÂÁõ¤ò¡¢
+¥Æ¥¹¥È¥±¡¼¥¹¤ä¥Æ¥¹¥È¥¹¡¼¥Ä¤òÅÐÏ¿¤¹¤ë´Ø¿ô¤Î¼ÂÁõ¤ò¡¢
¼«Æ°Åª¤ËºîÀ®¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
@endif
@japanese
¤½¤Î¤¿¤á¤Ë¤Ï¡¢¥Æ¥¹¥È¥±¡¼¥¹¤ò½ñ¤¯¥Õ¥¡¥¤¥ë¤ò¼¡¤Î¤è¤¦¤Ëºî¤ê¤Þ¤¹¡£
-ºÇ½é¤Ë¡¢¥Æ¥¹¥È¥¹¥¤¡¼¥È¤òÀë¸À¤·¤Þ¤¹¡£
-¤³¤ì¤Ï javaDoc ¥¹¥¿¥¤¥ë¤Î¥³¥á¥ó¥ÈÆâ¤Ë¥Æ¥¹¥È¥¹¥¤¡¼¥È¤Î̾Á°¤òµ½Ò¤·¤Þ¤¹¡£
+ºÇ½é¤Ë¡¢¥Æ¥¹¥È¥¹¡¼¥Ä¤òÀë¸À¤·¤Þ¤¹¡£
+¤³¤ì¤Ï javaDoc ¥¹¥¿¥¤¥ë¤Î¥³¥á¥ó¥ÈÆâ¤Ë¥Æ¥¹¥È¥¹¡¼¥Ä¤Î̾Á°¤òµ½Ò¤·¤Þ¤¹¡£
javaDoc¥¹¥¿¥¤¥ë¤Î¥³¥á¥ó¥È¤È¤Ï C ¥¹¥¿¥¤¥ë¤Î¥³¥á¥ó¥È¥Ö¥í¥Ã¥¯¤Î³«»Ï¤¬
Æó¤Ä¤Î¥¢¥¹¥¿¥ê¥¹¥¯ <tt>**</tt> ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤â¤Î¤Ç¤¹¡£
@endif
//** end test case *\/
//** test case: complex arith test case *\/
...
-//* end test case *\/
-//* end test suite *\/
-//* test suite: ... *\/
+//** end test case *\/
+//** end test suite *\/
+//** test suite: ... *\/
...
-//* end test suite *\/
+//** end test suite *\/
@endcode
@english
-As for the test function, the name must have begup with test.
+As for the test function, the name must have begun with test.
You can write the explanation of the test function in the
comment of the javaDoc style before each test function.
If the comment isn't being written, the name of the test
function is registered as an explanation of the function.
-There are @c setUp, @c tearDown, @c setup_setUp and @c setup_tearDown as
+There are @c setUp, @c tearDown, @c setUpBeforeClass and @c tearDownAfterClass as
a special test function.
Their works as a functional function of the test case that
Those function as a functional function of the test case which
¥³¥á¥ó¥È¤¬½ñ¤«¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢
¥Æ¥¹¥È´Ø¿ô¤Î̾Á°¤¬´Ø¿ô¤ÎÀâÌÀ¤È¤·¤ÆÅÐÏ¿¤µ¤ì¤Þ¤¹¡£
-ÆÃÊ̤ʥƥ¹¥È´Ø¿ô¤È¤·¤Æ @c setUp, @c tearDown, @c setup_setUp, @c setup_tearDown
-¤¬¤¢¤ê¤Þ¤¹¡£
+ÆÃÊ̤ʥƥ¹¥È´Ø¿ô¤È¤·¤Æ @c setUp, @c tearDown, @c setUpBeforeClass,
+@c tearDownAfterClass ¤¬¤¢¤ê¤Þ¤¹¡£
¤½¤Î̾Á°¤«¤é¤ï¤«¤ë¤è¤¦¤Ë¡¢
°ÊÁ°¤ËÀâÌÀ¤·¤¿¥Æ¥¹¥È¥±¡¼¥¹¤Îµ¡Ç½¤Î´Ø¿ô¤È¤·¤ÆƯ¤¤Þ¤¹¡£
¤½¤ì¤¾¤ì¤½¤Î¤è¤¦¤Ê̾Á°¤ÇÄêµÁ¤·¤Æ¤¯¤À¤µ¤¤¡£
@english
Call the function which you generated, and take out the test suite.
@japanese
-À¸À®¤·¤¿´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤Æ¥Æ¥¹¥È¥¹¥¤¡¼¥È¤ò¼è¤ê½Ð¤·¤Þ¤¹¡£
+À¸À®¤·¤¿´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤Æ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼è¤ê½Ð¤·¤Þ¤¹¡£
@endif
@skip main
To compile and run, do the following:
@japanese
¤³¤³¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥³¡¼¥É¤Ï¡¢<code>examples/complex</code> ¥Ç¥£¥ì¥¯¥È¥ê¤Î
-<code>runTestSuiteAuto.c, testComplexSetup.c</code>
+<code>runTestSuiteAuto.c</code>, <code>testComplexSetup.c</code>
¤Ë¤¢¤ê¤Þ¤¹¡£
¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
labeljust=l;
style=dashed;
rank=same;
- setup_setUp;
+ setUpBeforeClass;
setUp;
TestFunc;
tearDown;
- setup_tearDown;
+ tearDownAfterClass;
}
TestSuite -> TestSuite [ label="1..n" ];
- TestCase -> setup_setUp [ label="0..1" ];
+ TestCase -> setUpBeforeClass [ label="0..1" ];
TestCase -> setUp [ label="0..1" ];
TestSuite -> TestCase [ label="1..n" ];
TestCase -> TestFunc [ label="1..n" ];
TestCase -> tearDown [ label="0..1" ];
- TestCase -> setup_tearDown [ label="0..1" ];
+ TestCase -> tearDownAfterClass [ label="0..1" ];
}
* Test case can have @c setUp and @c tearDown functions
* which are called before and after running the test cases.
* @japanese
- * CCUnit ¤Ï¥Æ¥¹¥È¥¹¥¤¡¼¥È¡¢¥Æ¥¹¥È¥±¡¼¥¹¡¢¥Æ¥¹¥È´Ø¿ô¤«¤é¹½À®¤µ¤ì¤Þ¤¹
+ * CCUnit ¤Ï¥Æ¥¹¥È¥¹¡¼¥Ä¡¢¥Æ¥¹¥È¥±¡¼¥¹¡¢¥Æ¥¹¥È´Ø¿ô¤«¤é¹½À®¤µ¤ì¤Þ¤¹
*
* Ê£¿ô¤Î¥Æ¥¹¥È´Ø¿ô¤Ï¥Æ¥¹¥È¥±¡¼¥¹¤Ë¤Þ¤È¤á¤é¤ì¡¢
- * ¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ï¥Æ¥¹¥È¥¹¥¤¡¼¥È¤Ë¤Þ¤È¤á¤é¤ì¤Þ¤¹¡£
- * ¤½¤·¤Æ¥Æ¥¹¥È¥¹¥¤¡¼¥È¤â¤Þ¤¿¥Æ¥¹¥È¥¹¥¤¡¼¥È¤Ë¤Þ¤È¤á¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
- * ¥Æ¥¹¥È¥¹¥¤¡¼¥È¤ò¼Â¹Ô¤¹¤ë¤È¡¢¤½¤ì¤Ë¤Þ¤È¤á¤é¤ì¤Æ¤¤¤ë¥Æ¥¹¥È¥¹¥¤¡¼¥È¡¢
+ * ¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¥±¡¼¥¹¤Ï¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤Þ¤È¤á¤é¤ì¤Þ¤¹¡£
+ * ¤½¤·¤Æ¥Æ¥¹¥È¥¹¡¼¥Ä¤â¤Þ¤¿¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤Þ¤È¤á¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
+ * ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼Â¹Ô¤¹¤ë¤È¡¢¤½¤ì¤Ë¤Þ¤È¤á¤é¤ì¤Æ¤¤¤ë¥Æ¥¹¥È¥¹¡¼¥Ä¡¢
* ¥Æ¥¹¥È¥±¡¼¥¹¡¢¥Æ¥¹¥È´Ø¿ô¤¬ÅÐÏ¿¤µ¤ì¤¿½ç¤Ë¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
* ¥Æ¥¹¥È¥±¡¼¥¹¤Ë¤Ï @c setUp ¤È @c tearDown ´Ø¿ô¤òÅÐÏ¿¤¹¤ë¤³¤È¤¬¤Ç¤¡¢
- * ¥Æ¥¹¥È¥±¡¼¥¹¤¬¼Â¹Ô¤µ¤ì¤ëºÝ¤Ë¤Ï¡¢
- * ¤½¤ì¤¾¤ì¤Î¥Æ¥¹¥È´Ø¿ô¤ò¼Â¹Ô¤¹¤ëÁ°¤È¸å¤Ë¡¢
- * @c setUp ¤È @c teaDown ¤¬¼«Æ°Åª¤Ë¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
+ * ¤½¤ì¤é¤Ï¥Æ¥¹¥È¥±¡¼¥¹¤Î¥Æ¥¹¥È´Ø¿ô¤¬¼Â¹Ô¤µ¤ì¤ëÁ°¤È¸å¤Ë¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
* @endif
*
* @dot
label="Test Functions"; labelloc=t; labeljust=l;
style=dashed;
rank=same;
- setup_setUp;
+ case_setUp;
setUp;
TestFunc;
tearDown;
- setup_tearDown;
+ case_tearDown;
}
TestSuite [ URL="@ref CCUnitTestSuite" ];
TestCase [ URL="@ref CCUnitTestCase" ];
TestFunc [ URL="@ref CCUnitTestFunc" ];
- setup_setUp [ URL="@ref CCUnitTestFunc" ];
+ case_setUp [ URL="@ref CCUnitTestFunc" ];
setUp [ URL="@ref CCUnitTestFunc" ];
tearDown [ URL="@ref CCUnitTestFunc" ];
- setup_tearDown [ URL="@ref CCUnitTestFunc" ];
+ case_tearDown [ URL="@ref CCUnitTestFunc" ];
TestSuite -> TestSuite [ label="1..n" ];
TestSuite -> TestCase [ headlabel="1..n", labeldistance=1, labelangle=-45 ];
- TestCase -> setup_setUp [ headlabel="0..1", labelangle=45 ];
+ TestCase -> case_setUp [ headlabel="0..1", labelangle=45 ];
TestCase -> setUp [ headlabel="0..1", labelangle=45 ];
TestCase -> TestFunc [ headlabel="1..n", labelangle=-45 ];
TestCase -> tearDown [ headlabel="0..1", labelangle=-45 ];
- TestCase -> setup_tearDown [ headlabel="0..1", labelangle=-45 ];
+ TestCase -> case_tearDown [ headlabel="0..1", labelangle=-45 ];
}
* @enddot
*
* @japanese
* @defgroup Assertions ASSERT ¥Þ¥¯¥í
* ¥Æ¥¹¥È´Ø¿ô¤ÇɽÌÀ (ASSERT) ¤ò¹Ô¤¦¤¿¤á¤Î¥Þ¥¯¥í¤Ç¤¹¡£
+ *
+ * ¤â¤Ã¤È¤â¥×¥ê¥ß¥Æ¥£¥Ö¤Ê¤Î¤Ï CCUNIT_ASSERT() ¤Ë¤Ê¤ê¤Þ¤¹¤¬¡¢
+ * Ä̾ï CCUNIT_ASSERT_ASSERT_EQ_INT() ¤Ê¤É¤Î
+ * ¥³¥ó¥Ó¥Ë¥¨¥ó¥¹¤Ê¥Þ¥¯¥í¤ò»È¤¦¤³¤È¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£
* @endif
*/
* @defgroup WritingTestCase Writing Test Case
* @japanese
* @defgroup WritingTestCase ¥Æ¥¹¥È¥±¡¼¥¹¤ò½ñ¤¯
+ * ¥Æ¥¹¥È´Ø¿ô¤Î½¸¤Þ¤ê¤Î¥Æ¥¹¥È¥±¡¼¥¹¤ò½ñ¤¤Þ¤¹¡£
* @endif
*/
* @english
* @defgroup CreatingTestSuite Creating TestSuite
* @japanese
- * @defgroup CreatingTestSuite ¥Æ¥¹¥È¥¹¥¤¡¼¥È¤ÎÀ¸À®
- * ¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¥±¡¼¥¹¤ä¥Æ¥¹¥È¥¹¥¤¡¼¥È¤ò¤Þ¤È¤á¤Æ¡¢
- * ¤Ò¤È¤Ä¤Î¥Æ¥¹¥È¥¹¥¤¡¼¥È¤Ë¤·¤Þ¤¹¡£
+ * @defgroup CreatingTestSuite ¥Æ¥¹¥È¥¹¡¼¥Ä¤ÎÀ¸À®
+ * ¤¤¤¯¤Ä¤«¤Î¥Æ¥¹¥È¥±¡¼¥¹¤ä¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¤Þ¤È¤á¤Æ¡¢
+ * ¤Ò¤È¤Ä¤Î¥Æ¥¹¥È¥¹¡¼¥Ä¤Ë¤·¤Þ¤¹¡£
* @endif
* @sa CCUnitMakeSuite
*/
* @defgroup ExecutingTest Executing Test
* @japanese
* @defgroup ExecutingTest ¥Æ¥¹¥È¤Î¼Â¹Ô
- * ¥Æ¥¹¥È¥¹¥¤¡¼¥È¤ò¼Â¹Ô¤·¤Þ¤¹¡£
+ * ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼Â¹Ô¤·¤Þ¤¹¡£
* @endif
*/
* - runTestCaseSetup @~japanese - ¥»¥Ã¥È¥¢¥Ã¥×´Ø¿ô¤ò¼Â¹Ô¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
* - runTestCaseSetup.c - main program
* - testComplexSetup.c - test cases
- * - runTestSuite @~japanese - ¥Æ¥¹¥È¥¹¥¤¡¼¥È¤Î¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
+ * - runTestSuite @~japanese - ¥Æ¥¹¥È¥¹¡¼¥Ä¤Î¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
* - runTestSuite.c - main program
* - testComplexSetup.c - test cases
* - testComplexArith.c - test cases
- * - runTestSuiteAuto @~japanese - ¥Æ¥¹¥È¥¹¥¤¡¼¥È¤ò¼«Æ°À¸À®¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
+ * - runTestSuiteAuto @~japanese - ¥Æ¥¹¥È¥¹¡¼¥Ä¤ò¼«Æ°À¸À®¤¹¤ë¥µ¥ó¥×¥ë¤Ç¤¹¡£@~
* - runTest.c - main program
* - testComplexSetup.c - test cases
* - testComplexArith.c - test cases
* To generate a code, the test case source codes must be formatted by
* following pseudo-BNF:
* @~japanese
- * @brief ¥Æ¥¹¥È¥±¡¼¥¹¥½¡¼¥¹¥³¡¼¥É¤«¤é¥Æ¥¹¥È¥¹¥¤¡¼¥È¥³¡¼¥É¤òºî¤ë¥³¡¼¥É¤òÀ¸À®¤·¤Þ¤¹¡£
+ * @brief ¥Æ¥¹¥È¥±¡¼¥¹¥½¡¼¥¹¥³¡¼¥É¤«¤é¥Æ¥¹¥È¥¹¡¼¥Ä¥³¡¼¥É¤òºî¤ë¥³¡¼¥É¤òÀ¸À®¤·¤Þ¤¹¡£
*
* ¥Æ¥¹¥È¥±¡¼¥¹¥½¡¼¥¹¥³¡¼¥É¤Ï¼¡¤Îµ¿»÷ BNF ¤Ë¤è¤Ã¤Æ¥Õ¥©¡¼¥Þ¥Ã¥È¤µ¤ì¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£
* @~
*
* @code
- * SOURCEFILE ::= [SUITE]... | TESTCASE...
+ * SOURCEFILE ::= SUITE... | TESTCASE...
*
* SUITE ::= SUITE_HEADER
* [ any-C-code ]...
*
* TESTFUNC ::= [ FUNC_DESC ] 'void ' FUNC_PREFIX[A-Za-z0-9_]* '()' FUNC_BODY
*
- * FUNC_PREFIX ::= 'test' | 'setUp' | 'tearDown' | 'setup_setUp' | 'setup_tearDown'
+ * FUNC_PREFIX ::= 'test' | 'setUp' | 'tearDown' |
+ * 'setUpBeforeClass' | 'tearDownAfterClass'
*
* TESTCASE_END ::= JAVADOC_COMMENT_BEGIN 'end test case ' [string] COMMENT_END
*
* Generate a code to creating test suite code from the test func
* source codes.
* @japanese
- * ¥Æ¥¹¥È¥±¡¼¥¹¤Î¥½¡¼¥¹¥³¡¼¥É¤«¤é¡¢¥Æ¥¹¥È¥¹¥¤¡¼¥È¤òºîÀ®¤¹¤ë¥³¡¼¥É¤òÀ¸À®¤¹¤ë¡£
+ * ¥Æ¥¹¥È¥±¡¼¥¹¤Î¥½¡¼¥¹¥³¡¼¥É¤«¤é¡¢¥Æ¥¹¥È¥¹¡¼¥Ä¤òºîÀ®¤¹¤ë¥³¡¼¥É¤òÀ¸À®¤¹¤ë¡£
* @endif
*
* @param ac arg count.
addTestCaseDef (suite, testCase);
while (readline ())
{
- /* setUp function def */
- if ((f = readTestFunc ("void", "setUp", desc)) != NULL)
+ /* setUpBeforeClass function def */
+ if ((f = readTestFunc ("void", "setUpBeforeClass", desc)) != NULL)
{
ccunit_addList (&testCase->testFuncs, f);
safe_free (desc);
}
- /* tearDown function def */
- else if ((f = readTestFunc ("void", "tearDown", desc)) != NULL)
+ /* tearDownAfterClass function def */
+ else if ((f = readTestFunc ("void", "tearDownAfterClass", desc)) != NULL)
{
ccunit_addList (&testCase->testFuncs, f);
safe_free (desc);
}
- /* setup_setUp function def */
- else if ((f = readTestFunc ("void", "setup_setUp", desc)) != NULL)
+ /* setUp function def */
+ else if ((f = readTestFunc ("void", "setUp", desc)) != NULL)
{
ccunit_addList (&testCase->testFuncs, f);
safe_free (desc);
}
- /* setup_tearDown function def */
- else if ((f = readTestFunc ("void", "setup_tearDown", desc)) != NULL)
+ /* tearDown function def */
+ else if ((f = readTestFunc ("void", "tearDown", desc)) != NULL)
{
ccunit_addList (&testCase->testFuncs, f);
safe_free (desc);
doc = NULL;
}
else if ((f = readTestFunc ("void", "test", desc)) != NULL
+ || (f = readTestFunc ("void", "setUpBeforeClass", desc)) != NULL
+ || (f = readTestFunc ("void", "tearDownAfterClass", desc)) != NULL
|| (f = readTestFunc ("void", "setUp", desc)) != NULL
- || (f = readTestFunc ("void", "tearDown", desc)) != NULL
- || (f = readTestFunc ("void", "setup_setUp", desc)) != NULL
- || (f = readTestFunc ("void", "setup_tearDown", desc)) != NULL)
+ || (f = readTestFunc ("void", "tearDown", desc)) != NULL)
{
ccunit_err ("%s:%lu: missing test case start comment '%s': ignored",
line.fname, line.lno, line.str);
void ccunit_addTestFunc (CCUnitTestCase* testCase, CCUnitTestFunc* f)
{
- static const char* ssu = "setup_setUp";
- static const char* std = "setup_tearDown";
- static const char* su = "setUp";
- static const char* td = "tearDown";
- static const char* ts = "test";
- if (strncmp (f->name, ts, strlen (ts)) == 0)
+ static const char csu[] = "setUpBeforeClass";
+ static const char ctd[] = "tearDownAfterClass";
+ static const char su[] = "setUp";
+ static const char td[] = "tearDown";
+ static const char ts[] = "test";
+ if (strncmp (f->name, ts, sizeof (ts) - 1) == 0)
ccunit_addList (&testCase->testFuncs, f);
- else if (strncmp (f->name, ssu, strlen (ssu)) == 0)
+ else if (strncmp (f->name, csu, sizeof (csu) - 1) == 0)
{
- if (testCase->setup_setUp)
- ccunit_deleteTestFunc (testCase->setup_setUp);
- testCase->setup_setUp = f;
+ if (testCase->setUpBeforeClass)
+ ccunit_deleteTestFunc (testCase->setUpBeforeClass);
+ testCase->setUpBeforeClass = f;
}
- else if (strncmp (f->name, std, strlen (std)) == 0)
+ else if (strncmp (f->name, ctd, sizeof (ctd) - 1) == 0)
{
- if (testCase->setup_tearDown)
- ccunit_deleteTestFunc (testCase->setup_tearDown);
- testCase->setup_tearDown = f;
+ if (testCase->tearDownAfterClass)
+ ccunit_deleteTestFunc (testCase->tearDownAfterClass);
+ testCase->tearDownAfterClass = f;
}
- else if (strncmp (f->name, su, strlen (su)) == 0)
+ else if (strncmp (f->name, su, sizeof (su) - 1) == 0)
{
if (testCase->setUp)
ccunit_deleteTestFunc (testCase->setUp);
testCase->setUp = f;
}
- else if (strncmp (f->name, td, strlen (td)) == 0)
+ else if (strncmp (f->name, td, sizeof (td) - 1) == 0)
{
if (testCase->tearDown)
ccunit_deleteTestFunc (testCase->tearDown);
CCUnitTestFunc* testFunc;
assert (test->type == ccunitTypeTestCase);
_ccunit_testFailure = NULL;
- if (testCase->setup_setUp && testCase->setup_setUp->runTest)
+ if (testCase->setUpBeforeClass && testCase->setUpBeforeClass->runTest)
{
if (setjmp (_ccunit_runTest_env) == 0)
- testCase->setup_setUp->runTest ();
+ testCase->setUpBeforeClass->runTest ();
else
{
- _ccunit_testFailure->testFunc = testCase->setup_setUp;
+ _ccunit_testFailure->testFunc = testCase->setUpBeforeClass;
ccunit_addFailure (result, _ccunit_testFailure);
}
}
_ccunit_endTest (result, testFunc);
}
}
- if (testCase->setup_tearDown && testCase->setup_tearDown->runTest)
+ if (testCase->tearDownAfterClass && testCase->tearDownAfterClass->runTest)
{
if (setjmp (_ccunit_runTest_env) == 0)
- testCase->setup_tearDown->runTest ();
+ testCase->tearDownAfterClass->runTest ();
else
{
- _ccunit_testFailure->testFunc = testCase->setup_tearDown;
+ _ccunit_testFailure->testFunc = testCase->tearDownAfterClass;
ccunit_addFailure (result, _ccunit_testFailure);
}
}
assert (test->type == ccunitTypeTestCase);
testCase = (CCUnitTestCase*)test;
safe_free (testCase->name);
- ccunit_deleteTestFunc (testCase->setup_setUp);
- ccunit_deleteTestFunc (testCase->setup_tearDown);
+ ccunit_deleteTestFunc (testCase->setUpBeforeClass);
+ ccunit_deleteTestFunc (testCase->tearDownAfterClass);
ccunit_deleteTestFunc (testCase->setUp);
ccunit_deleteTestFunc (testCase->tearDown);
ccunit_deleteList (&testCase->testFuncs,
{
CCUnitTest test; /**< super class */
const char* name; /**< test case name */
- CCUnitTestFunc* setup_setUp; /**< setUp for a case */
- CCUnitTestFunc* setup_tearDown; /**< tearDown for a case */
- CCUnitTestFunc* setUp; /**< setUp for each cases */
- CCUnitTestFunc* tearDown; /**< tearDown for each cases */
+ CCUnitTestFunc* setUpBeforeClass; /**< setUp for a case */
+ CCUnitTestFunc* tearDownAfterClass; /**< tearDown for a case */
+ CCUnitTestFunc* setUp; /**< setUp for each tests */
+ CCUnitTestFunc* tearDown; /**< tearDown for each tests */
CCUnitList testFuncs; /**< test functions */
} CCUnitTestCase;
CCUnitTestCase* testCase;
assert (test->type == ccunitTypeFixture);
_ccunit_testFailure = NULL;
- if (fixture->setup_setUp && fixture->setup_setUp->runTest)
+ if (fixture->case_setUp && fixture->case_setUp->runTest)
{
if (setjmp (_ccunit_runTest_env) == 0)
- fixture->setup_setUp->runTest ();
+ fixture->case_setUp->runTest ();
else
{
- _ccunit_testFailure->testCase = fixture->setup_setUp;
+ _ccunit_testFailure->testCase = fixture->case_setUp;
ccunit_addFailure (result, _ccunit_testFailure);
}
}
_ccunit_endTest (result, testCase);
}
}
- if (fixture->setup_tearDown && fixture->setup_tearDown->runTest)
+ if (fixture->case_tearDown && fixture->case_tearDown->runTest)
{
if (setjmp (_ccunit_runTest_env) == 0)
- fixture->setup_tearDown->runTest ();
+ fixture->case_tearDown->runTest ();
else
{
- _ccunit_testFailure->testCase = fixture->setup_tearDown;
+ _ccunit_testFailure->testCase = fixture->case_tearDown;
ccunit_addFailure (result, _ccunit_testFailure);
}
}
}
inline void ccunit_setTestFixtureSetup (CCUnitTestFixture* fixture,
- CCUnitTestFunc* setup_setUp,
- CCUnitTestFunc* setup_tearDown)
+ CCUnitTestFunc* case_setUp,
+ CCUnitTestFunc* case_tearDown)
{
if (!fixture)
return;
- if (fixture->setup_setUp)
- ccunit_deleteTestCase (fixture->setup_setUp);
- fixture->setup_setUp = setup_setUp;
- if (fixture->setup_tearDown)
- ccunit_deleteTestCase (fixture->setup_tearDown);
- fixture->setup_tearDown = setup_tearDown;
+ if (fixture->case_setUp)
+ ccunit_deleteTestCase (fixture->case_setUp);
+ fixture->case_setUp = case_setUp;
+ if (fixture->case_tearDown)
+ ccunit_deleteTestCase (fixture->case_tearDown);
+ fixture->case_tearDown = case_tearDown;
}
inline struct CCUnitTestResult* ccunit_runTestFixture (CCUnitTestFixture* f)