compat.gzip-hpp
#includegzip-hpp — header-only gzip/deflate compression wrappers over zlib
#include <gzip/compress.hpp>
mcpp add compat.gzip-hpp@0.1.0
用法
来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。
// Behavioral test — compat.gzip-hpp compresses and decompresses through zlib.
//
// Round-trip alone would pass on a library that did nothing, so the test also
// asserts the gzip MAGIC on the compressed bytes and that a compressible
// payload actually shrinks. Both are answers only real deflate can give.
//
// It is also the link-time proof for the package's zlib dependency: every
// function called here bottoms out in `deflate`/`inflate`.
#include <gzip/compress.hpp>
#include <gzip/decompress.hpp>
#include <gzip/utils.hpp>
#include <cstdio>
#include <string>
int main() {
std::string original;
for (int i = 0; i < 200; ++i) original += "mcpp-index gzip round trip ";
const std::string compressed = gzip::compress(original.data(), original.size());
if (!gzip::is_compressed(compressed.data(), compressed.size())) {
// …
tests/examples/gzip-hpp/tests/roundtrip.cpp · 项目 tests/examples/gzip-hpp
openkal
| 目标 | 结果 | 环境 | 测试项目 | 首条诊断 |
|---|---|---|---|---|
| x86_64-linux-gnu | runs | posix | gzip-hpp | |
| x86_64-windows-musl | runs | posix | gzip-hpp |
测量方式
2026-09-23 由 tests/openkal/compat.py 测得,使用 openkal-llvm-runtime 0.15.1、llvm@22.1.8、mcpp 2026.9.21.3。测试项目没有自行选择平台依赖。 上方徽章是所有已测目标里最严格那个的结果 —— 上表列出每个目标各自的环境。
构建
- targets
gzip_hpp (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
mcpp_generated, */include
源文件 (1)
mcpp_generated/gzip_hpp_anchor.c
生成的文件
mcpp_generated/gzip/utils.hppmcpp_generated/gzip/config.hppmcpp_generated/gzip_hpp_anchor.c