2017-05-30 06:58:40 -07:00
|
|
|
//
|
2019-02-21 07:00:31 -08:00
|
|
|
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
2017-05-30 06:58:40 -07:00
|
|
|
//
|
|
|
|
|
// 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)
|
|
|
|
|
//
|
2017-07-20 13:40:34 -07:00
|
|
|
// Official repository: https://github.com/boostorg/beast
|
|
|
|
|
//
|
2017-05-30 06:58:40 -07:00
|
|
|
|
|
|
|
|
// Test that header file is self-contained.
|
2017-07-20 13:40:34 -07:00
|
|
|
#include <boost/beast/http/verb.hpp>
|
2017-05-30 06:58:40 -07:00
|
|
|
|
2018-11-11 14:07:55 -08:00
|
|
|
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
2017-05-30 06:58:40 -07:00
|
|
|
|
2017-07-20 13:40:34 -07:00
|
|
|
namespace boost {
|
2017-05-30 06:58:40 -07:00
|
|
|
namespace beast {
|
|
|
|
|
namespace http {
|
|
|
|
|
|
|
|
|
|
class verb_test
|
|
|
|
|
: public beast::unit_test::suite
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
void
|
|
|
|
|
testVerb()
|
|
|
|
|
{
|
|
|
|
|
auto const good =
|
|
|
|
|
[&](verb v)
|
|
|
|
|
{
|
2017-07-25 12:35:54 -07:00
|
|
|
BEAST_EXPECT(string_to_verb(to_string(v)) == v);
|
2017-05-30 06:58:40 -07:00
|
|
|
};
|
|
|
|
|
|
2017-06-04 10:03:36 -07:00
|
|
|
good(verb::unknown);
|
|
|
|
|
|
2017-05-30 06:58:40 -07:00
|
|
|
good(verb::delete_);
|
|
|
|
|
good(verb::get);
|
|
|
|
|
good(verb::head);
|
|
|
|
|
good(verb::post);
|
|
|
|
|
good(verb::put);
|
|
|
|
|
good(verb::connect);
|
|
|
|
|
good(verb::options);
|
|
|
|
|
good(verb::trace);
|
|
|
|
|
good(verb::copy);
|
|
|
|
|
good(verb::lock);
|
|
|
|
|
good(verb::mkcol);
|
|
|
|
|
good(verb::move);
|
|
|
|
|
good(verb::propfind);
|
|
|
|
|
good(verb::proppatch);
|
|
|
|
|
good(verb::search);
|
|
|
|
|
good(verb::unlock);
|
|
|
|
|
good(verb::bind);
|
|
|
|
|
good(verb::rebind);
|
|
|
|
|
good(verb::unbind);
|
|
|
|
|
good(verb::acl);
|
|
|
|
|
good(verb::report);
|
|
|
|
|
good(verb::mkactivity);
|
|
|
|
|
good(verb::checkout);
|
|
|
|
|
good(verb::merge);
|
|
|
|
|
good(verb::msearch);
|
|
|
|
|
good(verb::notify);
|
|
|
|
|
good(verb::subscribe);
|
|
|
|
|
good(verb::unsubscribe);
|
|
|
|
|
good(verb::patch);
|
|
|
|
|
good(verb::purge);
|
|
|
|
|
good(verb::mkcalendar);
|
|
|
|
|
good(verb::link);
|
|
|
|
|
good(verb::unlink);
|
|
|
|
|
|
|
|
|
|
auto const bad =
|
|
|
|
|
[&](string_view s)
|
|
|
|
|
{
|
|
|
|
|
auto const v = string_to_verb(s);
|
2017-07-25 12:35:54 -07:00
|
|
|
BEAST_EXPECTS(v == verb::unknown, to_string(v));
|
2017-05-30 06:58:40 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bad("AC_");
|
|
|
|
|
bad("BIN_");
|
|
|
|
|
bad("CHECKOU_");
|
|
|
|
|
bad("CONNEC_");
|
|
|
|
|
bad("COP_");
|
|
|
|
|
bad("DELET_");
|
|
|
|
|
bad("GE_");
|
|
|
|
|
bad("HEA_");
|
|
|
|
|
bad("LIN_");
|
|
|
|
|
bad("LOC_");
|
|
|
|
|
bad("M-SEARC_");
|
|
|
|
|
bad("MERG_");
|
|
|
|
|
bad("MKACTIVIT_");
|
|
|
|
|
bad("MKCALENDA_");
|
|
|
|
|
bad("MKCO_");
|
|
|
|
|
bad("MOV_");
|
|
|
|
|
bad("NOTIF_");
|
|
|
|
|
bad("OPTION_");
|
|
|
|
|
bad("PATC_");
|
|
|
|
|
bad("POS_");
|
|
|
|
|
bad("PROPFIN_");
|
|
|
|
|
bad("PROPPATC_");
|
|
|
|
|
bad("PURG_");
|
|
|
|
|
bad("PU_");
|
|
|
|
|
bad("REBIN_");
|
|
|
|
|
bad("REPOR_");
|
|
|
|
|
bad("SEARC_");
|
|
|
|
|
bad("SUBSCRIB_");
|
|
|
|
|
bad("TRAC_");
|
|
|
|
|
bad("UNBIN_");
|
|
|
|
|
bad("UNLIN_");
|
|
|
|
|
bad("UNLOC_");
|
|
|
|
|
bad("UNSUBSCRIB_");
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
to_string(static_cast<verb>(-1));
|
|
|
|
|
fail("", __FILE__, __LINE__);
|
|
|
|
|
}
|
|
|
|
|
catch(std::exception const&)
|
|
|
|
|
{
|
|
|
|
|
pass();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
run()
|
|
|
|
|
{
|
|
|
|
|
testVerb();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2017-08-01 17:01:57 -07:00
|
|
|
BEAST_DEFINE_TESTSUITE(beast,http,verb);
|
2017-05-30 06:58:40 -07:00
|
|
|
|
|
|
|
|
} // http
|
|
|
|
|
} // beast
|
2017-07-20 13:40:34 -07:00
|
|
|
} // boost
|