OSDN Git Service

add memory deleting code
authortsntsumi <tsntsumi@users.sourceforge.jp>
Sat, 21 Aug 2010 04:09:00 +0000 (04:09 +0000)
committertsntsumi <tsntsumi@users.sourceforge.jp>
Sat, 21 Aug 2010 04:09:00 +0000 (04:09 +0000)
examples/complex/runTestCase.c
examples/complex/runTestCaseRunner.c

index db65415..513ac7a 100644 (file)
@@ -21,7 +21,8 @@
  * $Id$
  */
 
-#include <ccunit/CCUnit.h>
+#include <ccunit/CCUnitTestCase.h>
+#include <ccunit/CCUnitTestResult.h>
 
 extern void test_complex_new ();
 extern void test_complex_equals ();
@@ -42,5 +43,7 @@ int main ()
                          test_complex_equals);
   result = ccunit_runTestCase (testCase);
   success = ccunit_wasSuccessful (result);
+  ccunit_deleteTestCase (testCase);
+  ccunit_deleteTestResult (result);
   return success ? 0 : -1;
 }
index 9531277..f821b5b 100644 (file)
@@ -32,6 +32,7 @@ int main ()
   CCUnitTestCase* testCase;
   CCUnitTestSuite* suite;
   CCUnitTestRunner* runner;
+  int ret;
   testCase = ccunit_newTestCase ("complex test");
   ccunit_addNewTestFunc (testCase,
                          "test_complex_new",
@@ -44,5 +45,9 @@ int main ()
   suite = ccunit_newTestSuite ("complex test suite");
   ccunit_addTestCase (suite, testCase);
   runner = ccunit_newTestRunner (stdout);
-  return ccunit_runTestRunner (runner, suite);
+  ret = ccunit_runTestRunner (runner, suite);
+  ccunit_deleteTestRunner (runner);
+  ccunit_deleteTestSuite (suite);
+  /* ccunit_deleteTestCase (testCase); // testCase deleted when suite was deleted */
+  return ret;
 }