OSDN Git Service

new
authortsutsumi <>
Thu, 11 Sep 2003 01:54:45 +0000 (01:54 +0000)
committertsutsumi <>
Thu, 11 Sep 2003 01:54:45 +0000 (01:54 +0000)
src/ccunit/CCUnitTestFixture.c [new file with mode: 0644]
src/ccunit/CCUnitTestFixture.h [new file with mode: 0644]

diff --git a/src/ccunit/CCUnitTestFixture.c b/src/ccunit/CCUnitTestFixture.c
new file mode 100644 (file)
index 0000000..576e0d1
--- /dev/null
@@ -0,0 +1,46 @@
+/* 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.  
+*/
+
+/*
+ * $Id$
+ */
+
+#include <stdlib.h>
+#include <CCUnit/CCUnitConfig.h>
+#include <CCUnit/CCUnitTestFixture.h>
+
+CCUnitTestFixture* ccunit_newTestFixture (const char* name,
+                                         const char* desc,
+                                         void (*runTest)())
+{
+  CCUnitTestFixture* fixture = calloc (1, sizeof (*fixture));
+  fixture->name = safe_strdup (name);
+  fixture->desc = !desc ? safe_strdup (name) : strdup (desc);
+  fixture->runTest = runTest;
+  return fixture;
+}
+
+void ccunit_deleteTestFixture (CCUnitTestFixture* fixture)
+{
+  if (!fixture)
+    return;
+  safe_free ((char*)fixture->name);
+  safe_free ((char*)fixture->desc);
+  free (fixture);
+}
diff --git a/src/ccunit/CCUnitTestFixture.h b/src/ccunit/CCUnitTestFixture.h
new file mode 100644 (file)
index 0000000..1fc05b4
--- /dev/null
@@ -0,0 +1,55 @@
+/* -*- mode: C; -*- */
+/* 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.  
+*/
+
+/*
+ * $Id$
+ */
+
+#ifndef TESTFIXTURE_H
+#define TESTFIXTURE_H
+
+/**
+ * test fixture
+ */
+typedef struct CCUnitTestFixture
+{
+  const char* name;                            /**< test case name */
+  const char* desc;                            /**< test description */
+  void (*runTest) ();                          /**< run test function */
+} CCUnitTestFixture;
+
+/**
+ * create new test fixture.
+ * @param name fixture name.
+ * @param desc fixture description.
+ * @param runTest run test function.
+ * @return new test fixture
+ */
+extern CCUnitTestFixture* ccunit_newTestFixture (const char* name,
+                                                const char* desc,
+                                                void (*runTest)());
+
+/**
+ * delete test fixture.
+ * @param fixture deleting fixture.
+ */
+extern void ccunit_deleteTestFixture (CCUnitTestFixture* fixture);
+
+#endif /* !TESTFIXTURE_H */