mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
AK: Remove bogus test case for CircularDuplexStream.
This commit is contained in:
parent
71587ea241
commit
72cbca892a
2 changed files with 5 additions and 32 deletions
|
@ -54,7 +54,8 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
write(bytes);
|
||||
const auto nwritten = write(bytes);
|
||||
ASSERT(nwritten == bytes.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,12 +60,11 @@ TEST_CASE(overwritting_is_well_defined)
|
|||
for (size_t idx = 0; idx < capacity; ++idx)
|
||||
stream << static_cast<u8>(idx % 256);
|
||||
|
||||
u8 bytes[half_capacity];
|
||||
|
||||
stream >> Bytes { bytes, sizeof(bytes) };
|
||||
Array<u8, half_capacity> buffer;
|
||||
stream >> buffer;
|
||||
|
||||
for (size_t idx = 0; idx < half_capacity; ++idx)
|
||||
EXPECT_EQ(bytes[idx], idx % 256);
|
||||
EXPECT_EQ(buffer[idx], idx % 256);
|
||||
|
||||
for (size_t idx = 0; idx < half_capacity; ++idx)
|
||||
stream << static_cast<u8>(idx % 256);
|
||||
|
@ -83,31 +82,4 @@ TEST_CASE(overwritting_is_well_defined)
|
|||
EXPECT(stream.eof());
|
||||
}
|
||||
|
||||
TEST_CASE(of_by_one)
|
||||
{
|
||||
constexpr size_t half_capacity = 32;
|
||||
constexpr size_t capacity = half_capacity * 2;
|
||||
|
||||
CircularDuplexStream<capacity> stream;
|
||||
|
||||
for (size_t idx = 0; idx < half_capacity; ++idx)
|
||||
stream << static_cast<u8>(0);
|
||||
|
||||
for (size_t idx = 0; idx < half_capacity; ++idx)
|
||||
stream << static_cast<u8>(1);
|
||||
|
||||
stream.discard_or_error(capacity);
|
||||
|
||||
for (size_t idx = 0; idx < capacity; ++idx) {
|
||||
u8 byte;
|
||||
stream.read({ &byte, sizeof(byte) }, capacity);
|
||||
stream << byte;
|
||||
|
||||
if (idx < half_capacity)
|
||||
EXPECT_EQ(byte, 0);
|
||||
else
|
||||
EXPECT_EQ(byte, 1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_MAIN(CircularDuplexStream)
|
||||
|
|
Loading…
Reference in a new issue