mirror of
https://github.com/boostorg/beast.git
synced 2025-08-03 23:04:35 +02:00
dynamic_buffer_ref tests and tidy
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
Version 212:
|
||||
|
||||
* dynamic_buffer_ref tests and tidy
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 211:
|
||||
|
||||
* close_socket is in stream_traits.hpp
|
||||
|
@@ -44,6 +44,9 @@ public:
|
||||
dynamic_buffer_ref_wrapper(
|
||||
dynamic_buffer_ref_wrapper&&) = default;
|
||||
|
||||
dynamic_buffer_ref_wrapper(
|
||||
dynamic_buffer_ref_wrapper const&) = default;
|
||||
|
||||
explicit
|
||||
dynamic_buffer_ref_wrapper(
|
||||
DynamicBuffer& b) noexcept
|
||||
|
@@ -16,7 +16,7 @@ add_executable (tests-beast-core
|
||||
${EXTRAS_FILES}
|
||||
${TEST_MAIN}
|
||||
Jamfile
|
||||
buffer_test.hpp
|
||||
test_buffer.hpp
|
||||
file_test.hpp
|
||||
stream_tests.hpp
|
||||
test_handler.hpp
|
||||
|
@@ -10,7 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/buffers_adaptor.hpp>
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/buffers_cat.hpp>
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_to_string.hpp>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/buffers_range.hpp>
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/buffers_suffix.hpp>
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_cat.hpp>
|
||||
|
@@ -39,9 +39,31 @@ public:
|
||||
&read_line<test::stream>));
|
||||
}
|
||||
|
||||
void
|
||||
testBuffer()
|
||||
{
|
||||
flat_buffer b;
|
||||
b.max_size(1000);
|
||||
auto db = dynamic_buffer_ref(b);
|
||||
BEAST_EXPECT(db.max_size() == 1000);
|
||||
BEAST_EXPECT(db.size() == 0);
|
||||
BEAST_EXPECT(db.capacity() == 0);
|
||||
db.prepare(512);
|
||||
BEAST_EXPECT(db.size() == 0);
|
||||
BEAST_EXPECT(db.capacity() == 512);
|
||||
db.commit(12);
|
||||
BEAST_EXPECT(db.size() == 12);
|
||||
BEAST_EXPECT(db.capacity() == 512);
|
||||
BEAST_EXPECT(buffer_size(db.data()) == 12);
|
||||
db.consume(12);
|
||||
BEAST_EXPECT(db.size() == 0);
|
||||
BEAST_EXPECT(db.capacity() == 512);
|
||||
}
|
||||
|
||||
void run() override
|
||||
{
|
||||
testJavadocs();
|
||||
testBuffer();
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/flat_buffer.hpp>
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
#include <boost/beast/core/read_size.hpp>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/flat_static_buffer.hpp>
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
@@ -10,7 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/static_buffer.hpp>
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
|
@@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_BUFFER_TEST_HPP
|
||||
#define BOOST_BEAST_BUFFER_TEST_HPP
|
||||
#ifndef BOOST_BEAST_TEST_BUFFER_HPP
|
||||
#define BOOST_BEAST_TEST_BUFFER_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
Reference in New Issue
Block a user