summaryrefslogtreecommitdiff
path: root/Tests/AK
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-01-30 11:03:45 +0100
committerLinus Groh <mail@linusgroh.de>2023-02-08 17:44:32 +0000
commitfa09152e233495944f0bbafdc6be88e2f9995782 (patch)
treec11d6d727d3ff611b720407da49defd79e3d5ae0 /Tests/AK
parent839bec14af2d50e653142556d3e0652a397cbc09 (diff)
downloadserenity-fa09152e233495944f0bbafdc6be88e2f9995782.zip
AK: Remove the fallible constructor from `BigEndianInputBitStream`
Diffstat (limited to 'Tests/AK')
-rw-r--r--Tests/AK/TestBitStream.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Tests/AK/TestBitStream.cpp b/Tests/AK/TestBitStream.cpp
index b04b11d39e..92f1a6bf53 100644
--- a/Tests/AK/TestBitStream.cpp
+++ b/Tests/AK/TestBitStream.cpp
@@ -72,23 +72,23 @@ TEST_CASE(big_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(BigEndianOutputBitStream::construct(MaybeOwned<AK::Stream>(*memory_stream)));
- auto bit_read_stream = MUST(BigEndianInputBitStream::construct(MaybeOwned<AK::Stream>(*memory_stream)));
+ BigEndianInputBitStream 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);
}
@@ -96,9 +96,9 @@ TEST_CASE(big_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);
}
@@ -106,16 +106,16 @@ TEST_CASE(big_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);
}
}