unify tests for all compression extensions

This commit is contained in:
DubbleClick
2025-06-05 20:07:55 +07:00
parent 17b4c18830
commit 01a79fcc6e
5 changed files with 53 additions and 8 deletions

View File

@@ -2,7 +2,14 @@
declare(strict_types=1);
$str = 'brotli_compress ( string $data, int $level = BROTLI_COMPRESS_LEVEL_DEFAULT, int $mode = BROTLI_GENERIC, string|null $dict = null ): string|false';
assert(function_exists('brotli_compress'));
assert(function_exists('brotli_uncompress'));
assert(brotli_uncompress(brotli_compress($str)) === $str);
$input = str_repeat('The quick brown fox jumps over the lazy dog. ', 10);
$compressed = brotli_compress($input);
assert(is_string($compressed));
assert(strlen($compressed) < strlen($input));
$uncompressed = brotli_uncompress($compressed);
assert(is_string($uncompressed));
assert($uncompressed === $input);