OSDN Git Service

rename to CCUnitWriteSuite.c
authortsutsumi <>
Thu, 11 Sep 2003 02:01:11 +0000 (02:01 +0000)
committertsutsumi <>
Thu, 11 Sep 2003 02:01:11 +0000 (02:01 +0000)
src/ccunit/CCUnitWriteTestAdd.c [deleted file]

diff --git a/src/ccunit/CCUnitWriteTestAdd.c b/src/ccunit/CCUnitWriteTestAdd.c
deleted file mode 100644 (file)
index 46a11ce..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * $Id$
- */
-/* Copyright (C) 2003 TSUTSUMI Kikuo.
-   This file is part of the CCUnit Library.
-
-   The CCUnit Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public License
-   as published by the Free Software Foundation; either version 2.1 of
-   the License, or (at your option) any later version.
-
-   The CCUnit Library is distributed in the hope that it will be
-   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the CCUnit Library; see the file COPYING.LESSER.
-   If not, write to the Free Software Foundation, Inc., 59 Temple
-   Place - Suite 330, Boston, MA 02111-1307, USA.  
-*/
-
-#include <ccunit/CCUnitMakeSuite.h>
-#include <ccunit/CCUnitLogMessage.h>
-#include <ccunit/CCUnitList.h>
-#include <stdio.h>
-
-/**
- * print test case prototypes.
- *
- * @param ofp output stream.
- * @param suite test suite object to print.
- */
-static void printPrototypes (FILE* ofp, CCUnitTestSuiteDef* suite)
-{
-  CCUnitListIterator itor;
-  CCUnitListIterator fitor;
-  CCUnitTestDef* test;
-  CCUnitTestFuncDef* func;
-  ccunit_initListIterator (&suite->testdefs, &itor);
-  while ((test = (CCUnitTestDef*)ccunit_nextListIterator (&itor)) != NULL)
-    {
-      if (test->type == ccunitTypeSuite)
-       {
-         fprintf (ofp,
-                  "/*\n"
-                  " * Test suite %s prototypes\n"
-                  " */\n",
-                  test->name);
-         ccunit_log ("testSuite: '%s'", test->name);
-         printPrototypes (ofp, (CCUnitTestSuiteDef*)test);
-       }
-      else if (test->type == ccunitTypeCase)
-       {
-         CCUnitTestCaseDef* testCase = (CCUnitTestCaseDef*)test;
-         ccunit_log ("testCase: '%s'", (!testCase->desc
-                                        ? testCase->super.name : testCase->desc));
-         if (testCase->desc)
-           fprintf (ofp, "/** %s */\n", testCase->desc);
-         if (testCase->setUp)
-           {
-             fprintf (ofp, "extern %s %s ();\n",
-                      testCase->setUp->type, testCase->setUp->name);
-             ccunit_log ("setUp: %s %s",
-                         testCase->setUp->type, testCase->setUp->name);
-           }
-         if (testCase->tearDown)
-           {
-             fprintf (ofp, "extern %s %s ();\n",
-                      testCase->tearDown->type, testCase->tearDown->name);
-             ccunit_log ("tearDown: %s %s",
-                         testCase->tearDown->type, testCase->tearDown->name);
-           }
-         ccunit_initListIterator (&testCase->testFuncs, &fitor);
-         while ((func = ccunit_nextListIterator (&fitor)) != NULL)
-           {
-             fprintf (ofp, "extern %s %s ();\n", 
-                      func->type, func->name);
-             ccunit_log ("setUp: %s %s",
-                         func->type, func->name);
-           }
-       }
-    }
-  fputc ('\n', ofp);
-}
-
-/**
- * print test suite adding function.
- *
- * @param ofp output stream.
- * @param name function name.
- * @param suite test suite to print.
- */
-static void printTestAdd (FILE* ofp,
-                         const char* name,
-                         CCUnitTestSuiteDef* suite)
-{
-  CCUnitListIterator itor;
-  CCUnitTestDef* test;
-  ccunit_initListIterator (&suite->testdefs, &itor);
-  while ((test = (CCUnitTestDef*)ccunit_nextListIterator (&itor)) != NULL)
-    {
-      if (test->type == ccunitTypeSuite)
-       {
-         CCUnitTestSuiteDef* newSuite = (CCUnitTestSuiteDef*)test;
-         printTestAdd (ofp, test->name, newSuite);
-       }
-      else if (test->type == ccunitTypeCase)
-       {
-       }
-    }
-  fprintf (ofp,
-          "static CCUnitTestSuite* newSuite_%s (const char* name)\n"
-          "{\n"
-          "    CCUnitTestSuite* suite = ccunit_newTestSuite (name);\n"
-          "    CCUnitTestSuite* newSuite;\n"
-          "    CCUnitTestCase* newCase = NULL;\n"
-          "    newSuite = NULL;\n", name);
-  ccunit_initListIterator (&suite->testdefs, &itor);
-  while ((test = (CCUnitTestDef*)ccunit_nextListIterator (&itor)) != NULL)
-    {
-      if (test->type == ccunitTypeSuite)
-       {
-         fprintf (ofp,
-                  "    newSuite = addSuite_%s (\"%s\");\n"
-                  "    if (newSuite)\n"
-                  "      ccunit_addTestSuite (suite, newSuite);\n",
-                  test->name, test->name);
-       }
-      else if (test->type == ccunitTypeCase)
-       {
-         CCUnitListIterator itor;
-         CCUnitTestFuncDef* func;
-         CCUnitTestCaseDef* testCase = (CCUnitTestCaseDef*)test;
-         fprintf (ofp,
-                  "    newCase = ccunit_newTestCase (\"%s\",\n"
-                  "                                  %s,\n"
-                  "                                  %s);\n"
-                  "    ccunit_addTestCase (suite, newCase);\n",
-                  test->name,
-                  !testCase->setUp ? "NULL" : testCase->setUp->name,
-                  !testCase->tearDown ? "NULL" : testCase->tearDown->name);
-         ccunit_initListIterator (&testCase->testFuncs, &itor);
-         while ((func = ccunit_nextListIterator (&itor)) != NULL)
-           {
-             fprintf (ofp,
-                      "    ccunit_addTestFunc (newCase,\n"
-                      "                        \"%s\",\n"
-                      "                        %s,\n"
-                      "                        \"%s\");\n",
-                      func->name, func->name, func->desc);
-           }
-       }
-    }
-  fprintf (ofp, "    return suite;\n}\n\n");
-}
-
-/*
- * print test suite.
- */
-void ccunit_writeTestAdd (FILE* ofp,
-                         const char* name,
-                         CCUnitTestSuiteDef* suite)
-{
-  fprintf (ofp,
-          "#include <ccunit/CCUnit.h>\n"
-          "#include <stdio.h>\n\n"
-          "static CCUnitTestSuite* newSuite_ (const char* name);\n");
-  printPrototypes (ofp, suite);
-  printTestAdd (ofp, "", suite);
-  fprintf (ofp,
-          "CCUnitTestSuite* %s (const char* name)\n"
-          "{\n"
-          "    return newSuite_ (name);\n"
-          "}\n",
-          !name ? "ccunit_suite" : name);
-}