mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 14:24:31 +02:00
buffers_front tests
This commit is contained in:
@@ -3,6 +3,7 @@ Version 212:
|
||||
* dynamic_buffer_ref tests and tidy
|
||||
* flat_stream tests and tidy
|
||||
* stranded_socket tests and tidy
|
||||
* buffers_front tests
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@@ -124,6 +124,36 @@ public:
|
||||
BEAST_EXPECT(net::buffer_copy(pb0, pb1) == 0);
|
||||
}
|
||||
|
||||
void
|
||||
testBuffersFront()
|
||||
{
|
||||
{
|
||||
std::array<net::const_buffer, 2> v;
|
||||
v[0] = {"", 0};
|
||||
v[1] = net::const_buffer("Hello, world!", 13);
|
||||
BEAST_EXPECT(buffers_front(v).size() == 0);
|
||||
std::swap(v[0], v[1]);
|
||||
BEAST_EXPECT(buffers_front(v).size() == 13);
|
||||
}
|
||||
{
|
||||
struct null_sequence
|
||||
{
|
||||
net::const_buffer b;
|
||||
using iterator = net::const_buffer const*;
|
||||
iterator begin() const noexcept
|
||||
{
|
||||
return &b;
|
||||
}
|
||||
iterator end() const noexcept
|
||||
{
|
||||
return begin();
|
||||
}
|
||||
};
|
||||
null_sequence z;
|
||||
BEAST_EXPECT(buffers_front(z).size() == 0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
@@ -132,6 +162,7 @@ public:
|
||||
testPrefixes<net::const_buffer>();
|
||||
testPrefixes<net::mutable_buffer>();
|
||||
testEmpty();
|
||||
testBuffersFront();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user