OSDN Git Service

new
authortsntsumi <tsntsumi@users.sourceforge.jp>
Sat, 13 Sep 2003 06:00:11 +0000 (06:00 +0000)
committertsntsumi <tsntsumi@users.sourceforge.jp>
Sat, 13 Sep 2003 06:00:11 +0000 (06:00 +0000)
tests/testReadSuite.c [new file with mode: 0644]

diff --git a/tests/testReadSuite.c b/tests/testReadSuite.c
new file mode 100644 (file)
index 0000000..dc813c2
--- /dev/null
@@ -0,0 +1,108 @@
+/* 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 <stdio.h>
+#include <ccunit/CCUnit.h>
+
+/** @file
+ * read test suite file.
+ */
+
+/**
+ * @defgroup testReadSuite ccuint_readSuite test.
+ */
+
+/**
+ * log file input stream.
+ */
+static FILE* lfp;
+
+static const char* logname = "testReadSuite.log";
+
+static char line[1024];
+
+/** @ingroup testReadSuite
+ * test case: read test suite init
+ * @{
+ */
+
+/**
+ * test init.
+ */
+void test_readSuite_init ()
+{
+  int rc;
+  FILE* fp;
+  fp = freopen (logname, "w", stderr);
+  CCUNIT_ASSERT_NOT_NULL (fp);
+  rc = ccunit_va_makeSuite ("testReadSuite", "-v",
+                           "-o", "suiteReadSuite.log", "testReadSuite.c", NULL);
+  CCUNIT_ASSERT_EQ_INT (0, rc);
+  fclose (fp);
+}
+
+/** @}
+ * end test case: read test suite init
+ */
+
+/** @ingroup testReadSuite
+ * test case: read test suite
+ */
+
+/**
+ * setup readSuite.
+ */
+void setUp_readSuite ()
+{
+  lfp = fopen (logname, "r");
+  CCUNIT_ASSERT_NOT_NULL (lfp);
+}
+
+/**
+ * teardown readSuite
+ */
+void tearDown_readSuite ()
+{
+  fclose (lfp);
+}
+
+/**
+ * test skip doxycomment.
+ */
+void test_readSuite_skip_doxycomment ()
+{
+  bool found = false;
+  while (fgets (line, sizeof (line), lfp) != NULL)
+    {
+      if (strcmp (line, "LOG: comment content: \"read test suite file.\"\n") == 0)
+       {
+         found = true;
+         return;
+       }
+    }
+  CCUNIT_ASSERT_EQ_INT (true, found);
+}
+
+
+/**
+ * end test case
+ */