OSDN Git Service

change for egcs-1.1.2
[ccunit/ccunit.git] / tests / testReadSuite.c
1 /* Copyright (C) 2003 TSUTSUMI Kikuo.
2    This file is part of the CCUnit Library.
3
4    The CCUnit Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public License
6    as published by the Free Software Foundation; either version 2.1 of
7    the License, or (at your option) any later version.
8
9    The CCUnit Library is distributed in the hope that it will be
10    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with the CCUnit Library; see the file COPYING.LESSER.
16    If not, write to the Free Software Foundation, Inc., 59 Temple
17    Place - Suite 330, Boston, MA 02111-1307, USA.  
18 */
19
20 /*
21  * $Id$
22  */
23 #include <stdio.h>
24 #include <ccunit/CCUnit.h>
25
26 /** @file
27  * test suite: read test suite file.
28  */
29
30 /**
31  * @defgroup testReadSuite ccuint_readSuite test.
32  */
33
34 /**
35  * log file input stream.
36  */
37 static FILE* lfp;
38
39 static const char* logname = "testReadSuite.log";
40
41 static char line[1024];
42
43 /** @ingroup testReadSuite
44  * test case: read test suite init
45  * @{
46  */
47
48 /**
49  * test init.
50  */
51 void test_readSuite_init ()
52 {
53   int rc;
54   FILE* fp;
55   fp = freopen (logname, "w", stderr);
56   CCUNIT_ASSERT_NOT_NULL (fp);
57   rc = ccunit_va_makeSuite ("testReadSuite", "-v",
58                             "-o", "suiteReadSuite.log", "testReadSuite.c", NULL);
59   CCUNIT_ASSERT_EQ_INT (0, rc);
60   fclose (fp);
61 }
62
63 /** @}
64  * end test case: read test suite init
65  */
66
67 /** @ingroup testReadSuite
68  * test case: read test suite
69  */
70
71 /**
72  * setup readSuite.
73  */
74 void setUp_readSuite ()
75 {
76   lfp = fopen (logname, "r");
77   CCUNIT_ASSERT_NOT_NULL (lfp);
78 }
79
80 /**
81  * teardown readSuite
82  */
83 void tearDown_readSuite ()
84 {
85   fclose (lfp);
86 }
87
88 /**
89  * test skip doxycomment.
90  */
91 void test_readSuite_skip_doxycomment ()
92 {
93   bool found = false;
94   while (fgets (line, sizeof (line), lfp) != NULL)
95     {
96       char* content = strstr (line, "comment content: ");
97       if (content && strcmp (content, "comment content: "
98                              "\"test suite: read test suite file.\"\n") == 0)
99         {
100           found = true;
101           return;
102         }
103     }
104   CCUNIT_ASSERT_EQ_INT (true, found);
105 }
106
107
108 /**
109  * end test case
110  */
111 /**
112  * end test suite
113  */