mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
std/lzip: add new package
This commit is contained in:
1 parent
1c0b07f1aa
commit
793ab36569
12 files changed
+790
-1
No files matched your search
@@ -17,6 +17,14 @@ BAD 7759aecd test/3pdata/xzsuite/bad-1-lzma2-8.xz
|
||||
BAD 3b80e9ac test/3pdata/xzsuite/bad-1-lzma2-9.xz
|
||||
BAD 15a2a343 test/3pdata/xzsuite/bad-1-stream_flags-1.xz
|
||||
BAD 15a2a343 test/3pdata/xzsuite/bad-1-stream_flags-3.xz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/bad-1-v0-uncomp-size.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/bad-1-v1-crc32.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/bad-1-v1-dict-1.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/bad-1-v1-dict-2.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/bad-1-v1-magic-2.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/bad-1-v1-member-size.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/bad-1-v1-trailing-magic.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/bad-1-v1-uncomp-size.lz
|
||||
BAD 15a2a343 test/3pdata/xzsuite/bad-1-vli-2.xz
|
||||
BAD 31963516 test/3pdata/xzsuite/bad-2-compressed_data_padding.xz
|
||||
BAD 15a2a343 test/3pdata/xzsuite/bad-2-index-1.xz
|
||||
@@ -54,8 +62,17 @@ OK. 00000000 test/3pdata/xzsuite/good-1-lzma2-5.xz
|
||||
OK. 9d269cdc test/3pdata/xzsuite/good-1-riscv-lzma2-1.xz
|
||||
OK. 8d115715 test/3pdata/xzsuite/good-1-riscv-lzma2-2.xz
|
||||
OK. cc270da1 test/3pdata/xzsuite/good-1-sparc-lzma2.xz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/good-1-v0-trailing-1.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/good-1-v0.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/good-1-v1-trailing-1.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/good-1-v1-trailing-2.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/good-1-v1.lz
|
||||
OK. a3679091 test/3pdata/xzsuite/good-1-x86-lzma2.xz
|
||||
OK. 15a2a343 test/3pdata/xzsuite/good-2-lzma2.xz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/good-2-v0-v1.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/good-2-v1-v0.lz
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/good-2-v1-v1.lz
|
||||
OK. 15a2a343 test/3pdata/xzsuite/good-known_size-with_eopm.lzma
|
||||
OK. 15a2a343 test/3pdata/xzsuite/good-known_size-without_eopm.lzma
|
||||
OK. 15a2a343 test/3pdata/xzsuite/good-unknown_size-with_eopm.lzma
|
||||
OK. 8cdc1683 test/3pdata/xzsuite/unsupported-1-v234.lz
|
||||
@@ -0,0 +1,135 @@
|
||||
// Copyright 2024 The Wuffs Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
|
||||
// ----------------
|
||||
|
||||
/*
|
||||
This test program is typically run indirectly, by the "wuffs test" or "wuffs
|
||||
bench" commands. These commands take an optional "-mimic" flag to check that
|
||||
Wuffs' output mimics (i.e. exactly matches) other libraries' output, such as
|
||||
giflib for GIF, libpng for PNG, etc.
|
||||
|
||||
To manually run this test:
|
||||
|
||||
for CC in clang gcc; do
|
||||
$CC -std=c99 -Wall -Werror lzip.c && ./a.out
|
||||
rm -f a.out
|
||||
done
|
||||
|
||||
Each edition should print "PASS", amongst other information, and exit(0).
|
||||
|
||||
Add the "wuffs mimic cflags" (everything after the colon below) to the C
|
||||
compiler flags (after the .c file) to run the mimic tests.
|
||||
|
||||
To manually run the benchmarks, replace "-Wall -Werror" with "-O3" and replace
|
||||
the first "./a.out" with "./a.out -bench". Combine these changes with the
|
||||
"wuffs mimic cflags" to run the mimic benchmarks.
|
||||
*/
|
||||
|
||||
// ¿ wuffs mimic cflags: -DWUFFS_MIMIC -ldeflate -lz
|
||||
|
||||
// Wuffs ships as a "single file C library" or "header file library" as per
|
||||
// https://github.com/nothings/stb/blob/master/docs/stb_howto.txt
|
||||
//
|
||||
// To use that single file as a "foo.c"-like implementation, instead of a
|
||||
// "foo.h"-like header, #define WUFFS_IMPLEMENTATION before #include'ing or
|
||||
// compiling it.
|
||||
#define WUFFS_IMPLEMENTATION
|
||||
|
||||
// Defining the WUFFS_CONFIG__MODULE* macros are optional, but it lets users of
|
||||
// release/c/etc.c choose which parts of Wuffs to build. That file contains the
|
||||
// entire Wuffs standard library, implementing a variety of codecs and file
|
||||
// formats. Without this macro definition, an optimizing compiler or linker may
|
||||
// very well discard Wuffs code for unused codecs, but listing the Wuffs
|
||||
// modules we use makes that process explicit. Preprocessing means that such
|
||||
// code simply isn't compiled.
|
||||
#define WUFFS_CONFIG__MODULES
|
||||
#define WUFFS_CONFIG__MODULE__BASE
|
||||
#define WUFFS_CONFIG__MODULE__CRC32
|
||||
#define WUFFS_CONFIG__MODULE__LZIP
|
||||
#define WUFFS_CONFIG__MODULE__LZMA
|
||||
|
||||
// If building this program in an environment that doesn't easily accommodate
|
||||
// relative includes, you can use the script/inline-c-relative-includes.go
|
||||
// program to generate a stand-alone C file.
|
||||
#include "../../../release/c/wuffs-unsupported-snapshot.c"
|
||||
#include "../testlib/testlib.c"
|
||||
#ifdef WUFFS_MIMIC
|
||||
// No mimic library.
|
||||
#endif
|
||||
|
||||
// ---------------- Lzip Tests
|
||||
|
||||
const char* //
|
||||
test_wuffs_lzip_decode_interface() {
|
||||
CHECK_FOCUS(__func__);
|
||||
wuffs_lzip__decoder dec;
|
||||
CHECK_STATUS("initialize",
|
||||
wuffs_lzip__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
|
||||
return do_test__wuffs_base__io_transformer(
|
||||
wuffs_lzip__decoder__upcast_as__wuffs_base__io_transformer(&dec),
|
||||
"test/data/romeo.txt.lz", 0, SIZE_MAX, 1, 0x78);
|
||||
}
|
||||
|
||||
// ---------------- Mimic Tests
|
||||
|
||||
#ifdef WUFFS_MIMIC
|
||||
|
||||
// No mimic tests.
|
||||
|
||||
#endif // WUFFS_MIMIC
|
||||
|
||||
// ---------------- Lzip Benches
|
||||
|
||||
// No Lzip benches.
|
||||
|
||||
// ---------------- Mimic Benches
|
||||
|
||||
#ifdef WUFFS_MIMIC
|
||||
|
||||
// No mimic benches.
|
||||
|
||||
#endif // WUFFS_MIMIC
|
||||
|
||||
// ---------------- Manifest
|
||||
|
||||
proc g_tests[] = {
|
||||
|
||||
test_wuffs_lzip_decode_interface,
|
||||
|
||||
#ifdef WUFFS_MIMIC
|
||||
|
||||
// No mimic tests.
|
||||
|
||||
#endif // WUFFS_MIMIC
|
||||
|
||||
NULL,
|
||||
};
|
||||
|
||||
proc g_benches[] = {
|
||||
|
||||
// No Lzip benches.
|
||||
|
||||
#ifdef WUFFS_MIMIC
|
||||
|
||||
// No mimic benches.
|
||||
|
||||
#endif // WUFFS_MIMIC
|
||||
|
||||
NULL,
|
||||
};
|
||||
|
||||
int //
|
||||
main(int argc, char** argv) {
|
||||
g_proc_package_name = "std/lzip";
|
||||
return test_main(argc, argv, g_tests, g_benches);
|
||||
}
|
||||
Binary file not shown.
@@ -29,6 +29,7 @@ OK. abe507ef test/data/romeo.txt.bz2
|
||||
OK. abe507ef test/data/romeo.txt.delta1.xz
|
||||
OK. abe507ef test/data/romeo.txt.gz
|
||||
OK. abe507ef test/data/romeo.txt.litonlylzma
|
||||
OK. 8cdc1683 test/data/romeo.txt.lz
|
||||
OK. abe507ef test/data/romeo.txt.lzma
|
||||
OK. abe507ef test/data/romeo.txt.xz
|
||||
OK. abe507ef test/data/romeo.txt.zlib
|
||||
Reference in new issue
Block a user