diff options
Diffstat (limited to 'Tests/AK/TestByteBuffer.cpp')
-rw-r--r-- | Tests/AK/TestByteBuffer.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Tests/AK/TestByteBuffer.cpp b/Tests/AK/TestByteBuffer.cpp index 29ed85d32f..7122b3264a 100644 --- a/Tests/AK/TestByteBuffer.cpp +++ b/Tests/AK/TestByteBuffer.cpp @@ -7,6 +7,7 @@ #include <LibTest/TestCase.h> #include <AK/ByteBuffer.h> +#include <AK/Vector.h> TEST_CASE(equality_operator) { @@ -33,6 +34,18 @@ TEST_CASE(equality_operator) EXPECT_EQ(d == d, true); } +TEST_CASE(byte_buffer_vector_contains_slow_bytes) +{ + Vector<ByteBuffer> vector; + ByteBuffer a = ByteBuffer::copy("Hello, friend", 13).release_value(); + vector.append(a); + + ReadonlyBytes b = "Hello, friend"sv.bytes(); + Bytes c = a.bytes(); + EXPECT_EQ(vector.contains_slow(b), true); + EXPECT_EQ(vector.contains_slow(c), true); +} + BENCHMARK_CASE(append) { ByteBuffer bb; |