diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-01-30 11:04:23 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-08 17:44:32 +0000 |
commit | 261d62438f7aa3aca95613560ddb4d5bcf86756f (patch) | |
tree | 1fc4c3483f378f75dabf67e6f148ec6ad6d28531 /Tests/AK | |
parent | fa09152e233495944f0bbafdc6be88e2f9995782 (diff) | |
download | serenity-261d62438f7aa3aca95613560ddb4d5bcf86756f.zip |
AK: Remove the fallible constructor from `LittleEndianInputBitStream`
Diffstat (limited to 'Tests/AK')
-rw-r--r-- | Tests/AK/TestBitStream.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Tests/AK/TestBitStream.cpp b/Tests/AK/TestBitStream.cpp index 92f1a6bf53..1e48050bc7 100644 --- a/Tests/AK/TestBitStream.cpp +++ b/Tests/AK/TestBitStream.cpp @@ -16,23 +16,23 @@ TEST_CASE(little_endian_bit_stream_input_output_match) // Note: The bit stream only ever reads from/writes to the underlying stream in one byte chunks, // so testing with sizes that will not trigger a write will yield unexpected results. auto bit_write_stream = MUST(LittleEndianOutputBitStream::construct(MaybeOwned<AK::Stream>(*memory_stream))); - auto bit_read_stream = MUST(LittleEndianInputBitStream::construct(MaybeOwned<AK::Stream>(*memory_stream))); + LittleEndianInputBitStream bit_read_stream { MaybeOwned<AK::Stream>(*memory_stream) }; // Test two mirrored chunks of a fully mirrored pattern to check that we are not dropping bits. { MUST(bit_write_stream->write_bits(0b1111u, 4)); MUST(bit_write_stream->write_bits(0b1111u, 4)); - auto result = MUST(bit_read_stream->read_bits(4)); + auto result = MUST(bit_read_stream.read_bits(4)); EXPECT_EQ(0b1111u, result); - result = MUST(bit_read_stream->read_bits(4)); + result = MUST(bit_read_stream.read_bits(4)); EXPECT_EQ(0b1111u, result); } { MUST(bit_write_stream->write_bits(0b0000u, 4)); MUST(bit_write_stream->write_bits(0b0000u, 4)); - auto result = MUST(bit_read_stream->read_bits(4)); + auto result = MUST(bit_read_stream.read_bits(4)); EXPECT_EQ(0b0000u, result); - result = MUST(bit_read_stream->read_bits(4)); + result = MUST(bit_read_stream.read_bits(4)); EXPECT_EQ(0b0000u, result); } @@ -40,9 +40,9 @@ TEST_CASE(little_endian_bit_stream_input_output_match) { MUST(bit_write_stream->write_bits(0b1000u, 4)); MUST(bit_write_stream->write_bits(0b1000u, 4)); - auto result = MUST(bit_read_stream->read_bits(4)); + auto result = MUST(bit_read_stream.read_bits(4)); EXPECT_EQ(0b1000u, result); - result = MUST(bit_read_stream->read_bits(4)); + result = MUST(bit_read_stream.read_bits(4)); EXPECT_EQ(0b1000u, result); } @@ -50,16 +50,16 @@ TEST_CASE(little_endian_bit_stream_input_output_match) { MUST(bit_write_stream->write_bits(0b1000u, 4)); MUST(bit_write_stream->write_bits(0b0100u, 4)); - auto result = MUST(bit_read_stream->read_bits(4)); + auto result = MUST(bit_read_stream.read_bits(4)); EXPECT_EQ(0b1000u, result); - result = MUST(bit_read_stream->read_bits(4)); + result = MUST(bit_read_stream.read_bits(4)); EXPECT_EQ(0b0100u, result); } // Test a pattern that spans multiple bytes. { MUST(bit_write_stream->write_bits(0b1101001000100001u, 16)); - auto result = MUST(bit_read_stream->read_bits(16)); + auto result = MUST(bit_read_stream.read_bits(16)); EXPECT_EQ(0b1101001000100001u, result); } } |