mirror of
https://github.com/monero-project/monero.git
synced 2025-08-06 15:14:21 -04:00
Allow byte_stream->byte_slice conversion to shrink unused buffer space
This commit is contained in:
parent
83f1d863bd
commit
249eae5f4a
3 changed files with 24 additions and 6 deletions
|
@ -1090,11 +1090,13 @@ TEST(ByteStream, ToByteSlice)
|
|||
|
||||
epee::byte_stream stream;
|
||||
|
||||
stream.reserve(128*1024);
|
||||
stream.write(source);
|
||||
EXPECT_EQ(sizeof(source), stream.size());
|
||||
EXPECT_EQ(128*1024, stream.capacity());
|
||||
EXPECT_TRUE(equal(source, byte_span{stream.data(), stream.size()}));
|
||||
|
||||
const epee::byte_slice slice{std::move(stream)};
|
||||
const epee::byte_slice slice{std::move(stream), true};
|
||||
EXPECT_EQ(0u, stream.size());
|
||||
EXPECT_EQ(0u, stream.available());
|
||||
EXPECT_EQ(0u, stream.capacity());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue