]>
Commit | Line | Data |
---|---|---|
92f5a8d4 | 1 | // |
20effc67 | 2 | // Copyright (c) 2016-2019 Damian Jarek (damian dot jarek93 at gmail dot com) |
92f5a8d4 TL |
3 | // |
4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | // | |
7 | // Official repository: https://github.com/boostorg/beast | |
8 | // | |
9 | ||
10 | // Test that header file is self-contained. | |
11 | #include <boost/beast/core/detail/tuple.hpp> | |
12 | ||
13 | #include <boost/beast/_experimental/unit_test/suite.hpp> | |
14 | ||
15 | namespace boost { | |
16 | namespace beast { | |
17 | namespace detail { | |
18 | ||
19 | class tuple_test : public beast::unit_test::suite | |
20 | { | |
21 | public: | |
22 | void | |
23 | run() | |
24 | { | |
25 | struct explicit_constructible | |
26 | { | |
27 | explicit_constructible(std::nullptr_t) | |
28 | : i_(0) | |
29 | { | |
30 | } | |
31 | ||
32 | explicit explicit_constructible(int i) | |
33 | : i_(i) | |
34 | { | |
35 | } | |
36 | ||
37 | int i_; | |
38 | }; | |
39 | ||
40 | tuple<explicit_constructible, int> t{nullptr, 42}; | |
41 | BEAST_EXPECT(detail::get<1>(t) == 42); | |
42 | BEAST_EXPECT(detail::get<0>(t).i_ == 0); | |
43 | ||
44 | t = tuple<explicit_constructible, int>{explicit_constructible(42), 43}; | |
45 | BEAST_EXPECT(detail::get<1>(t) == 43); | |
46 | BEAST_EXPECT(detail::get<0>(t).i_ == 42); | |
47 | } | |
48 | }; | |
49 | ||
50 | BEAST_DEFINE_TESTSUITE(beast,core,tuple); | |
51 | ||
52 | } // detail | |
53 | } // beast | |
54 | } // boost |