Files
boost_beast/test/beast/core/detail_tuple.cpp
T

54 lines
1.3 KiB
C++
Raw Normal View History

2018-11-21 01:38:09 +01:00
//
// Copyright (c) 2018 Damian Jarek (damian dot jarek93 at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/boostorg/beast
//
// Test that header file is self-contained.
2018-12-09 09:19:01 -08:00
#include <boost/beast/core/detail/tuple.hpp>
2018-11-21 01:38:09 +01:00
#include <boost/beast/_experimental/unit_test/suite.hpp>
namespace boost {
namespace beast {
namespace detail {
2018-12-09 09:19:01 -08:00
class tuple_test : public beast::unit_test::suite
2018-11-21 01:38:09 +01:00
{
public:
void
run()
{
struct explicit_constructible
{
explicit_constructible(std::nullptr_t)
: i_(0)
{
}
explicit explicit_constructible(int i)
: i_(i)
{
}
int i_;
};
2018-12-09 09:19:01 -08:00
tuple<explicit_constructible, int> t{nullptr, 42};
2018-11-21 01:38:09 +01:00
BEAST_EXPECT(detail::get<1>(t) == 42);
BEAST_EXPECT(detail::get<0>(t).i_ == 0);
2018-12-09 09:19:01 -08:00
t = tuple<explicit_constructible, int>{explicit_constructible(42), 43};
2018-11-21 01:38:09 +01:00
BEAST_EXPECT(detail::get<1>(t) == 43);
BEAST_EXPECT(detail::get<0>(t).i_ == 42);
}
};
2018-12-09 09:19:01 -08:00
BEAST_DEFINE_TESTSUITE(beast,core,tuple);
2018-11-21 01:38:09 +01:00
} // detail
} // beast
} // boost