buffers_front tests

This commit is contained in:
Vinnie Falco committed 2019-02-09 06:58:59 -08:00
1 parent b8aa6be7fd
commit 44ed20aa2c
2 files changed
+32

No files matched your search

+31
View File
@@ -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();
}
};