1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

AK: Add OutputMemoryStream class.

This commit is contained in:
asynts 2020-09-01 16:16:32 +02:00 committed by Andreas Kling
parent 3a2658951b
commit 7efd2a6d59
3 changed files with 29 additions and 0 deletions

View file

@ -160,4 +160,15 @@ TEST_CASE(read_endian_values)
EXPECT_EQ(value2, 0x04050607u);
}
TEST_CASE(write_endian_values)
{
const u8 expected[] { 4, 3, 2, 1, 1, 2, 3, 4 };
OutputMemoryStream stream;
stream << LittleEndian<u32> { 0x01020304 } << BigEndian<u32> { 0x01020304 };
EXPECT_EQ(stream.size(), 8u);
EXPECT(compare({ expected, sizeof(expected) }, stream.copy_into_contiguous_buffer()));
}
TEST_MAIN(MemoryStream)