diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-04-01 10:54:53 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-01 13:57:54 +0200 |
commit | b451964bbccae8e4f19e6063527b24704b58c62f (patch) | |
tree | d150b7841f7f6a33b3a58be1530049292bb68ca3 | |
parent | bc70d7bb77d85632576c080b353359f795d25625 (diff) | |
download | serenity-b451964bbccae8e4f19e6063527b24704b58c62f.zip |
Tests: Document input of the xz_utils_good_1_block_header_1 test case
-rw-r--r-- | Tests/LibCompress/TestXz.cpp | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/Tests/LibCompress/TestXz.cpp b/Tests/LibCompress/TestXz.cpp index b5f092a1fa..e4bd84d24f 100644 --- a/Tests/LibCompress/TestXz.cpp +++ b/Tests/LibCompress/TestXz.cpp @@ -1283,11 +1283,51 @@ TEST_CASE(xz_utils_good_1_block_header_1) // Size in the Block Header. This has also four extra bytes of Header // Padding." Array<u8, 72> const compressed { - 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x01, 0x69, 0x22, 0xDE, 0x36, 0x03, 0xC0, 0x11, 0x0D, - 0x21, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xDE, 0x39, 0xEB, 0x01, 0x00, 0x0C, 0x48, - 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x0A, 0x00, 0x00, 0x00, 0x00, - 0x43, 0xA3, 0xA2, 0x15, 0x00, 0x01, 0x25, 0x0D, 0x71, 0x19, 0xC4, 0xB6, 0x90, 0x42, 0x99, 0x0D, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x59, 0x5A + // Stream Header + 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, // Magic + 0x00, 0x01, // Stream Flags + 0x69, 0x22, 0xDE, 0x36, // CRC32 + + // Block Header + 0x03, // Block Header Size + 0xC0, // Block Flags (one filter, compressed size and uncompressed size present) + 0x11, // Compressed Size + 0x0D, // Uncompressed Size + // Filter 0 Flags + 0x21, // Filter ID + 0x01, // Size of Properties + 0x08, // Filter Properties + 0x00, 0x00, 0x00, 0x00, 0x00, // Header Padding + 0x7F, 0xDE, 0x39, 0xEB, // CRC32 + + // Compressed Data (LZMA2) + // Uncompressed chunk with dictionary reset + 0x01, // Control Byte + 0x00, 0x0C, // 16-bit data size minus one (big-endian) + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x0A, + // End of LZMA2 stream + 0x00, + + // Block Padding + 0x00, 0x00, 0x00, + + // Uncompressed Data Check (CRC32) + 0x43, 0xA3, 0xA2, 0x15, + + // Index + 0x00, // Index Indicator + 0x01, // Number of Records (multibyte integer) + // Record 0 + 0x25, // Unpadded Size (multibyte integer) + 0x0D, // Uncompressed Size (multibyte integer) + // CRC32 + 0x71, 0x19, 0xC4, 0xB6, + + // Stream Footer + 0x90, 0x42, 0x99, 0x0D, // CRC32 + 0x01, 0x00, 0x00, 0x00, // Backward Size + 0x00, 0x01, // Stream Flags + 0x59, 0x5A, // Footer Magic Bytes }; auto stream = MUST(try_make<FixedMemoryStream>(compressed)); |