ZXC Decoder Conformance Suite

July 27, 2026 ยท View on GitHub

Reference test vectors for validating any ZXC decoder implementation.

Contents

valid/
  *.zxc         Compressed files (frozen wire format)
  *.expected    Expected decompressed output (plaintext reference)
invalid/
  *.zxc         Malformed files that must be rejected

Validating a decoder

For each valid/*.zxc:

  1. Decompress the file with your decoder
  2. Compare the output byte-for-byte against the matching .expected file
  3. Any mismatch is a decoder bug

For each invalid/*.zxc:

  1. Attempt to decompress the file with your decoder
  2. The decoder must reject it (return an error, not produce output)
  3. Accepting a malformed file is a decoder bug

Quick check (shell)

pass=0; fail=0
for f in valid/*.zxc; do
    expected="${f%.zxc}.expected"
    your-decoder "$f" /tmp/out
    if cmp -s /tmp/out "$expected"; then
        pass=$((pass + 1))
    else
        echo "FAIL: $f"; fail=$((fail + 1))
    fi
done
for f in invalid/*.zxc; do
    if your-decoder "$f" /dev/null 2>/dev/null; then
        echo "FAIL (should reject): $f"; fail=$((fail + 1))
    else
        pass=$((pass + 1))
    fi
done
echo "Passed: $pass  Failed: $fail"

Vector coverage

CategoryCountDescription
Basic5Empty, 1 byte, all 256 values, all-zeros
Text3Compressible text with and without checksum
Random3Incompressible data (stored as raw blocks)
Match patterns3Long matches, short matches, max offset distance
Compression levels6Same input compressed at levels 1 through 6
Level 71Level-7 literals with 9-11-bit Huffman codes
PivCo (L7)1Level-7 PivCo sections (v7 enc 2, level-ordered bits)
Block size variants24 KB and 2 MB block sizes
Checksum3Per-block and global checksum enabled
Multi-block216 blocks per file (4 KB block size)
Seekable3Seekable archives with seek table
Invalid19Bad magic, bad version, bad CRC, truncated, corrupt payload, garbage, out-of-bounds section layouts

License

BSD-3-Clause. Same as the ZXC library.