forked from boostorg/beast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspan.cpp
More file actions
62 lines (48 loc) · 1.44 KB
/
Copy pathspan.cpp
File metadata and controls
62 lines (48 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco 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.
#include <boost/beast/core/span.hpp>
#include <boost/beast/core/string.hpp>
#include <boost/beast/_experimental/unit_test/suite.hpp>
#include <vector>
namespace boost {
namespace beast {
class span_test : public beast::unit_test::suite
{
public:
BOOST_STATIC_ASSERT(
detail::is_contiguous_container<
string_view, char const>::value);
struct base {};
struct derived : base {};
BOOST_STATIC_ASSERT(detail::is_contiguous_container<
std::vector<char>, char>::value);
BOOST_STATIC_ASSERT(detail::is_contiguous_container<
std::vector<char>, char const>::value);
BOOST_STATIC_ASSERT(! detail::is_contiguous_container<
std::vector<derived>, base>::value);
BOOST_STATIC_ASSERT(! detail::is_contiguous_container<
std::vector<derived>, base const>::value);
void
testSpan()
{
span<char const> sp{"hello", 5};
BEAST_EXPECT(sp.size() == 5);
std::string s("world");
sp = s;
}
void
run() override
{
testSpan();
}
};
BEAST_DEFINE_TESTSUITE(beast,core,span);
} // beast
} // boost