Files
boost_beast/test/websocket/error.cpp
Vinnie Falco cb501a07c8 WebSocket optimizations (API Change):
The websocket stream is optimized to contain a small
circular static buffer, reducing the number of I/O calls when
reading data. The size of the buffer is tuned for maximum
performance with TCP/IP and no long needs configuration:

* read_some replaces read_frame
* write_some replaces write_Frame
* async_read_some replaces async_read_frame
* async_write_some replaces async_write_frame

* websocket::stream::read_buffer_size is removed

Actions Required:

* Remove calls websocket::stream::read_buffer_size

* Use read_some and write_some instead of read_frame and write_frame
2017-07-20 08:15:32 -07:00

48 lines
1.5 KiB
C++

//
// Copyright (c) 2013-2017 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)
//
// Test that header file is self-contained.
#include <beast/websocket/error.hpp>
#include <beast/unit_test/suite.hpp>
#include <memory>
namespace beast {
namespace websocket {
class error_test : public unit_test::suite
{
public:
void check(char const* name, error ev)
{
auto const ec = make_error_code(ev);
BEAST_EXPECT(std::string{ec.category().name()} == name);
BEAST_EXPECT(! ec.message().empty());
BEAST_EXPECT(std::addressof(ec.category()) ==
std::addressof(detail::get_error_category()));
BEAST_EXPECT(detail::get_error_category().equivalent(
static_cast<std::underlying_type<error>::type>(ev),
ec.category().default_error_condition(
static_cast<std::underlying_type<error>::type>(ev))));
BEAST_EXPECT(detail::get_error_category().equivalent(
ec, static_cast<std::underlying_type<error>::type>(ev)));
}
void run() override
{
check("beast.websocket", error::closed);
check("beast.websocket", error::failed);
check("beast.websocket", error::handshake_failed);
check("beast.websocket", error::buffer_overflow);
}
};
BEAST_DEFINE_TESTSUITE(error,websocket,beast);
} // websocket
} // beast