OSDN Git Service

It was modified corresponding to the function change of the function.
authortsutsumi <>
Wed, 1 Oct 2003 20:26:21 +0000 (20:26 +0000)
committertsutsumi <>
Wed, 1 Oct 2003 20:26:21 +0000 (20:26 +0000)
doc/cookbook.dox

index 93d5826..acc3710 100644 (file)
@@ -101,9 +101,9 @@ void tearDown_moneyTest ()
 ...
 
   CCUnitTestFixture* fixture;
-  fixture = ccunit_newTestFixture ("MoneyTest",
-                                   setUp_moneyTest,
-                                   tearDown_moneyTest);
+  fixture = ccunit_newTestFixture ("MoneyTest", 
+                                   CCUNIT_NEWTESTFUNC(setUp_MoneyTest),
+                                   CCUNIT_NEWTESTFUNC(tearDown_MoneyTest));
 @endcode
 
 Once you have the Fixture in place, you can write as many
@@ -173,7 +173,9 @@ CCUnitTestSuite* suite;
 CCUnitTestFixture* fixture;
 CCUnitTestResult* result;
 suite = ccunit_newTestSuite ("Money test suite");
-fixture = ccunit_newTestFixture ("Money Tests", setUp_moneyTest, tearDown_moneyTest);
+fixture = ccunit_newTestFixture ("Money Tests", 
+                                 CCUNIT_NEWTESTFUNC(setUp_moneyTest),
+                                 CCUNIT_NEWTESTFUNC(tearDown_moneyTest));
 ccunit_addNewTestCase (fixture,
                        "testSimpleAdd", "simple add test", testSympleAdd);
 ccunit_addNewTestCase (fixture, 
@@ -344,8 +346,9 @@ To generate creating suite function code, run
 $ ccunit_makeSuite MoneyTest.c
 
 #include <ccunit/CCUnitTestSuite.h>
+#include <ccunit/CCUnitTestFixture.h>
+#include <ccunit/CCUnitTestCase.h>
 
-static CCUnitTestSuite* newSuite_001 (const char* name);
 //* test fixture: Money test *\/
 //* setUp_MathTest *\/
 extern void setUp_MathTest ();
@@ -356,42 +359,42 @@ extern void test_simpleAdd ();
 //* money bug test *\/
 extern void test_moneyBag ();
 
-static CCUnitTestSuite* newSuite_001 (const char* name)
-{
-  CCUnitTestSuite* suite;
-  suite = ccunit_newTestSuite (name);
+static CCUnitTestFixtureDfn fx_001 = {
+  { ccunitTypeFixture },
+  "Money test",
+  {
+    "setUp_MathTest", "setUp_MathTest", setUp_MathTest,
+  },
+  {
+    "tearDown_Mathtest", "tearDown_Mathtest", tearDown_Mathtest,
+  },
   {
-    CCUnitTestFixture* testFixture;
-    testFixture = ccunit_newTestFixture ("Money test",
-                                         setUp_MathTest,
-                                         tearDown_Mathtest);
-    if (testFixture != NULL)
-      ccunit_addTestFixture (suite, testFixture);
     {
-      CCUnitTestCase* newCase;
-      newCase = ccunit_newTestCase ("test_simpleAdd",
-                                    "simple add test",
-                                    test_simpleAdd);
-      if (newCase != NULL)
-        ccunit_addTestCase (testFixture, newCase);
-    }
+      "test_simpleAdd", "simple add test", test_simpleAdd,
+    },
     {
-      CCUnitTestCase* newCase;
-      newCase = ccunit_newTestCase ("test_moneyBag",
-                                    "money bug test",
-                                    test_moneyBag);
-      if (newCase != NULL)
-        ccunit_addTestCase (testFixture, newCase);
-    }
+      "test_moneyBag", "money bug test", test_moneyBag,
+    },
+    {
+      NULL, NULL, NULL
+    },
   }
+};
 
-  return suite;
-}
-
+static CCUnitTestSuiteDfn suite_001 = {
+  { ccunitTypeSuite },
+  "",
+  {
+    &fx_001.test,
+    NULL,
+  },
+};
 
 CCUnitTestSuite* ccunit_suite (const char* name)
 {
-  return newSuite_001 (name);
+  if (!suite_001.name[0])
+    suite_001.name = name;
+  return ccunit_newTestSuiteFromDfn (&suite_001);
 }
 $
 @endcode