xref: /minix3/external/bsd/atf/dist/tools/atffile_test.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc //
2*0a6a1f1dSLionel Sambuc // Automated Testing Framework (atf)
3*0a6a1f1dSLionel Sambuc //
4*0a6a1f1dSLionel Sambuc // Copyright (c) 2009 The NetBSD Foundation, Inc.
5*0a6a1f1dSLionel Sambuc // All rights reserved.
6*0a6a1f1dSLionel Sambuc //
7*0a6a1f1dSLionel Sambuc // Redistribution and use in source and binary forms, with or without
8*0a6a1f1dSLionel Sambuc // modification, are permitted provided that the following conditions
9*0a6a1f1dSLionel Sambuc // are met:
10*0a6a1f1dSLionel Sambuc // 1. Redistributions of source code must retain the above copyright
11*0a6a1f1dSLionel Sambuc //    notice, this list of conditions and the following disclaimer.
12*0a6a1f1dSLionel Sambuc // 2. Redistributions in binary form must reproduce the above copyright
13*0a6a1f1dSLionel Sambuc //    notice, this list of conditions and the following disclaimer in the
14*0a6a1f1dSLionel Sambuc //    documentation and/or other materials provided with the distribution.
15*0a6a1f1dSLionel Sambuc //
16*0a6a1f1dSLionel Sambuc // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17*0a6a1f1dSLionel Sambuc // CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18*0a6a1f1dSLionel Sambuc // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19*0a6a1f1dSLionel Sambuc // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20*0a6a1f1dSLionel Sambuc // IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21*0a6a1f1dSLionel Sambuc // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*0a6a1f1dSLionel Sambuc // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23*0a6a1f1dSLionel Sambuc // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24*0a6a1f1dSLionel Sambuc // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25*0a6a1f1dSLionel Sambuc // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26*0a6a1f1dSLionel Sambuc // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27*0a6a1f1dSLionel Sambuc // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*0a6a1f1dSLionel Sambuc //
29*0a6a1f1dSLionel Sambuc 
30*0a6a1f1dSLionel Sambuc extern "C" {
31*0a6a1f1dSLionel Sambuc #include <sys/types.h>
32*0a6a1f1dSLionel Sambuc #include <sys/stat.h>
33*0a6a1f1dSLionel Sambuc }
34*0a6a1f1dSLionel Sambuc 
35*0a6a1f1dSLionel Sambuc #include <algorithm>
36*0a6a1f1dSLionel Sambuc #include <fstream>
37*0a6a1f1dSLionel Sambuc #include <memory>
38*0a6a1f1dSLionel Sambuc 
39*0a6a1f1dSLionel Sambuc #include <atf-c++.hpp>
40*0a6a1f1dSLionel Sambuc 
41*0a6a1f1dSLionel Sambuc #include "atffile.hpp"
42*0a6a1f1dSLionel Sambuc #include "exceptions.hpp"
43*0a6a1f1dSLionel Sambuc #include "test_helpers.hpp"
44*0a6a1f1dSLionel Sambuc 
45*0a6a1f1dSLionel Sambuc namespace detail = tools::detail;
46*0a6a1f1dSLionel Sambuc 
47*0a6a1f1dSLionel Sambuc // ------------------------------------------------------------------------
48*0a6a1f1dSLionel Sambuc // Auxiliary functions.
49*0a6a1f1dSLionel Sambuc // ------------------------------------------------------------------------
50*0a6a1f1dSLionel Sambuc 
51*0a6a1f1dSLionel Sambuc namespace {
52*0a6a1f1dSLionel Sambuc 
53*0a6a1f1dSLionel Sambuc typedef std::map< std::string, std::string > vars_map;
54*0a6a1f1dSLionel Sambuc 
55*0a6a1f1dSLionel Sambuc static
56*0a6a1f1dSLionel Sambuc std::auto_ptr< std::ofstream >
new_atffile(void)57*0a6a1f1dSLionel Sambuc new_atffile(void)
58*0a6a1f1dSLionel Sambuc {
59*0a6a1f1dSLionel Sambuc     std::auto_ptr< std::ofstream > os(new std::ofstream("Atffile"));
60*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(*os);
61*0a6a1f1dSLionel Sambuc 
62*0a6a1f1dSLionel Sambuc     (*os) << "Content-Type: application/X-atf-atffile; version=\"1\"\n\n";
63*0a6a1f1dSLionel Sambuc     return os;
64*0a6a1f1dSLionel Sambuc }
65*0a6a1f1dSLionel Sambuc 
66*0a6a1f1dSLionel Sambuc static
67*0a6a1f1dSLionel Sambuc void
touch_exec(const char * name)68*0a6a1f1dSLionel Sambuc touch_exec(const char* name)
69*0a6a1f1dSLionel Sambuc {
70*0a6a1f1dSLionel Sambuc     std::ofstream os(name);
71*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(os);
72*0a6a1f1dSLionel Sambuc     os.close();
73*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(::chmod(name, S_IRWXU) != -1);
74*0a6a1f1dSLionel Sambuc }
75*0a6a1f1dSLionel Sambuc 
76*0a6a1f1dSLionel Sambuc static inline
77*0a6a1f1dSLionel Sambuc bool
is_in(const std::string & value,const std::vector<std::string> & v)78*0a6a1f1dSLionel Sambuc is_in(const std::string& value, const std::vector< std::string >& v)
79*0a6a1f1dSLionel Sambuc {
80*0a6a1f1dSLionel Sambuc     return std::find(v.begin(), v.end(), value) != v.end();
81*0a6a1f1dSLionel Sambuc }
82*0a6a1f1dSLionel Sambuc 
83*0a6a1f1dSLionel Sambuc } // anonymous namespace
84*0a6a1f1dSLionel Sambuc 
85*0a6a1f1dSLionel Sambuc // ------------------------------------------------------------------------
86*0a6a1f1dSLionel Sambuc // Tests cases for the "atffile" parser.
87*0a6a1f1dSLionel Sambuc // ------------------------------------------------------------------------
88*0a6a1f1dSLionel Sambuc 
89*0a6a1f1dSLionel Sambuc class atffile_reader : protected detail::atf_atffile_reader {
90*0a6a1f1dSLionel Sambuc     void
got_conf(const std::string & name,const std::string & val)91*0a6a1f1dSLionel Sambuc     got_conf(const std::string& name, const std::string& val)
92*0a6a1f1dSLionel Sambuc     {
93*0a6a1f1dSLionel Sambuc         m_calls.push_back("got_conf(" + name + ", " + val + ")");
94*0a6a1f1dSLionel Sambuc     }
95*0a6a1f1dSLionel Sambuc 
96*0a6a1f1dSLionel Sambuc     void
got_prop(const std::string & name,const std::string & val)97*0a6a1f1dSLionel Sambuc     got_prop(const std::string& name, const std::string& val)
98*0a6a1f1dSLionel Sambuc     {
99*0a6a1f1dSLionel Sambuc         m_calls.push_back("got_prop(" + name + ", " + val + ")");
100*0a6a1f1dSLionel Sambuc     }
101*0a6a1f1dSLionel Sambuc 
102*0a6a1f1dSLionel Sambuc     void
got_tp(const std::string & name,bool isglob)103*0a6a1f1dSLionel Sambuc     got_tp(const std::string& name, bool isglob)
104*0a6a1f1dSLionel Sambuc     {
105*0a6a1f1dSLionel Sambuc         m_calls.push_back("got_tp(" + name + ", " + (isglob ? "true" : "false")
106*0a6a1f1dSLionel Sambuc                   + ")");
107*0a6a1f1dSLionel Sambuc     }
108*0a6a1f1dSLionel Sambuc 
109*0a6a1f1dSLionel Sambuc     void
got_eof(void)110*0a6a1f1dSLionel Sambuc     got_eof(void)
111*0a6a1f1dSLionel Sambuc     {
112*0a6a1f1dSLionel Sambuc         m_calls.push_back("got_eof()");
113*0a6a1f1dSLionel Sambuc     }
114*0a6a1f1dSLionel Sambuc 
115*0a6a1f1dSLionel Sambuc public:
atffile_reader(std::istream & is)116*0a6a1f1dSLionel Sambuc     atffile_reader(std::istream& is) :
117*0a6a1f1dSLionel Sambuc         detail::atf_atffile_reader(is)
118*0a6a1f1dSLionel Sambuc     {
119*0a6a1f1dSLionel Sambuc     }
120*0a6a1f1dSLionel Sambuc 
121*0a6a1f1dSLionel Sambuc     void
read(void)122*0a6a1f1dSLionel Sambuc     read(void)
123*0a6a1f1dSLionel Sambuc     {
124*0a6a1f1dSLionel Sambuc         atf_atffile_reader::read();
125*0a6a1f1dSLionel Sambuc     }
126*0a6a1f1dSLionel Sambuc 
127*0a6a1f1dSLionel Sambuc     std::vector< std::string > m_calls;
128*0a6a1f1dSLionel Sambuc };
129*0a6a1f1dSLionel Sambuc 
130*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_1);
ATF_TEST_CASE_BODY(atffile_1)131*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_1)
132*0a6a1f1dSLionel Sambuc {
133*0a6a1f1dSLionel Sambuc     const char* input =
134*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
135*0a6a1f1dSLionel Sambuc         "\n"
136*0a6a1f1dSLionel Sambuc     ;
137*0a6a1f1dSLionel Sambuc 
138*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
139*0a6a1f1dSLionel Sambuc         "got_eof()",
140*0a6a1f1dSLionel Sambuc         NULL
141*0a6a1f1dSLionel Sambuc     };
142*0a6a1f1dSLionel Sambuc 
143*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
144*0a6a1f1dSLionel Sambuc         NULL
145*0a6a1f1dSLionel Sambuc     };
146*0a6a1f1dSLionel Sambuc 
147*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
148*0a6a1f1dSLionel Sambuc }
149*0a6a1f1dSLionel Sambuc 
150*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_2);
ATF_TEST_CASE_BODY(atffile_2)151*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_2)
152*0a6a1f1dSLionel Sambuc {
153*0a6a1f1dSLionel Sambuc     const char* input =
154*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
155*0a6a1f1dSLionel Sambuc         "\n"
156*0a6a1f1dSLionel Sambuc         "# This is a comment on a line of its own.\n"
157*0a6a1f1dSLionel Sambuc         "# And this is another one.\n"
158*0a6a1f1dSLionel Sambuc         "\n"
159*0a6a1f1dSLionel Sambuc         "	    # Another after some whitespace.\n"
160*0a6a1f1dSLionel Sambuc         "\n"
161*0a6a1f1dSLionel Sambuc         "# The last one after an empty line.\n"
162*0a6a1f1dSLionel Sambuc     ;
163*0a6a1f1dSLionel Sambuc 
164*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
165*0a6a1f1dSLionel Sambuc         "got_eof()",
166*0a6a1f1dSLionel Sambuc         NULL
167*0a6a1f1dSLionel Sambuc     };
168*0a6a1f1dSLionel Sambuc 
169*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
170*0a6a1f1dSLionel Sambuc         NULL
171*0a6a1f1dSLionel Sambuc     };
172*0a6a1f1dSLionel Sambuc 
173*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
174*0a6a1f1dSLionel Sambuc }
175*0a6a1f1dSLionel Sambuc 
176*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_3);
ATF_TEST_CASE_BODY(atffile_3)177*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_3)
178*0a6a1f1dSLionel Sambuc {
179*0a6a1f1dSLionel Sambuc     const char* input =
180*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
181*0a6a1f1dSLionel Sambuc         "\n"
182*0a6a1f1dSLionel Sambuc         "conf: var1=value1\n"
183*0a6a1f1dSLionel Sambuc         "conf: var2 = value2\n"
184*0a6a1f1dSLionel Sambuc         "conf: var3	=	value3\n"
185*0a6a1f1dSLionel Sambuc         "conf: var4	    =	    value4\n"
186*0a6a1f1dSLionel Sambuc         "\n"
187*0a6a1f1dSLionel Sambuc         "conf:var5=value5\n"
188*0a6a1f1dSLionel Sambuc         "    conf:var6=value6\n"
189*0a6a1f1dSLionel Sambuc         "\n"
190*0a6a1f1dSLionel Sambuc         "conf: var7 = \"This is a long value.\"\n"
191*0a6a1f1dSLionel Sambuc         "conf: var8 = \"Single-word\"\n"
192*0a6a1f1dSLionel Sambuc         "conf: var9 = \"    Single-word	\"\n"
193*0a6a1f1dSLionel Sambuc         "conf: var10 = Single-word\n"
194*0a6a1f1dSLionel Sambuc     ;
195*0a6a1f1dSLionel Sambuc 
196*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
197*0a6a1f1dSLionel Sambuc         "got_conf(var1, value1)",
198*0a6a1f1dSLionel Sambuc         "got_conf(var2, value2)",
199*0a6a1f1dSLionel Sambuc         "got_conf(var3, value3)",
200*0a6a1f1dSLionel Sambuc         "got_conf(var4, value4)",
201*0a6a1f1dSLionel Sambuc         "got_conf(var5, value5)",
202*0a6a1f1dSLionel Sambuc         "got_conf(var6, value6)",
203*0a6a1f1dSLionel Sambuc         "got_conf(var7, This is a long value.)",
204*0a6a1f1dSLionel Sambuc         "got_conf(var8, Single-word)",
205*0a6a1f1dSLionel Sambuc         "got_conf(var9,     Single-word	)",
206*0a6a1f1dSLionel Sambuc         "got_conf(var10, Single-word)",
207*0a6a1f1dSLionel Sambuc         "got_eof()",
208*0a6a1f1dSLionel Sambuc         NULL
209*0a6a1f1dSLionel Sambuc     };
210*0a6a1f1dSLionel Sambuc 
211*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
212*0a6a1f1dSLionel Sambuc         NULL
213*0a6a1f1dSLionel Sambuc     };
214*0a6a1f1dSLionel Sambuc 
215*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
216*0a6a1f1dSLionel Sambuc }
217*0a6a1f1dSLionel Sambuc 
218*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_4);
ATF_TEST_CASE_BODY(atffile_4)219*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_4)
220*0a6a1f1dSLionel Sambuc {
221*0a6a1f1dSLionel Sambuc     const char* input =
222*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
223*0a6a1f1dSLionel Sambuc         "\n"
224*0a6a1f1dSLionel Sambuc         "prop: var1=value1\n"
225*0a6a1f1dSLionel Sambuc         "prop: var2 = value2\n"
226*0a6a1f1dSLionel Sambuc         "prop: var3	=	value3\n"
227*0a6a1f1dSLionel Sambuc         "prop: var4	    =	    value4\n"
228*0a6a1f1dSLionel Sambuc         "\n"
229*0a6a1f1dSLionel Sambuc         "prop:var5=value5\n"
230*0a6a1f1dSLionel Sambuc         "    prop:var6=value6\n"
231*0a6a1f1dSLionel Sambuc         "\n"
232*0a6a1f1dSLionel Sambuc         "prop: var7 = \"This is a long value.\"\n"
233*0a6a1f1dSLionel Sambuc         "prop: var8 = \"Single-word\"\n"
234*0a6a1f1dSLionel Sambuc         "prop: var9 = \"    Single-word	\"\n"
235*0a6a1f1dSLionel Sambuc         "prop: var10 = Single-word\n"
236*0a6a1f1dSLionel Sambuc     ;
237*0a6a1f1dSLionel Sambuc 
238*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
239*0a6a1f1dSLionel Sambuc         "got_prop(var1, value1)",
240*0a6a1f1dSLionel Sambuc         "got_prop(var2, value2)",
241*0a6a1f1dSLionel Sambuc         "got_prop(var3, value3)",
242*0a6a1f1dSLionel Sambuc         "got_prop(var4, value4)",
243*0a6a1f1dSLionel Sambuc         "got_prop(var5, value5)",
244*0a6a1f1dSLionel Sambuc         "got_prop(var6, value6)",
245*0a6a1f1dSLionel Sambuc         "got_prop(var7, This is a long value.)",
246*0a6a1f1dSLionel Sambuc         "got_prop(var8, Single-word)",
247*0a6a1f1dSLionel Sambuc         "got_prop(var9,     Single-word	)",
248*0a6a1f1dSLionel Sambuc         "got_prop(var10, Single-word)",
249*0a6a1f1dSLionel Sambuc         "got_eof()",
250*0a6a1f1dSLionel Sambuc         NULL
251*0a6a1f1dSLionel Sambuc     };
252*0a6a1f1dSLionel Sambuc 
253*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
254*0a6a1f1dSLionel Sambuc         NULL
255*0a6a1f1dSLionel Sambuc     };
256*0a6a1f1dSLionel Sambuc 
257*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
258*0a6a1f1dSLionel Sambuc }
259*0a6a1f1dSLionel Sambuc 
260*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_5);
ATF_TEST_CASE_BODY(atffile_5)261*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_5)
262*0a6a1f1dSLionel Sambuc {
263*0a6a1f1dSLionel Sambuc     const char* input =
264*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
265*0a6a1f1dSLionel Sambuc         "\n"
266*0a6a1f1dSLionel Sambuc         "tp:foo\n"
267*0a6a1f1dSLionel Sambuc         "tp: foo\n"
268*0a6a1f1dSLionel Sambuc         "tp:  foo\n"
269*0a6a1f1dSLionel Sambuc         "tp:	foo\n"
270*0a6a1f1dSLionel Sambuc         "tp:	    foo\n"
271*0a6a1f1dSLionel Sambuc         "tp: \"name with spaces\"\n"
272*0a6a1f1dSLionel Sambuc         "tp: \"single-word\"\n"
273*0a6a1f1dSLionel Sambuc         "tp: single-word\n"
274*0a6a1f1dSLionel Sambuc         "\n"
275*0a6a1f1dSLionel Sambuc         "tp-glob:foo*?bar\n"
276*0a6a1f1dSLionel Sambuc         "tp-glob: foo*?bar\n"
277*0a6a1f1dSLionel Sambuc         "tp-glob:  foo*?bar\n"
278*0a6a1f1dSLionel Sambuc         "tp-glob:	foo*?bar\n"
279*0a6a1f1dSLionel Sambuc         "tp-glob:	    foo*?bar\n"
280*0a6a1f1dSLionel Sambuc         "tp-glob: \"glob * with ? spaces\"\n"
281*0a6a1f1dSLionel Sambuc         "tp-glob: \"single-*-word\"\n"
282*0a6a1f1dSLionel Sambuc         "tp-glob: single-*-word\n"
283*0a6a1f1dSLionel Sambuc     ;
284*0a6a1f1dSLionel Sambuc 
285*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
286*0a6a1f1dSLionel Sambuc         "got_tp(foo, false)",
287*0a6a1f1dSLionel Sambuc         "got_tp(foo, false)",
288*0a6a1f1dSLionel Sambuc         "got_tp(foo, false)",
289*0a6a1f1dSLionel Sambuc         "got_tp(foo, false)",
290*0a6a1f1dSLionel Sambuc         "got_tp(foo, false)",
291*0a6a1f1dSLionel Sambuc         "got_tp(name with spaces, false)",
292*0a6a1f1dSLionel Sambuc         "got_tp(single-word, false)",
293*0a6a1f1dSLionel Sambuc         "got_tp(single-word, false)",
294*0a6a1f1dSLionel Sambuc         "got_tp(foo*?bar, true)",
295*0a6a1f1dSLionel Sambuc         "got_tp(foo*?bar, true)",
296*0a6a1f1dSLionel Sambuc         "got_tp(foo*?bar, true)",
297*0a6a1f1dSLionel Sambuc         "got_tp(foo*?bar, true)",
298*0a6a1f1dSLionel Sambuc         "got_tp(foo*?bar, true)",
299*0a6a1f1dSLionel Sambuc         "got_tp(glob * with ? spaces, true)",
300*0a6a1f1dSLionel Sambuc         "got_tp(single-*-word, true)",
301*0a6a1f1dSLionel Sambuc         "got_tp(single-*-word, true)",
302*0a6a1f1dSLionel Sambuc         "got_eof()",
303*0a6a1f1dSLionel Sambuc         NULL
304*0a6a1f1dSLionel Sambuc     };
305*0a6a1f1dSLionel Sambuc 
306*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
307*0a6a1f1dSLionel Sambuc         NULL
308*0a6a1f1dSLionel Sambuc     };
309*0a6a1f1dSLionel Sambuc 
310*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
311*0a6a1f1dSLionel Sambuc }
312*0a6a1f1dSLionel Sambuc 
313*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_6);
ATF_TEST_CASE_BODY(atffile_6)314*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_6)
315*0a6a1f1dSLionel Sambuc {
316*0a6a1f1dSLionel Sambuc     const char* input =
317*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
318*0a6a1f1dSLionel Sambuc         "\n"
319*0a6a1f1dSLionel Sambuc         "prop: foo = bar # A comment.\n"
320*0a6a1f1dSLionel Sambuc         "conf: foo = bar # A comment.\n"
321*0a6a1f1dSLionel Sambuc         "tp: foo # A comment.\n"
322*0a6a1f1dSLionel Sambuc         "tp-glob: foo # A comment.\n"
323*0a6a1f1dSLionel Sambuc     ;
324*0a6a1f1dSLionel Sambuc 
325*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
326*0a6a1f1dSLionel Sambuc         "got_prop(foo, bar)",
327*0a6a1f1dSLionel Sambuc         "got_conf(foo, bar)",
328*0a6a1f1dSLionel Sambuc         "got_tp(foo, false)",
329*0a6a1f1dSLionel Sambuc         "got_tp(foo, true)",
330*0a6a1f1dSLionel Sambuc         "got_eof()",
331*0a6a1f1dSLionel Sambuc         NULL
332*0a6a1f1dSLionel Sambuc     };
333*0a6a1f1dSLionel Sambuc 
334*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
335*0a6a1f1dSLionel Sambuc         NULL
336*0a6a1f1dSLionel Sambuc     };
337*0a6a1f1dSLionel Sambuc 
338*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
339*0a6a1f1dSLionel Sambuc }
340*0a6a1f1dSLionel Sambuc 
341*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_50);
ATF_TEST_CASE_BODY(atffile_50)342*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_50)
343*0a6a1f1dSLionel Sambuc {
344*0a6a1f1dSLionel Sambuc     const char* input =
345*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
346*0a6a1f1dSLionel Sambuc         "\n"
347*0a6a1f1dSLionel Sambuc         "foo\n"
348*0a6a1f1dSLionel Sambuc     ;
349*0a6a1f1dSLionel Sambuc 
350*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
351*0a6a1f1dSLionel Sambuc         NULL
352*0a6a1f1dSLionel Sambuc     };
353*0a6a1f1dSLionel Sambuc 
354*0a6a1f1dSLionel Sambuc     // NO_CHECK_STYLE_BEGIN
355*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
356*0a6a1f1dSLionel Sambuc         "3: Unexpected token `foo'; expected conf, #, prop, tp, tp-glob, a new line or eof",
357*0a6a1f1dSLionel Sambuc         NULL
358*0a6a1f1dSLionel Sambuc     };
359*0a6a1f1dSLionel Sambuc     // NO_CHECK_STYLE_END
360*0a6a1f1dSLionel Sambuc 
361*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
362*0a6a1f1dSLionel Sambuc }
363*0a6a1f1dSLionel Sambuc 
364*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_51);
ATF_TEST_CASE_BODY(atffile_51)365*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_51)
366*0a6a1f1dSLionel Sambuc {
367*0a6a1f1dSLionel Sambuc     const char* input =
368*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
369*0a6a1f1dSLionel Sambuc         "\n"
370*0a6a1f1dSLionel Sambuc         "foo bar\n"
371*0a6a1f1dSLionel Sambuc         "baz\n"
372*0a6a1f1dSLionel Sambuc     ;
373*0a6a1f1dSLionel Sambuc 
374*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
375*0a6a1f1dSLionel Sambuc         NULL
376*0a6a1f1dSLionel Sambuc     };
377*0a6a1f1dSLionel Sambuc 
378*0a6a1f1dSLionel Sambuc     // NO_CHECK_STYLE_BEGIN
379*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
380*0a6a1f1dSLionel Sambuc         "3: Unexpected token `foo'; expected conf, #, prop, tp, tp-glob, a new line or eof",
381*0a6a1f1dSLionel Sambuc         "4: Unexpected token `baz'; expected conf, #, prop, tp, tp-glob, a new line or eof",
382*0a6a1f1dSLionel Sambuc         NULL
383*0a6a1f1dSLionel Sambuc     };
384*0a6a1f1dSLionel Sambuc     // NO_CHECK_STYLE_END
385*0a6a1f1dSLionel Sambuc 
386*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
387*0a6a1f1dSLionel Sambuc }
388*0a6a1f1dSLionel Sambuc 
389*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_52);
ATF_TEST_CASE_BODY(atffile_52)390*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_52)
391*0a6a1f1dSLionel Sambuc {
392*0a6a1f1dSLionel Sambuc     const char* input =
393*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
394*0a6a1f1dSLionel Sambuc         "\n"
395*0a6a1f1dSLionel Sambuc         "conf\n"
396*0a6a1f1dSLionel Sambuc         "conf:\n"
397*0a6a1f1dSLionel Sambuc         "conf: foo =\n"
398*0a6a1f1dSLionel Sambuc         "conf: bar = # A comment.\n"
399*0a6a1f1dSLionel Sambuc         "\n"
400*0a6a1f1dSLionel Sambuc         "prop\n"
401*0a6a1f1dSLionel Sambuc         "prop:\n"
402*0a6a1f1dSLionel Sambuc         "prop: foo =\n"
403*0a6a1f1dSLionel Sambuc         "prop: bar = # A comment.\n"
404*0a6a1f1dSLionel Sambuc         "\n"
405*0a6a1f1dSLionel Sambuc         "tp\n"
406*0a6a1f1dSLionel Sambuc         "tp:\n"
407*0a6a1f1dSLionel Sambuc         "tp: # A comment.\n"
408*0a6a1f1dSLionel Sambuc         "\n"
409*0a6a1f1dSLionel Sambuc         "tp-glob\n"
410*0a6a1f1dSLionel Sambuc         "tp-glob:\n"
411*0a6a1f1dSLionel Sambuc         "tp-glob: # A comment.\n"
412*0a6a1f1dSLionel Sambuc     ;
413*0a6a1f1dSLionel Sambuc 
414*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
415*0a6a1f1dSLionel Sambuc         NULL
416*0a6a1f1dSLionel Sambuc     };
417*0a6a1f1dSLionel Sambuc 
418*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
419*0a6a1f1dSLionel Sambuc         "3: Unexpected token `<<NEWLINE>>'; expected `:'",
420*0a6a1f1dSLionel Sambuc         "4: Unexpected token `<<NEWLINE>>'; expected variable name",
421*0a6a1f1dSLionel Sambuc         "5: Unexpected token `<<NEWLINE>>'; expected word or quoted string",
422*0a6a1f1dSLionel Sambuc         "6: Unexpected token `#'; expected word or quoted string",
423*0a6a1f1dSLionel Sambuc         "8: Unexpected token `<<NEWLINE>>'; expected `:'",
424*0a6a1f1dSLionel Sambuc         "9: Unexpected token `<<NEWLINE>>'; expected property name",
425*0a6a1f1dSLionel Sambuc         "10: Unexpected token `<<NEWLINE>>'; expected word or quoted string",
426*0a6a1f1dSLionel Sambuc         "11: Unexpected token `#'; expected word or quoted string",
427*0a6a1f1dSLionel Sambuc         "13: Unexpected token `<<NEWLINE>>'; expected `:'",
428*0a6a1f1dSLionel Sambuc         "14: Unexpected token `<<NEWLINE>>'; expected word or quoted string",
429*0a6a1f1dSLionel Sambuc         "15: Unexpected token `#'; expected word or quoted string",
430*0a6a1f1dSLionel Sambuc         "17: Unexpected token `<<NEWLINE>>'; expected `:'",
431*0a6a1f1dSLionel Sambuc         "18: Unexpected token `<<NEWLINE>>'; expected word or quoted string",
432*0a6a1f1dSLionel Sambuc         "19: Unexpected token `#'; expected word or quoted string",
433*0a6a1f1dSLionel Sambuc         NULL
434*0a6a1f1dSLionel Sambuc     };
435*0a6a1f1dSLionel Sambuc 
436*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
437*0a6a1f1dSLionel Sambuc }
438*0a6a1f1dSLionel Sambuc 
439*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_53);
ATF_TEST_CASE_BODY(atffile_53)440*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_53)
441*0a6a1f1dSLionel Sambuc {
442*0a6a1f1dSLionel Sambuc     const char* input =
443*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
444*0a6a1f1dSLionel Sambuc         "\n"
445*0a6a1f1dSLionel Sambuc         "prop: foo = \"Correct value\" # With comment.\n"
446*0a6a1f1dSLionel Sambuc         "\n"
447*0a6a1f1dSLionel Sambuc         "prop: bar = # A comment.\n"
448*0a6a1f1dSLionel Sambuc         "\n"
449*0a6a1f1dSLionel Sambuc         "prop: baz = \"Last variable\"\n"
450*0a6a1f1dSLionel Sambuc         "\n"
451*0a6a1f1dSLionel Sambuc         "# End of file.\n"
452*0a6a1f1dSLionel Sambuc     ;
453*0a6a1f1dSLionel Sambuc 
454*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
455*0a6a1f1dSLionel Sambuc         "got_prop(foo, Correct value)",
456*0a6a1f1dSLionel Sambuc         NULL
457*0a6a1f1dSLionel Sambuc     };
458*0a6a1f1dSLionel Sambuc 
459*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
460*0a6a1f1dSLionel Sambuc         "5: Unexpected token `#'; expected word or quoted string",
461*0a6a1f1dSLionel Sambuc         NULL
462*0a6a1f1dSLionel Sambuc     };
463*0a6a1f1dSLionel Sambuc 
464*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
465*0a6a1f1dSLionel Sambuc }
466*0a6a1f1dSLionel Sambuc 
467*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(atffile_54);
ATF_TEST_CASE_BODY(atffile_54)468*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_54)
469*0a6a1f1dSLionel Sambuc {
470*0a6a1f1dSLionel Sambuc     const char* input =
471*0a6a1f1dSLionel Sambuc         "Content-Type: application/X-atf-atffile; version=\"1\"\n"
472*0a6a1f1dSLionel Sambuc         "\n"
473*0a6a1f1dSLionel Sambuc         "prop: foo = \"\n"
474*0a6a1f1dSLionel Sambuc         "prop: bar = \"text\n"
475*0a6a1f1dSLionel Sambuc         "prop: baz = \"te\\\"xt\n"
476*0a6a1f1dSLionel Sambuc         "prop: last = \"\\\"\n"
477*0a6a1f1dSLionel Sambuc     ;
478*0a6a1f1dSLionel Sambuc 
479*0a6a1f1dSLionel Sambuc     const char* exp_calls[] = {
480*0a6a1f1dSLionel Sambuc         NULL
481*0a6a1f1dSLionel Sambuc     };
482*0a6a1f1dSLionel Sambuc 
483*0a6a1f1dSLionel Sambuc     const char* exp_errors[] = {
484*0a6a1f1dSLionel Sambuc         "3: Missing double quotes before end of line",
485*0a6a1f1dSLionel Sambuc         "4: Missing double quotes before end of line",
486*0a6a1f1dSLionel Sambuc         "5: Missing double quotes before end of line",
487*0a6a1f1dSLionel Sambuc         "6: Missing double quotes before end of line",
488*0a6a1f1dSLionel Sambuc         NULL
489*0a6a1f1dSLionel Sambuc     };
490*0a6a1f1dSLionel Sambuc 
491*0a6a1f1dSLionel Sambuc     do_parser_test< atffile_reader >(input, exp_calls, exp_errors);
492*0a6a1f1dSLionel Sambuc }
493*0a6a1f1dSLionel Sambuc 
494*0a6a1f1dSLionel Sambuc // ------------------------------------------------------------------------
495*0a6a1f1dSLionel Sambuc // Tests cases for the "atffile" class.
496*0a6a1f1dSLionel Sambuc // ------------------------------------------------------------------------
497*0a6a1f1dSLionel Sambuc 
498*0a6a1f1dSLionel Sambuc ATF_TEST_CASE(atffile_getters);
ATF_TEST_CASE_HEAD(atffile_getters)499*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_HEAD(atffile_getters) {}
ATF_TEST_CASE_BODY(atffile_getters)500*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(atffile_getters) {
501*0a6a1f1dSLionel Sambuc     vars_map config_vars;
502*0a6a1f1dSLionel Sambuc     config_vars["config-var-1"] = "value 1";
503*0a6a1f1dSLionel Sambuc 
504*0a6a1f1dSLionel Sambuc     std::vector< std::string > test_program_names;
505*0a6a1f1dSLionel Sambuc     test_program_names.push_back("test-program-1");
506*0a6a1f1dSLionel Sambuc 
507*0a6a1f1dSLionel Sambuc     vars_map properties;
508*0a6a1f1dSLionel Sambuc     properties["test-suite"] = "a test name";
509*0a6a1f1dSLionel Sambuc 
510*0a6a1f1dSLionel Sambuc     const tools::atffile atffile(config_vars, test_program_names, properties);
511*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(config_vars == atffile.conf());
512*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(test_program_names == atffile.tps());
513*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(properties == atffile.props());
514*0a6a1f1dSLionel Sambuc }
515*0a6a1f1dSLionel Sambuc 
516*0a6a1f1dSLionel Sambuc // ------------------------------------------------------------------------
517*0a6a1f1dSLionel Sambuc // Tests cases for the free functions.
518*0a6a1f1dSLionel Sambuc // ------------------------------------------------------------------------
519*0a6a1f1dSLionel Sambuc 
520*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(read_ok_simple);
ATF_TEST_CASE_BODY(read_ok_simple)521*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(read_ok_simple) {
522*0a6a1f1dSLionel Sambuc     std::auto_ptr< std::ofstream > os = new_atffile();
523*0a6a1f1dSLionel Sambuc     (*os) << "prop: test-suite = foo\n";
524*0a6a1f1dSLionel Sambuc     (*os) << "tp: tp-1\n";
525*0a6a1f1dSLionel Sambuc     (*os) << "conf: var1 = value1\n";
526*0a6a1f1dSLionel Sambuc     (*os) << "tp: tp-2\n";
527*0a6a1f1dSLionel Sambuc     (*os) << "tp: tp-3\n";
528*0a6a1f1dSLionel Sambuc     (*os) << "prop: prop1 = propvalue1\n";
529*0a6a1f1dSLionel Sambuc     (*os) << "conf: var2 = value2\n";
530*0a6a1f1dSLionel Sambuc     (*os).close();
531*0a6a1f1dSLionel Sambuc 
532*0a6a1f1dSLionel Sambuc     touch_exec("tp-1");
533*0a6a1f1dSLionel Sambuc     touch_exec("tp-2");
534*0a6a1f1dSLionel Sambuc     touch_exec("tp-3");
535*0a6a1f1dSLionel Sambuc 
536*0a6a1f1dSLionel Sambuc     const tools::atffile atffile = tools::read_atffile(
537*0a6a1f1dSLionel Sambuc         tools::fs::path("Atffile"));
538*0a6a1f1dSLionel Sambuc     ATF_REQUIRE_EQ(2, atffile.conf().size());
539*0a6a1f1dSLionel Sambuc     ATF_REQUIRE_EQ("value1", atffile.conf().find("var1")->second);
540*0a6a1f1dSLionel Sambuc     ATF_REQUIRE_EQ("value2", atffile.conf().find("var2")->second);
541*0a6a1f1dSLionel Sambuc     ATF_REQUIRE_EQ(3, atffile.tps().size());
542*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(is_in("tp-1", atffile.tps()));
543*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(is_in("tp-2", atffile.tps()));
544*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(is_in("tp-3", atffile.tps()));
545*0a6a1f1dSLionel Sambuc     ATF_REQUIRE_EQ(2, atffile.props().size());
546*0a6a1f1dSLionel Sambuc     ATF_REQUIRE_EQ("foo", atffile.props().find("test-suite")->second);
547*0a6a1f1dSLionel Sambuc     ATF_REQUIRE_EQ("propvalue1", atffile.props().find("prop1")->second);
548*0a6a1f1dSLionel Sambuc }
549*0a6a1f1dSLionel Sambuc 
550*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(read_ok_some_globs);
ATF_TEST_CASE_BODY(read_ok_some_globs)551*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(read_ok_some_globs) {
552*0a6a1f1dSLionel Sambuc     std::auto_ptr< std::ofstream > os = new_atffile();
553*0a6a1f1dSLionel Sambuc     (*os) << "prop: test-suite = foo\n";
554*0a6a1f1dSLionel Sambuc     (*os) << "tp: foo\n";
555*0a6a1f1dSLionel Sambuc     (*os) << "tp-glob: *K*\n";
556*0a6a1f1dSLionel Sambuc     (*os) << "tp: bar\n";
557*0a6a1f1dSLionel Sambuc     (*os) << "tp-glob: t_*\n";
558*0a6a1f1dSLionel Sambuc     (*os).close();
559*0a6a1f1dSLionel Sambuc 
560*0a6a1f1dSLionel Sambuc     touch_exec("foo");
561*0a6a1f1dSLionel Sambuc     touch_exec("bar");
562*0a6a1f1dSLionel Sambuc     touch_exec("aK");
563*0a6a1f1dSLionel Sambuc     touch_exec("KKKKK");
564*0a6a1f1dSLionel Sambuc     touch_exec("t_hello");
565*0a6a1f1dSLionel Sambuc     touch_exec("zzzt_hello");
566*0a6a1f1dSLionel Sambuc 
567*0a6a1f1dSLionel Sambuc     const tools::atffile atffile = tools::read_atffile(
568*0a6a1f1dSLionel Sambuc         tools::fs::path("Atffile"));
569*0a6a1f1dSLionel Sambuc     ATF_REQUIRE_EQ(5, atffile.tps().size());
570*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(is_in("foo", atffile.tps()));
571*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(is_in("bar", atffile.tps()));
572*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(is_in("aK", atffile.tps()));
573*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(is_in("KKKKK", atffile.tps()));
574*0a6a1f1dSLionel Sambuc     ATF_REQUIRE(is_in("t_hello", atffile.tps()));
575*0a6a1f1dSLionel Sambuc }
576*0a6a1f1dSLionel Sambuc 
577*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(read_missing_test_suite);
ATF_TEST_CASE_BODY(read_missing_test_suite)578*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(read_missing_test_suite) {
579*0a6a1f1dSLionel Sambuc     std::auto_ptr< std::ofstream > os = new_atffile();
580*0a6a1f1dSLionel Sambuc     (*os).close();
581*0a6a1f1dSLionel Sambuc 
582*0a6a1f1dSLionel Sambuc     try {
583*0a6a1f1dSLionel Sambuc         (void)tools::read_atffile(tools::fs::path("Atffile"));
584*0a6a1f1dSLionel Sambuc         ATF_FAIL("Missing property 'test-suite' did not raise an error");
585*0a6a1f1dSLionel Sambuc     } catch (const tools::not_found_error< std::string >& e) {
586*0a6a1f1dSLionel Sambuc         ATF_REQUIRE_EQ("test-suite", e.get_value());
587*0a6a1f1dSLionel Sambuc     }
588*0a6a1f1dSLionel Sambuc }
589*0a6a1f1dSLionel Sambuc 
590*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(read_missing_test_program);
ATF_TEST_CASE_BODY(read_missing_test_program)591*0a6a1f1dSLionel Sambuc ATF_TEST_CASE_BODY(read_missing_test_program) {
592*0a6a1f1dSLionel Sambuc     std::auto_ptr< std::ofstream > os = new_atffile();
593*0a6a1f1dSLionel Sambuc     (*os) << "tp: foo\n";
594*0a6a1f1dSLionel Sambuc     (*os) << "tp: bar\n";
595*0a6a1f1dSLionel Sambuc     (*os) << "tp: baz\n";
596*0a6a1f1dSLionel Sambuc     (*os).close();
597*0a6a1f1dSLionel Sambuc 
598*0a6a1f1dSLionel Sambuc     touch_exec("foo");
599*0a6a1f1dSLionel Sambuc     touch_exec("baz");
600*0a6a1f1dSLionel Sambuc 
601*0a6a1f1dSLionel Sambuc     try {
602*0a6a1f1dSLionel Sambuc         (void)tools::read_atffile(tools::fs::path("Atffile"));
603*0a6a1f1dSLionel Sambuc         ATF_FAIL("Missing file 'bar' did not raise an error");
604*0a6a1f1dSLionel Sambuc     } catch (const tools::not_found_error< tools::fs::path >& e) {
605*0a6a1f1dSLionel Sambuc         ATF_REQUIRE_EQ("bar", e.get_value().str());
606*0a6a1f1dSLionel Sambuc     }
607*0a6a1f1dSLionel Sambuc }
608*0a6a1f1dSLionel Sambuc 
609*0a6a1f1dSLionel Sambuc // ------------------------------------------------------------------------
610*0a6a1f1dSLionel Sambuc // Main.
611*0a6a1f1dSLionel Sambuc // ------------------------------------------------------------------------
612*0a6a1f1dSLionel Sambuc 
ATF_INIT_TEST_CASES(tcs)613*0a6a1f1dSLionel Sambuc ATF_INIT_TEST_CASES(tcs)
614*0a6a1f1dSLionel Sambuc {
615*0a6a1f1dSLionel Sambuc     // Add the test cases for the parser class.
616*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_1);
617*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_2);
618*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_3);
619*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_4);
620*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_5);
621*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_6);
622*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_50);
623*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_51);
624*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_52);
625*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_53);
626*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_54);
627*0a6a1f1dSLionel Sambuc 
628*0a6a1f1dSLionel Sambuc     // Add the test cases for the atffile class.
629*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, atffile_getters);
630*0a6a1f1dSLionel Sambuc 
631*0a6a1f1dSLionel Sambuc     // Add the test cases for the free functions.
632*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, read_ok_simple);
633*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, read_ok_some_globs);
634*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, read_missing_test_suite);
635*0a6a1f1dSLionel Sambuc     ATF_ADD_TEST_CASE(tcs, read_missing_test_program);
636*0a6a1f1dSLionel Sambuc }
637