diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-01-13 13:59:24 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-20 20:48:40 +0000 |
commit | d7eead4f4c8a9b22911343e218645ead75d0fb46 (patch) | |
tree | 177cfbcb9234fad8113dfbdc5b818c763735ecad /Tests/AK/TestMemoryStream.cpp | |
parent | 5896f8cf2b230bbe094be7c4fe15606d2abd16dc (diff) | |
download | serenity-d7eead4f4c8a9b22911343e218645ead75d0fb46.zip |
AK: Remove `DuplexMemoryStream`
Diffstat (limited to 'Tests/AK/TestMemoryStream.cpp')
-rw-r--r-- | Tests/AK/TestMemoryStream.cpp | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/Tests/AK/TestMemoryStream.cpp b/Tests/AK/TestMemoryStream.cpp index 3c774c70b3..f46db2b2d5 100644 --- a/Tests/AK/TestMemoryStream.cpp +++ b/Tests/AK/TestMemoryStream.cpp @@ -100,44 +100,6 @@ TEST_CASE(seeking_slicing_offset) EXPECT_EQ(expected2, actual2); } -TEST_CASE(duplex_simple) -{ - DuplexMemoryStream stream; - - EXPECT(stream.eof()); - stream << 42; - EXPECT(!stream.eof()); - - int value; - stream >> value; - EXPECT_EQ(value, 42); - EXPECT(stream.eof()); -} - -TEST_CASE(duplex_large_buffer) -{ - DuplexMemoryStream stream; - - Array<u8, 1024> one_kibibyte; - - EXPECT_EQ(stream.size(), 0ul); - - for (size_t idx = 0; idx < 256; ++idx) - stream << one_kibibyte; - - EXPECT_EQ(stream.size(), 256 * 1024ul); - - for (size_t idx = 0; idx < 128; ++idx) - stream >> one_kibibyte; - - EXPECT_EQ(stream.size(), 128 * 1024ul); - - for (size_t idx = 0; idx < 128; ++idx) - stream >> one_kibibyte; - - EXPECT(stream.eof()); -} - TEST_CASE(read_endian_values) { Array<u8, 8> const input { 0, 1, 2, 3, 4, 5, 6, 7 }; @@ -151,17 +113,6 @@ TEST_CASE(read_endian_values) EXPECT_EQ(value2, 0x04050607u); } -TEST_CASE(write_endian_values) -{ - Array<u8, 8> const expected { 4, 3, 2, 1, 1, 2, 3, 4 }; - - DuplexMemoryStream stream; - stream << LittleEndian<u32> { 0x01020304 } << BigEndian<u32> { 0x01020304 }; - - EXPECT_EQ(stream.size(), 8u); - EXPECT(expected.span() == stream.copy_into_contiguous_buffer().span()); -} - TEST_CASE(new_output_memory_stream) { Array<u8, 16> buffer; @@ -184,39 +135,3 @@ TEST_CASE(new_output_memory_stream) EXPECT_EQ(stream.bytes().data(), buffer.data()); EXPECT_EQ(stream.bytes().size(), 2u); } - -TEST_CASE(offset_of_out_of_bounds) -{ - Array<u8, 4> target { 0xff, 0xff, 0xff, 0xff }; - - Array<u8, DuplexMemoryStream::chunk_size> whole_chunk; - whole_chunk.span().fill(0); - - DuplexMemoryStream stream; - - stream << whole_chunk; - - EXPECT(!stream.offset_of(target).has_value()); -} - -TEST_CASE(unsigned_integer_underflow_regression) -{ - Array<u8, DuplexMemoryStream::chunk_size + 1> buffer; - - DuplexMemoryStream stream; - stream << buffer; -} - -TEST_CASE(offset_calculation_error_regression) -{ - Array<u8, DuplexMemoryStream::chunk_size> input, output; - input.span().fill(0xff); - - DuplexMemoryStream stream; - stream << 0x00000000 << input << 0x00000000; - - stream.discard_or_error(sizeof(int)); - stream.read(output); - - EXPECT_EQ(input, output); -} |