From 11550f582ba99d317717ef76fef23118fa226ee1 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 26 Jan 2023 12:12:38 +0100 Subject: [PATCH] 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. --- Tests/LibCore/TestLibCoreStream.cpp | 36 ----------------------------- 1 file changed, 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 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 file_array; - Array 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(); - } -}