]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/http/verb.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / beast / test / beast / http / verb.cpp
1 //
2 // Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
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/http/verb.hpp>
12
13 #include <boost/beast/unit_test/suite.hpp>
14
15 namespace boost {
16 namespace beast {
17 namespace http {
18
19 class verb_test
20 : public beast::unit_test::suite
21 {
22 public:
23 void
24 testVerb()
25 {
26 auto const good =
27 [&](verb v)
28 {
29 BEAST_EXPECT(string_to_verb(to_string(v)) == v);
30 };
31
32 good(verb::unknown);
33
34 good(verb::delete_);
35 good(verb::get);
36 good(verb::head);
37 good(verb::post);
38 good(verb::put);
39 good(verb::connect);
40 good(verb::options);
41 good(verb::trace);
42 good(verb::copy);
43 good(verb::lock);
44 good(verb::mkcol);
45 good(verb::move);
46 good(verb::propfind);
47 good(verb::proppatch);
48 good(verb::search);
49 good(verb::unlock);
50 good(verb::bind);
51 good(verb::rebind);
52 good(verb::unbind);
53 good(verb::acl);
54 good(verb::report);
55 good(verb::mkactivity);
56 good(verb::checkout);
57 good(verb::merge);
58 good(verb::msearch);
59 good(verb::notify);
60 good(verb::subscribe);
61 good(verb::unsubscribe);
62 good(verb::patch);
63 good(verb::purge);
64 good(verb::mkcalendar);
65 good(verb::link);
66 good(verb::unlink);
67
68 auto const bad =
69 [&](string_view s)
70 {
71 auto const v = string_to_verb(s);
72 BEAST_EXPECTS(v == verb::unknown, to_string(v));
73 };
74
75 bad("AC_");
76 bad("BIN_");
77 bad("CHECKOU_");
78 bad("CONNEC_");
79 bad("COP_");
80 bad("DELET_");
81 bad("GE_");
82 bad("HEA_");
83 bad("LIN_");
84 bad("LOC_");
85 bad("M-SEARC_");
86 bad("MERG_");
87 bad("MKACTIVIT_");
88 bad("MKCALENDA_");
89 bad("MKCO_");
90 bad("MOV_");
91 bad("NOTIF_");
92 bad("OPTION_");
93 bad("PATC_");
94 bad("POS_");
95 bad("PROPFIN_");
96 bad("PROPPATC_");
97 bad("PURG_");
98 bad("PU_");
99 bad("REBIN_");
100 bad("REPOR_");
101 bad("SEARC_");
102 bad("SUBSCRIB_");
103 bad("TRAC_");
104 bad("UNBIN_");
105 bad("UNLIN_");
106 bad("UNLOC_");
107 bad("UNSUBSCRIB_");
108
109 try
110 {
111 to_string(static_cast<verb>(-1));
112 fail("", __FILE__, __LINE__);
113 }
114 catch(std::exception const&)
115 {
116 pass();
117 }
118 }
119
120 void
121 run()
122 {
123 testVerb();
124 }
125 };
126
127 BEAST_DEFINE_TESTSUITE(beast,http,verb);
128
129 } // http
130 } // beast
131 } // boost