test: Adds conformance test suite and improves empty frame handling#246
Draft
hellobertrand wants to merge 5 commits into
Draft
test: Adds conformance test suite and improves empty frame handling#246hellobertrand wants to merge 5 commits into
hellobertrand wants to merge 5 commits into
Conversation
The `zxc_compress` function now gracefully handles `src_size == 0` inputs, including when `src` is `NULL`, by producing a valid empty compressed frame. Previously, this scenario resulted in `ZXC_ERROR_NULL_INPUT`. Correspondingly, `zxc_decompress` is updated to allow `dst=NULL` and `dst_capacity=0` when processing an empty frame, returning success (0) in such cases. This enables callers to query the decompressed size of an empty frame without providing a destination buffer, aligning behavior with common buffer API patterns.
This suite comprises a collection of valid ZXC streams and deliberately malformed inputs, along with a C test driver. It automatically verifies that the decompressor correctly decodes valid streams and robustly rejects invalid ones, enhancing spec adherence and preventing regressions.
The conformance test suite is updated to run on Windows. This involves: - Conditional compilation using `_WIN32` for platform-specific headers and APIs (e.g., `windows.h`, `GetFileAttributesA`, `FindFirstFileA`). - Introducing portable `file_exists` and `list_zxc_files` helper functions to abstract file system interactions. - Updating string duplication to use `_strdup` on Windows. - Increasing path buffer sizes for improved robustness against long file paths. Additionally, `test_invalid_vector` now caps the maximum requested decompressed size to 1MB for invalid inputs, preventing excessive memory allocation during testing.
Introduces a CMake option to link the conformance test executable with the `--coverage` flag, allowing for code coverage analysis. Also incorporates minor code cleanups in the conformance test source file.
This README provides essential documentation for the ZXC Decoder Conformance Suite. It details the suite's file structure, explains how to validate a decoder, offers a quick shell script for execution, and outlines the various test vector categories and their coverage. This significantly improves the usability and understanding of the conformance tests for developers and users.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
.zxcfiles inconformance/validandconformance/invaliddirectories, comparing decompressed output for valid files against.expectedfiles and ensuring invalid files are correctly rejected.zxc_compressandzxc_decompresshandle empty frames. Compressing an empty source buffer now produces a valid, minimal ZXC frame.