AK: Remove bogus test case for CircularDuplexStream.

This commit is contained in:
asynts 2020-12-19 21:19:59 +01:00 committed by Andreas Kling
parent 71587ea241
commit 72cbca892a
2 changed files with 5 additions and 32 deletions

View file

@ -54,7 +54,8 @@ public:
return false;
}
write(bytes);
const auto nwritten = write(bytes);
ASSERT(nwritten == bytes.size());
return true;
}

View file

@ -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)