diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-01-26 12:12:38 +0100 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2023-01-29 19:16:44 -0700 |
commit | 11550f582ba99d317717ef76fef23118fa226ee1 (patch) | |
tree | f3f4066e63a939bb9fafc0e9c04cdb5ddd54653b /Tests | |
parent | 22f0d04f4300019f9fc938efa2c53814368c3cc1 (diff) | |
download | serenity-11550f582ba99d317717ef76fef23118fa226ee1.zip |
Tests: Remove the 10KB file read test for AllocatingMemoryStream
When we move the test to AK (together with the actual stream
implementation), finding the input file to read from is going to become
significantly harder, since the test also runs outside of SerenityOS.
Since this was just a smoke test during early development (and we should
now have reasonable coverage with actual usages in the other parts of
the OS), let's just remove that test instead of trying to make input
file lookups work.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/LibCore/TestLibCoreStream.cpp | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/Tests/LibCore/TestLibCoreStream.cpp b/Tests/LibCore/TestLibCoreStream.cpp index c7c87aff85..500d3b5a18 100644 --- a/Tests/LibCore/TestLibCoreStream.cpp +++ b/Tests/LibCore/TestLibCoreStream.cpp @@ -680,39 +680,3 @@ TEST_CASE(allocating_memory_stream_offset_of_oob) EXPECT(!offset.has_value()); } } - -TEST_CASE(allocating_memory_stream_10kb) -{ - auto file = MUST(Core::Stream::File::open("/usr/Tests/LibCore/10kb.txt"sv, Core::Stream::OpenMode::Read)); - size_t const file_size = MUST(file->size()); - size_t constexpr test_chunk_size = 4096; - - // Read file contents into the memory stream. - Core::Stream::AllocatingMemoryStream stream; - while (!file->is_eof()) { - Array<u8, test_chunk_size> array; - MUST(stream.write(MUST(file->read(array)))); - } - - EXPECT_EQ(stream.used_buffer_size(), file_size); - - MUST(file->seek(0, SeekMode::SetPosition)); - - // Check the stream contents when reading back. - size_t offset = 0; - while (!file->is_eof()) { - Array<u8, test_chunk_size> file_array; - Array<u8, test_chunk_size> stream_array; - auto file_span = MUST(file->read(file_array)); - auto stream_span = MUST(stream.read(stream_array)); - EXPECT_EQ(file_span.size(), stream_span.size()); - - for (size_t i = 0; i < file_span.size(); i++) { - if (file_array[i] == stream_array[i]) - continue; - - FAIL(String::formatted("Data started to diverge at index {}: file={}, stream={}", offset + i, file_array[i], stream_array[i])); - } - offset += file_span.size(); - } -} |