]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/beast/test/beast/core/span.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / beast / test / beast / core / span.cpp
CommitLineData
b32b8144 1//
92f5a8d4 2// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
b32b8144
FG
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/span.hpp>
12
13#include <boost/beast/core/string.hpp>
92f5a8d4
TL
14#include <boost/beast/_experimental/unit_test/suite.hpp>
15
16#include <vector>
b32b8144
FG
17
18namespace boost {
19namespace beast {
20
21class span_test : public beast::unit_test::suite
22{
23public:
24 BOOST_STATIC_ASSERT(
25 detail::is_contiguous_container<
26 string_view, char const>::value);
27
28 struct base {};
29 struct derived : base {};
30
31 BOOST_STATIC_ASSERT(detail::is_contiguous_container<
32 std::vector<char>, char>::value);
33
34 BOOST_STATIC_ASSERT(detail::is_contiguous_container<
35 std::vector<char>, char const>::value);
36
37 BOOST_STATIC_ASSERT(! detail::is_contiguous_container<
38 std::vector<derived>, base>::value);
39
40 BOOST_STATIC_ASSERT(! detail::is_contiguous_container<
41 std::vector<derived>, base const>::value);
42
43 void
44 testSpan()
45 {
46 span<char const> sp{"hello", 5};
47 BEAST_EXPECT(sp.size() == 5);
48 std::string s("world");
49 sp = s;
50 }
51
52 void
53 run() override
54 {
55 testSpan();
56 }
57};
58
59BEAST_DEFINE_TESTSUITE(beast,core,span);
60
61} // beast
62} // boost