summaryrefslogtreecommitdiff
path: root/Userland/test-compress.cpp
AgeCommit message (Collapse)Author
2021-01-12Userland: Move command-line utilities to Userland/Utilities/Andreas Kling
2021-01-02AK: Remove redundant compare() functions.asynts
2020-09-11LibCompress: Add unit tests for CanonicalCode.asynts
2020-09-11LibCompress: Return Optional from decompress_all method.asynts
2020-09-08Refactor: Replace usages of FixedArray with Array.asynts
2020-09-06LibCompress: Add another unit test.asynts
I suspected an error in CircularDuplexStream::read(Bytes, size_t). This does not appear to be the case, this test case is useful regardless. The following script was used to generate the test: import gzip uncompressed = [] for _ in range(0x100): uncompressed.append(1) for _ in range(0x7e00): uncompressed.append(0) for _ in range(0x100): uncompressed.append(1) compressed = gzip.compress(bytes(uncompressed)) compressed = ", ".join(f"0x{byte:02x}" for byte in compressed) print(f"""\ TEST_CASE(gzip_decompress_repeat_around_buffer) {{ const u8 compressed[] = {{ {compressed} }}; u8 uncompressed[0x8011]; Bytes{{ uncompressed, sizeof(uncompressed) }}.fill(0); uncompressed[0x8000] = 1; const auto decompressed = Compress::GzipDecompressor::decompress_all({{ compressed, sizeof(compressed) }}); EXPECT(compare({{ uncompressed, sizeof(uncompressed) }}, decompressed.bytes())); }} """, end="")
2020-08-31LibCompress: Fix a bug when wrapping around the buffer.asynts
2020-08-30LibCompress: Implement gzip.asynts
2020-08-28HackStudio: Mark compilation-unit-only functions as staticBen Wiederhake
2020-08-26LibCompress: Implement DEFLATE properly.asynts
Now we have an actual stream implementation that can read arbitrary (dynamic codes aren't supported yet) deflate encoded data. Even if the blocks are really large. And all of that happens with a single buffer of 32KiB. DEFLATE is amazing!
2020-08-22Userland: Use TestSuite.h in test-compress.asynts
2020-08-20LibCompress: Turn the DEFLATE implementation into a stream.asynts
Previously, the implementation would produce one Vector<u8> which would contain the whole decompressed data. That can be a lot and even exhaust memory. With these changes it is still necessary to store the whole input data in one piece (I am working on this next,) but the output can be read block by block. (That's not optimal either because blocks can be arbitrarily large, but it's good for now.)
2020-08-04LibCompress: Add LibCompressstelar7
For now this only contains DEFLATE, and a very simple Zlib Eventually GZip, etc. can go here as well.