]>
git.proxmox.com Git - ceph.git/blob - ceph/src/Beast/test/http/basic_fields.cpp
2 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
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)
8 // Test that header file is self-contained.
9 #include <beast/http/basic_fields.hpp>
11 #include <beast/unit_test/suite.hpp>
12 #include <boost/lexical_cast.hpp>
17 class basic_fields_test
: public beast::unit_test::suite
20 template<class Allocator
>
21 using bha
= basic_fields
<Allocator
>;
23 using bh
= basic_fields
<std::allocator
<char>>;
25 template<class Allocator
>
28 fill(std::size_t n
, basic_fields
<Allocator
>& h
)
30 for(std::size_t i
= 1; i
<= n
; ++i
)
31 h
.insert(boost::lexical_cast
<std::string
>(i
), i
);
34 template<class U
, class V
>
37 self_assign(U
& u
, V
&& v
)
39 u
= std::forward
<V
>(v
);
45 BEAST_EXPECT(h1
.empty());
47 BEAST_EXPECT(h1
.size() == 1);
50 BEAST_EXPECT(h2
.size() == 1);
52 BEAST_EXPECT(std::distance(h2
.begin(), h2
.end()) == 2);
54 BEAST_EXPECT(h1
.size() == 2);
55 BEAST_EXPECT(h2
.size() == 0);
57 BEAST_EXPECT(h3
.size() == 2);
58 BEAST_EXPECT(h1
.size() == 0);
59 self_assign(h3
, std::move(h3
));
60 BEAST_EXPECT(h3
.size() == 2);
61 BEAST_EXPECT(h2
.erase("Not-Present") == 0);
71 BEAST_EXPECT(h
.count("a") == 2);
81 BEAST_EXPECT(h
.size() == 4);
83 BEAST_EXPECT(h
.size() == 2);
93 BEAST_DEFINE_TESTSUITE(basic_fields
,http
,beast
);