• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2016 Lee Clagett
3 
4     Use modification and distribution are subject to the Boost Software
5     License, Version 1.0. (See accompanyintg file LICENSE_1_0.txt or copy at
6     http://www.boost.org/LICENSE_1_0.txt).
7 ==============================================================================*/
8 
9 #include <boost/config.hpp>
10 #include <boost/detail/lightweight_test.hpp>
11 #include <boost/fusion/adapted/boost_tuple.hpp>
12 #include <boost/fusion/adapted/std_pair.hpp>
13 #if !defined(BOOST_NO_CXX11_HDR_TUPLE) \
14  && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
15 # include <boost/fusion/adapted/std_tuple.hpp>
16 #endif
17 #include <boost/fusion/container/deque.hpp>
18 #include <boost/fusion/container/list.hpp>
19 #include <boost/fusion/tuple.hpp>
20 #include <boost/fusion/container/vector.hpp>
21 
22 #include "fixture.hpp"
23 
24 template <template <typename> class Scenario>
test()25 void test()
26 {
27     using namespace test_detail;
28 
29     // Note the trunction conversion tests from each containter
30     // ... bug or feature?
31 
32     BOOST_TEST((
33         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
34             boost::fusion::push_back(FUSION_SEQUENCE<int>(300), 400)
35         )
36     ));
37     BOOST_TEST((
38         run< Scenario< FUSION_SEQUENCE<convertible> > >(
39             boost::fusion::push_back(FUSION_SEQUENCE<int>(200), 400)
40           , FUSION_SEQUENCE<convertible>(200)
41         )
42     ));
43 
44     BOOST_TEST((run<Scenario<FUSION_SEQUENCE<> > >(boost::fusion::vector<>())));
45     BOOST_TEST((
46         run< Scenario< FUSION_SEQUENCE<> > >(
47             boost::fusion::vector<int>(100), boost::fusion::vector<>()
48         )
49     ));
50     BOOST_TEST((
51         run< Scenario< FUSION_SEQUENCE<convertible> > >(
52             boost::fusion::vector<int>(110)
53         )
54     ));
55     BOOST_TEST((
56         run< Scenario< FUSION_SEQUENCE<convertible> > >(
57             boost::fusion::vector<int, int>(200, 100)
58           , boost::fusion::vector<convertible>(200)
59         )
60     ));
61     BOOST_TEST((
62         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
63             boost::fusion::vector<int, int>(200, 400)
64         )
65     ));
66     BOOST_TEST((
67         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
68             boost::fusion::vector<int, int, int>(500, 400, 100)
69           , boost::fusion::vector<convertible, int>(500, 400)
70         )
71     ));
72     BOOST_TEST((
73         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
74             boost::fusion::push_back(
75                 boost::fusion::vector<int>(500), 400
76             )
77         )
78     ));
79     BOOST_TEST((
80         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
81             boost::fusion::push_back(
82                 boost::fusion::vector<int, int>(500, 400), 100
83             )
84           , boost::fusion::vector<convertible, int>(500, 400)
85         )
86     ));
87 
88     BOOST_TEST((run<Scenario< FUSION_SEQUENCE<> > >(boost::fusion::deque<>())));
89     BOOST_TEST((
90         run< Scenario< FUSION_SEQUENCE<> > >(
91             boost::fusion::deque<int>(100), boost::fusion::deque<>()
92         )
93     ));
94     BOOST_TEST((
95         run< Scenario< FUSION_SEQUENCE<convertible> > >(
96             boost::fusion::deque<int>(500)
97         )
98     ));
99     BOOST_TEST((
100         run< Scenario< FUSION_SEQUENCE<convertible> > >(
101             boost::fusion::deque<int, int>(500, 100)
102           , boost::fusion::deque<convertible>(500)
103         )
104     ));
105     BOOST_TEST((
106         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
107             boost::fusion::deque<int, int>(500, 400)
108         )
109     ));
110     BOOST_TEST((
111         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
112             boost::fusion::deque<int, int, int>(500, 400, 100)
113           , boost::fusion::deque<convertible, int>(500, 400)
114         )
115     ));
116     BOOST_TEST((
117         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
118             boost::fusion::push_back(
119                 boost::fusion::deque<int>(500), 400
120             )
121         )
122     ));
123     BOOST_TEST((
124         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
125             boost::fusion::push_back(
126                 boost::fusion::deque<int, int>(500, 400), 100
127             )
128           , boost::fusion::deque<convertible, int>(500, 400)
129         )
130     ));
131 
132     BOOST_TEST((run< Scenario< FUSION_SEQUENCE<> > >(boost::fusion::list<>())));
133     BOOST_TEST((
134         run< Scenario< FUSION_SEQUENCE<> > >(
135             boost::fusion::list<int>(100), boost::fusion::list<>()
136         )
137     ));
138     BOOST_TEST((
139         run< Scenario< FUSION_SEQUENCE<convertible> > >(
140             boost::fusion::list<int>(500)
141         )
142     ));
143     BOOST_TEST((
144         run< Scenario< FUSION_SEQUENCE<convertible> > >(
145             boost::fusion::list<int, int>(500, 100)
146           , boost::fusion::list<convertible>(500)
147         )
148     ));
149     BOOST_TEST((
150         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
151             boost::fusion::list<int, int>(500, 400)
152         )
153     ));
154     BOOST_TEST((
155         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
156             boost::fusion::list<int, int, int>(500, 400, 100)
157           , boost::fusion::list<convertible, int>(500, 400)
158         )
159     ));
160     BOOST_TEST((
161         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
162             boost::fusion::push_back(
163                 boost::fusion::list<int>(500), 400
164             )
165         )
166     ));
167     BOOST_TEST((
168         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
169             boost::fusion::push_back(
170                 boost::fusion::list<int, int>(500, 400), 100
171             )
172           , boost::fusion::list<convertible, int>(500, 400)
173         )
174     ));
175 
176     BOOST_TEST((run<Scenario< FUSION_SEQUENCE<> > >(boost::fusion::tuple<>())));
177     BOOST_TEST((
178         run< Scenario< FUSION_SEQUENCE<> > >(
179             boost::fusion::tuple<int>(100), boost::fusion::tuple<>()
180         )
181     ));
182     BOOST_TEST((
183         run< Scenario< FUSION_SEQUENCE<convertible> > >(
184             boost::fusion::tuple<int>(500)
185         )
186     ));
187     BOOST_TEST((
188         run< Scenario< FUSION_SEQUENCE<convertible> > >(
189             boost::fusion::tuple<int, int>(500, 100)
190           , boost::fusion::tuple<convertible>(500)
191         )
192     ));
193     BOOST_TEST((
194         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
195             boost::fusion::tuple<int, int>(500, 400)
196         )
197     ));
198     BOOST_TEST((
199         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
200             boost::fusion::tuple<int, int, int>(500, 400, 100)
201           , boost::fusion::tuple<convertible, int>(500, 400)
202         )
203     ));
204     BOOST_TEST((
205         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
206             boost::fusion::push_back(
207                 boost::fusion::tuple<int>(500), 400
208             )
209         )
210     ));
211     BOOST_TEST((
212         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
213             boost::fusion::push_back(
214                 boost::fusion::tuple<int, int>(500, 400), 100
215             )
216           , boost::fusion::tuple<convertible, int>(500, 400)
217         )
218     ));
219 
220     BOOST_TEST((run< Scenario< FUSION_SEQUENCE<> > >(boost::tuple<>())));
221     BOOST_TEST((
222         run< Scenario< FUSION_SEQUENCE<> > >(
223             boost::tuple<int>(100), boost::tuple<>()
224         )
225     ));
226     BOOST_TEST((
227         run< Scenario< FUSION_SEQUENCE<convertible> > >(
228             boost::tuple<int>(500)
229         )
230     ));
231     BOOST_TEST((
232         run< Scenario< FUSION_SEQUENCE<convertible> > >(
233             boost::tuple<int, int>(500, 100)
234           , boost::tuple<convertible>(500)
235         )
236     ));
237     BOOST_TEST((
238         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
239             boost::tuple<int, int>(500, 400)
240         )
241     ));
242     BOOST_TEST((
243         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
244             boost::tuple<int, int, int>(500, 400, 100)
245           , boost::tuple<convertible, int>(500, 400)
246         )
247     ));
248     BOOST_TEST((
249         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
250             boost::fusion::push_back(boost::tuple<int>(500), 400)
251         )
252     ));
253     BOOST_TEST((
254         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
255             boost::fusion::push_back(
256                 boost::tuple<int, int>(500, 400), 100
257             )
258           , boost::tuple<convertible, int>(500, 400)
259         )
260     ));
261 
262 #if !defined(BOOST_NO_CXX11_HDR_TUPLE) \
263  && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
264     BOOST_TEST((run< Scenario< FUSION_SEQUENCE<> > >(std::tuple<>())));
265     BOOST_TEST((
266         run<Scenario<FUSION_SEQUENCE<> > >(std::tuple<int>(100), std::tuple<>())
267     ));
268     BOOST_TEST((
269         run< Scenario< FUSION_SEQUENCE<convertible> > >(
270             std::tuple<int>(500)
271         )
272     ));
273     BOOST_TEST((
274         run< Scenario< FUSION_SEQUENCE<convertible> > >(
275             std::tuple<int, int>(500, 100)
276           , std::tuple<convertible>(500)
277         )
278     ));
279     BOOST_TEST((
280         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
281             std::tuple<int, int>(500, 400)
282         )
283     ));
284     BOOST_TEST((
285         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
286             std::tuple<int, int, int>(500, 400, 100)
287           , std::tuple<convertible, int>(500, 400)
288         )
289     ));
290     BOOST_TEST((
291         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
292             boost::fusion::push_back(std::tuple<int>(500), 400)
293         )
294     ));
295     BOOST_TEST((
296         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
297             boost::fusion::push_back(
298                 std::tuple<int, int>(500, 400), 100
299             )
300           , std::tuple<convertible, int>(500, 400)
301         )
302     ));
303 #endif
304 
305     BOOST_TEST((
306         run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
307             std::pair<int, int>(500, 400)
308         )
309     ));
310     BOOST_TEST((
311         run< Scenario< FUSION_SEQUENCE<> > >(
312             std::pair<int, int>(500, 400)
313           , boost::fusion::vector<>()
314         )
315     ));
316     BOOST_TEST((
317         run< Scenario< FUSION_SEQUENCE<convertible> > >(
318             std::pair<int, int>(500, 400)
319           , boost::fusion::vector<convertible>(500)
320         )
321     ));
322 }
323