Chris@43: (* example.c -- usage example of the zlib compression library Chris@43: * Copyright (C) 1995-2003 Jean-loup Gailly. Chris@43: * For conditions of distribution and use, see copyright notice in zlib.h Chris@43: * Chris@43: * Pascal translation Chris@43: * Copyright (C) 1998 by Jacques Nomssi Nzali. Chris@43: * For conditions of distribution and use, see copyright notice in readme.txt Chris@43: * Chris@43: * Adaptation to the zlibpas interface Chris@43: * Copyright (C) 2003 by Cosmin Truta. Chris@43: * For conditions of distribution and use, see copyright notice in readme.txt Chris@43: *) Chris@43: Chris@43: program example; Chris@43: Chris@43: {$DEFINE TEST_COMPRESS} Chris@43: {DO NOT $DEFINE TEST_GZIO} Chris@43: {$DEFINE TEST_DEFLATE} Chris@43: {$DEFINE TEST_INFLATE} Chris@43: {$DEFINE TEST_FLUSH} Chris@43: {$DEFINE TEST_SYNC} Chris@43: {$DEFINE TEST_DICT} Chris@43: Chris@43: uses SysUtils, zlibpas; Chris@43: Chris@43: const TESTFILE = 'foo.gz'; Chris@43: Chris@43: (* "hello world" would be more standard, but the repeated "hello" Chris@43: * stresses the compression code better, sorry... Chris@43: *) Chris@43: const hello: PChar = 'hello, hello!'; Chris@43: Chris@43: const dictionary: PChar = 'hello'; Chris@43: Chris@43: var dictId: LongInt; (* Adler32 value of the dictionary *) Chris@43: Chris@43: procedure CHECK_ERR(err: Integer; msg: String); Chris@43: begin Chris@43: if err <> Z_OK then Chris@43: begin Chris@43: WriteLn(msg, ' error: ', err); Chris@43: Halt(1); Chris@43: end; Chris@43: end; Chris@43: Chris@43: procedure EXIT_ERR(const msg: String); Chris@43: begin Chris@43: WriteLn('Error: ', msg); Chris@43: Halt(1); Chris@43: end; Chris@43: Chris@43: (* =========================================================================== Chris@43: * Test compress and uncompress Chris@43: *) Chris@43: {$IFDEF TEST_COMPRESS} Chris@43: procedure test_compress(compr: Pointer; comprLen: LongInt; Chris@43: uncompr: Pointer; uncomprLen: LongInt); Chris@43: var err: Integer; Chris@43: len: LongInt; Chris@43: begin Chris@43: len := StrLen(hello)+1; Chris@43: Chris@43: err := compress(compr, comprLen, hello, len); Chris@43: CHECK_ERR(err, 'compress'); Chris@43: Chris@43: StrCopy(PChar(uncompr), 'garbage'); Chris@43: Chris@43: err := uncompress(uncompr, uncomprLen, compr, comprLen); Chris@43: CHECK_ERR(err, 'uncompress'); Chris@43: Chris@43: if StrComp(PChar(uncompr), hello) <> 0 then Chris@43: EXIT_ERR('bad uncompress') Chris@43: else Chris@43: WriteLn('uncompress(): ', PChar(uncompr)); Chris@43: end; Chris@43: {$ENDIF} Chris@43: Chris@43: (* =========================================================================== Chris@43: * Test read/write of .gz files Chris@43: *) Chris@43: {$IFDEF TEST_GZIO} Chris@43: procedure test_gzio(const fname: PChar; (* compressed file name *) Chris@43: uncompr: Pointer; Chris@43: uncomprLen: LongInt); Chris@43: var err: Integer; Chris@43: len: Integer; Chris@43: zfile: gzFile; Chris@43: pos: LongInt; Chris@43: begin Chris@43: len := StrLen(hello)+1; Chris@43: Chris@43: zfile := gzopen(fname, 'wb'); Chris@43: if zfile = NIL then Chris@43: begin Chris@43: WriteLn('gzopen error'); Chris@43: Halt(1); Chris@43: end; Chris@43: gzputc(zfile, 'h'); Chris@43: if gzputs(zfile, 'ello') <> 4 then Chris@43: begin Chris@43: WriteLn('gzputs err: ', gzerror(zfile, err)); Chris@43: Halt(1); Chris@43: end; Chris@43: {$IFDEF GZ_FORMAT_STRING} Chris@43: if gzprintf(zfile, ', %s!', 'hello') <> 8 then Chris@43: begin Chris@43: WriteLn('gzprintf err: ', gzerror(zfile, err)); Chris@43: Halt(1); Chris@43: end; Chris@43: {$ELSE} Chris@43: if gzputs(zfile, ', hello!') <> 8 then Chris@43: begin Chris@43: WriteLn('gzputs err: ', gzerror(zfile, err)); Chris@43: Halt(1); Chris@43: end; Chris@43: {$ENDIF} Chris@43: gzseek(zfile, 1, SEEK_CUR); (* add one zero byte *) Chris@43: gzclose(zfile); Chris@43: Chris@43: zfile := gzopen(fname, 'rb'); Chris@43: if zfile = NIL then Chris@43: begin Chris@43: WriteLn('gzopen error'); Chris@43: Halt(1); Chris@43: end; Chris@43: Chris@43: StrCopy(PChar(uncompr), 'garbage'); Chris@43: Chris@43: if gzread(zfile, uncompr, uncomprLen) <> len then Chris@43: begin Chris@43: WriteLn('gzread err: ', gzerror(zfile, err)); Chris@43: Halt(1); Chris@43: end; Chris@43: if StrComp(PChar(uncompr), hello) <> 0 then Chris@43: begin Chris@43: WriteLn('bad gzread: ', PChar(uncompr)); Chris@43: Halt(1); Chris@43: end Chris@43: else Chris@43: WriteLn('gzread(): ', PChar(uncompr)); Chris@43: Chris@43: pos := gzseek(zfile, -8, SEEK_CUR); Chris@43: if (pos <> 6) or (gztell(zfile) <> pos) then Chris@43: begin Chris@43: WriteLn('gzseek error, pos=', pos, ', gztell=', gztell(zfile)); Chris@43: Halt(1); Chris@43: end; Chris@43: Chris@43: if gzgetc(zfile) <> ' ' then Chris@43: begin Chris@43: WriteLn('gzgetc error'); Chris@43: Halt(1); Chris@43: end; Chris@43: Chris@43: if gzungetc(' ', zfile) <> ' ' then Chris@43: begin Chris@43: WriteLn('gzungetc error'); Chris@43: Halt(1); Chris@43: end; Chris@43: Chris@43: gzgets(zfile, PChar(uncompr), uncomprLen); Chris@43: uncomprLen := StrLen(PChar(uncompr)); Chris@43: if uncomprLen <> 7 then (* " hello!" *) Chris@43: begin Chris@43: WriteLn('gzgets err after gzseek: ', gzerror(zfile, err)); Chris@43: Halt(1); Chris@43: end; Chris@43: if StrComp(PChar(uncompr), hello + 6) <> 0 then Chris@43: begin Chris@43: WriteLn('bad gzgets after gzseek'); Chris@43: Halt(1); Chris@43: end Chris@43: else Chris@43: WriteLn('gzgets() after gzseek: ', PChar(uncompr)); Chris@43: Chris@43: gzclose(zfile); Chris@43: end; Chris@43: {$ENDIF} Chris@43: Chris@43: (* =========================================================================== Chris@43: * Test deflate with small buffers Chris@43: *) Chris@43: {$IFDEF TEST_DEFLATE} Chris@43: procedure test_deflate(compr: Pointer; comprLen: LongInt); Chris@43: var c_stream: z_stream; (* compression stream *) Chris@43: err: Integer; Chris@43: len: LongInt; Chris@43: begin Chris@43: len := StrLen(hello)+1; Chris@43: Chris@43: c_stream.zalloc := NIL; Chris@43: c_stream.zfree := NIL; Chris@43: c_stream.opaque := NIL; Chris@43: Chris@43: err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION); Chris@43: CHECK_ERR(err, 'deflateInit'); Chris@43: Chris@43: c_stream.next_in := hello; Chris@43: c_stream.next_out := compr; Chris@43: Chris@43: while (c_stream.total_in <> len) and Chris@43: (c_stream.total_out < comprLen) do Chris@43: begin Chris@43: c_stream.avail_out := 1; { force small buffers } Chris@43: c_stream.avail_in := 1; Chris@43: err := deflate(c_stream, Z_NO_FLUSH); Chris@43: CHECK_ERR(err, 'deflate'); Chris@43: end; Chris@43: Chris@43: (* Finish the stream, still forcing small buffers: *) Chris@43: while TRUE do Chris@43: begin Chris@43: c_stream.avail_out := 1; Chris@43: err := deflate(c_stream, Z_FINISH); Chris@43: if err = Z_STREAM_END then Chris@43: break; Chris@43: CHECK_ERR(err, 'deflate'); Chris@43: end; Chris@43: Chris@43: err := deflateEnd(c_stream); Chris@43: CHECK_ERR(err, 'deflateEnd'); Chris@43: end; Chris@43: {$ENDIF} Chris@43: Chris@43: (* =========================================================================== Chris@43: * Test inflate with small buffers Chris@43: *) Chris@43: {$IFDEF TEST_INFLATE} Chris@43: procedure test_inflate(compr: Pointer; comprLen : LongInt; Chris@43: uncompr: Pointer; uncomprLen : LongInt); Chris@43: var err: Integer; Chris@43: d_stream: z_stream; (* decompression stream *) Chris@43: begin Chris@43: StrCopy(PChar(uncompr), 'garbage'); Chris@43: Chris@43: d_stream.zalloc := NIL; Chris@43: d_stream.zfree := NIL; Chris@43: d_stream.opaque := NIL; Chris@43: Chris@43: d_stream.next_in := compr; Chris@43: d_stream.avail_in := 0; Chris@43: d_stream.next_out := uncompr; Chris@43: Chris@43: err := inflateInit(d_stream); Chris@43: CHECK_ERR(err, 'inflateInit'); Chris@43: Chris@43: while (d_stream.total_out < uncomprLen) and Chris@43: (d_stream.total_in < comprLen) do Chris@43: begin Chris@43: d_stream.avail_out := 1; (* force small buffers *) Chris@43: d_stream.avail_in := 1; Chris@43: err := inflate(d_stream, Z_NO_FLUSH); Chris@43: if err = Z_STREAM_END then Chris@43: break; Chris@43: CHECK_ERR(err, 'inflate'); Chris@43: end; Chris@43: Chris@43: err := inflateEnd(d_stream); Chris@43: CHECK_ERR(err, 'inflateEnd'); Chris@43: Chris@43: if StrComp(PChar(uncompr), hello) <> 0 then Chris@43: EXIT_ERR('bad inflate') Chris@43: else Chris@43: WriteLn('inflate(): ', PChar(uncompr)); Chris@43: end; Chris@43: {$ENDIF} Chris@43: Chris@43: (* =========================================================================== Chris@43: * Test deflate with large buffers and dynamic change of compression level Chris@43: *) Chris@43: {$IFDEF TEST_DEFLATE} Chris@43: procedure test_large_deflate(compr: Pointer; comprLen: LongInt; Chris@43: uncompr: Pointer; uncomprLen: LongInt); Chris@43: var c_stream: z_stream; (* compression stream *) Chris@43: err: Integer; Chris@43: begin Chris@43: c_stream.zalloc := NIL; Chris@43: c_stream.zfree := NIL; Chris@43: c_stream.opaque := NIL; Chris@43: Chris@43: err := deflateInit(c_stream, Z_BEST_SPEED); Chris@43: CHECK_ERR(err, 'deflateInit'); Chris@43: Chris@43: c_stream.next_out := compr; Chris@43: c_stream.avail_out := Integer(comprLen); Chris@43: Chris@43: (* At this point, uncompr is still mostly zeroes, so it should compress Chris@43: * very well: Chris@43: *) Chris@43: c_stream.next_in := uncompr; Chris@43: c_stream.avail_in := Integer(uncomprLen); Chris@43: err := deflate(c_stream, Z_NO_FLUSH); Chris@43: CHECK_ERR(err, 'deflate'); Chris@43: if c_stream.avail_in <> 0 then Chris@43: EXIT_ERR('deflate not greedy'); Chris@43: Chris@43: (* Feed in already compressed data and switch to no compression: *) Chris@43: deflateParams(c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); Chris@43: c_stream.next_in := compr; Chris@43: c_stream.avail_in := Integer(comprLen div 2); Chris@43: err := deflate(c_stream, Z_NO_FLUSH); Chris@43: CHECK_ERR(err, 'deflate'); Chris@43: Chris@43: (* Switch back to compressing mode: *) Chris@43: deflateParams(c_stream, Z_BEST_COMPRESSION, Z_FILTERED); Chris@43: c_stream.next_in := uncompr; Chris@43: c_stream.avail_in := Integer(uncomprLen); Chris@43: err := deflate(c_stream, Z_NO_FLUSH); Chris@43: CHECK_ERR(err, 'deflate'); Chris@43: Chris@43: err := deflate(c_stream, Z_FINISH); Chris@43: if err <> Z_STREAM_END then Chris@43: EXIT_ERR('deflate should report Z_STREAM_END'); Chris@43: Chris@43: err := deflateEnd(c_stream); Chris@43: CHECK_ERR(err, 'deflateEnd'); Chris@43: end; Chris@43: {$ENDIF} Chris@43: Chris@43: (* =========================================================================== Chris@43: * Test inflate with large buffers Chris@43: *) Chris@43: {$IFDEF TEST_INFLATE} Chris@43: procedure test_large_inflate(compr: Pointer; comprLen: LongInt; Chris@43: uncompr: Pointer; uncomprLen: LongInt); Chris@43: var err: Integer; Chris@43: d_stream: z_stream; (* decompression stream *) Chris@43: begin Chris@43: StrCopy(PChar(uncompr), 'garbage'); Chris@43: Chris@43: d_stream.zalloc := NIL; Chris@43: d_stream.zfree := NIL; Chris@43: d_stream.opaque := NIL; Chris@43: Chris@43: d_stream.next_in := compr; Chris@43: d_stream.avail_in := Integer(comprLen); Chris@43: Chris@43: err := inflateInit(d_stream); Chris@43: CHECK_ERR(err, 'inflateInit'); Chris@43: Chris@43: while TRUE do Chris@43: begin Chris@43: d_stream.next_out := uncompr; (* discard the output *) Chris@43: d_stream.avail_out := Integer(uncomprLen); Chris@43: err := inflate(d_stream, Z_NO_FLUSH); Chris@43: if err = Z_STREAM_END then Chris@43: break; Chris@43: CHECK_ERR(err, 'large inflate'); Chris@43: end; Chris@43: Chris@43: err := inflateEnd(d_stream); Chris@43: CHECK_ERR(err, 'inflateEnd'); Chris@43: Chris@43: if d_stream.total_out <> 2 * uncomprLen + comprLen div 2 then Chris@43: begin Chris@43: WriteLn('bad large inflate: ', d_stream.total_out); Chris@43: Halt(1); Chris@43: end Chris@43: else Chris@43: WriteLn('large_inflate(): OK'); Chris@43: end; Chris@43: {$ENDIF} Chris@43: Chris@43: (* =========================================================================== Chris@43: * Test deflate with full flush Chris@43: *) Chris@43: {$IFDEF TEST_FLUSH} Chris@43: procedure test_flush(compr: Pointer; var comprLen : LongInt); Chris@43: var c_stream: z_stream; (* compression stream *) Chris@43: err: Integer; Chris@43: len: Integer; Chris@43: begin Chris@43: len := StrLen(hello)+1; Chris@43: Chris@43: c_stream.zalloc := NIL; Chris@43: c_stream.zfree := NIL; Chris@43: c_stream.opaque := NIL; Chris@43: Chris@43: err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION); Chris@43: CHECK_ERR(err, 'deflateInit'); Chris@43: Chris@43: c_stream.next_in := hello; Chris@43: c_stream.next_out := compr; Chris@43: c_stream.avail_in := 3; Chris@43: c_stream.avail_out := Integer(comprLen); Chris@43: err := deflate(c_stream, Z_FULL_FLUSH); Chris@43: CHECK_ERR(err, 'deflate'); Chris@43: Chris@43: Inc(PByteArray(compr)^[3]); (* force an error in first compressed block *) Chris@43: c_stream.avail_in := len - 3; Chris@43: Chris@43: err := deflate(c_stream, Z_FINISH); Chris@43: if err <> Z_STREAM_END then Chris@43: CHECK_ERR(err, 'deflate'); Chris@43: Chris@43: err := deflateEnd(c_stream); Chris@43: CHECK_ERR(err, 'deflateEnd'); Chris@43: Chris@43: comprLen := c_stream.total_out; Chris@43: end; Chris@43: {$ENDIF} Chris@43: Chris@43: (* =========================================================================== Chris@43: * Test inflateSync() Chris@43: *) Chris@43: {$IFDEF TEST_SYNC} Chris@43: procedure test_sync(compr: Pointer; comprLen: LongInt; Chris@43: uncompr: Pointer; uncomprLen : LongInt); Chris@43: var err: Integer; Chris@43: d_stream: z_stream; (* decompression stream *) Chris@43: begin Chris@43: StrCopy(PChar(uncompr), 'garbage'); Chris@43: Chris@43: d_stream.zalloc := NIL; Chris@43: d_stream.zfree := NIL; Chris@43: d_stream.opaque := NIL; Chris@43: Chris@43: d_stream.next_in := compr; Chris@43: d_stream.avail_in := 2; (* just read the zlib header *) Chris@43: Chris@43: err := inflateInit(d_stream); Chris@43: CHECK_ERR(err, 'inflateInit'); Chris@43: Chris@43: d_stream.next_out := uncompr; Chris@43: d_stream.avail_out := Integer(uncomprLen); Chris@43: Chris@43: inflate(d_stream, Z_NO_FLUSH); Chris@43: CHECK_ERR(err, 'inflate'); Chris@43: Chris@43: d_stream.avail_in := Integer(comprLen-2); (* read all compressed data *) Chris@43: err := inflateSync(d_stream); (* but skip the damaged part *) Chris@43: CHECK_ERR(err, 'inflateSync'); Chris@43: Chris@43: err := inflate(d_stream, Z_FINISH); Chris@43: if err <> Z_DATA_ERROR then Chris@43: EXIT_ERR('inflate should report DATA_ERROR'); Chris@43: (* Because of incorrect adler32 *) Chris@43: Chris@43: err := inflateEnd(d_stream); Chris@43: CHECK_ERR(err, 'inflateEnd'); Chris@43: Chris@43: WriteLn('after inflateSync(): hel', PChar(uncompr)); Chris@43: end; Chris@43: {$ENDIF} Chris@43: Chris@43: (* =========================================================================== Chris@43: * Test deflate with preset dictionary Chris@43: *) Chris@43: {$IFDEF TEST_DICT} Chris@43: procedure test_dict_deflate(compr: Pointer; comprLen: LongInt); Chris@43: var c_stream: z_stream; (* compression stream *) Chris@43: err: Integer; Chris@43: begin Chris@43: c_stream.zalloc := NIL; Chris@43: c_stream.zfree := NIL; Chris@43: c_stream.opaque := NIL; Chris@43: Chris@43: err := deflateInit(c_stream, Z_BEST_COMPRESSION); Chris@43: CHECK_ERR(err, 'deflateInit'); Chris@43: Chris@43: err := deflateSetDictionary(c_stream, dictionary, StrLen(dictionary)); Chris@43: CHECK_ERR(err, 'deflateSetDictionary'); Chris@43: Chris@43: dictId := c_stream.adler; Chris@43: c_stream.next_out := compr; Chris@43: c_stream.avail_out := Integer(comprLen); Chris@43: Chris@43: c_stream.next_in := hello; Chris@43: c_stream.avail_in := StrLen(hello)+1; Chris@43: Chris@43: err := deflate(c_stream, Z_FINISH); Chris@43: if err <> Z_STREAM_END then Chris@43: EXIT_ERR('deflate should report Z_STREAM_END'); Chris@43: Chris@43: err := deflateEnd(c_stream); Chris@43: CHECK_ERR(err, 'deflateEnd'); Chris@43: end; Chris@43: {$ENDIF} Chris@43: Chris@43: (* =========================================================================== Chris@43: * Test inflate with a preset dictionary Chris@43: *) Chris@43: {$IFDEF TEST_DICT} Chris@43: procedure test_dict_inflate(compr: Pointer; comprLen: LongInt; Chris@43: uncompr: Pointer; uncomprLen: LongInt); Chris@43: var err: Integer; Chris@43: d_stream: z_stream; (* decompression stream *) Chris@43: begin Chris@43: StrCopy(PChar(uncompr), 'garbage'); Chris@43: Chris@43: d_stream.zalloc := NIL; Chris@43: d_stream.zfree := NIL; Chris@43: d_stream.opaque := NIL; Chris@43: Chris@43: d_stream.next_in := compr; Chris@43: d_stream.avail_in := Integer(comprLen); Chris@43: Chris@43: err := inflateInit(d_stream); Chris@43: CHECK_ERR(err, 'inflateInit'); Chris@43: Chris@43: d_stream.next_out := uncompr; Chris@43: d_stream.avail_out := Integer(uncomprLen); Chris@43: Chris@43: while TRUE do Chris@43: begin Chris@43: err := inflate(d_stream, Z_NO_FLUSH); Chris@43: if err = Z_STREAM_END then Chris@43: break; Chris@43: if err = Z_NEED_DICT then Chris@43: begin Chris@43: if d_stream.adler <> dictId then Chris@43: EXIT_ERR('unexpected dictionary'); Chris@43: err := inflateSetDictionary(d_stream, dictionary, StrLen(dictionary)); Chris@43: end; Chris@43: CHECK_ERR(err, 'inflate with dict'); Chris@43: end; Chris@43: Chris@43: err := inflateEnd(d_stream); Chris@43: CHECK_ERR(err, 'inflateEnd'); Chris@43: Chris@43: if StrComp(PChar(uncompr), hello) <> 0 then Chris@43: EXIT_ERR('bad inflate with dict') Chris@43: else Chris@43: WriteLn('inflate with dictionary: ', PChar(uncompr)); Chris@43: end; Chris@43: {$ENDIF} Chris@43: Chris@43: var compr, uncompr: Pointer; Chris@43: comprLen, uncomprLen: LongInt; Chris@43: Chris@43: begin Chris@43: if zlibVersion^ <> ZLIB_VERSION[1] then Chris@43: EXIT_ERR('Incompatible zlib version'); Chris@43: Chris@43: WriteLn('zlib version: ', zlibVersion); Chris@43: WriteLn('zlib compile flags: ', Format('0x%x', [zlibCompileFlags])); Chris@43: Chris@43: comprLen := 10000 * SizeOf(Integer); (* don't overflow on MSDOS *) Chris@43: uncomprLen := comprLen; Chris@43: GetMem(compr, comprLen); Chris@43: GetMem(uncompr, uncomprLen); Chris@43: if (compr = NIL) or (uncompr = NIL) then Chris@43: EXIT_ERR('Out of memory'); Chris@43: (* compr and uncompr are cleared to avoid reading uninitialized Chris@43: * data and to ensure that uncompr compresses well. Chris@43: *) Chris@43: FillChar(compr^, comprLen, 0); Chris@43: FillChar(uncompr^, uncomprLen, 0); Chris@43: Chris@43: {$IFDEF TEST_COMPRESS} Chris@43: WriteLn('** Testing compress'); Chris@43: test_compress(compr, comprLen, uncompr, uncomprLen); Chris@43: {$ENDIF} Chris@43: Chris@43: {$IFDEF TEST_GZIO} Chris@43: WriteLn('** Testing gzio'); Chris@43: if ParamCount >= 1 then Chris@43: test_gzio(ParamStr(1), uncompr, uncomprLen) Chris@43: else Chris@43: test_gzio(TESTFILE, uncompr, uncomprLen); Chris@43: {$ENDIF} Chris@43: Chris@43: {$IFDEF TEST_DEFLATE} Chris@43: WriteLn('** Testing deflate with small buffers'); Chris@43: test_deflate(compr, comprLen); Chris@43: {$ENDIF} Chris@43: {$IFDEF TEST_INFLATE} Chris@43: WriteLn('** Testing inflate with small buffers'); Chris@43: test_inflate(compr, comprLen, uncompr, uncomprLen); Chris@43: {$ENDIF} Chris@43: Chris@43: {$IFDEF TEST_DEFLATE} Chris@43: WriteLn('** Testing deflate with large buffers'); Chris@43: test_large_deflate(compr, comprLen, uncompr, uncomprLen); Chris@43: {$ENDIF} Chris@43: {$IFDEF TEST_INFLATE} Chris@43: WriteLn('** Testing inflate with large buffers'); Chris@43: test_large_inflate(compr, comprLen, uncompr, uncomprLen); Chris@43: {$ENDIF} Chris@43: Chris@43: {$IFDEF TEST_FLUSH} Chris@43: WriteLn('** Testing deflate with full flush'); Chris@43: test_flush(compr, comprLen); Chris@43: {$ENDIF} Chris@43: {$IFDEF TEST_SYNC} Chris@43: WriteLn('** Testing inflateSync'); Chris@43: test_sync(compr, comprLen, uncompr, uncomprLen); Chris@43: {$ENDIF} Chris@43: comprLen := uncomprLen; Chris@43: Chris@43: {$IFDEF TEST_DICT} Chris@43: WriteLn('** Testing deflate and inflate with preset dictionary'); Chris@43: test_dict_deflate(compr, comprLen); Chris@43: test_dict_inflate(compr, comprLen, uncompr, uncomprLen); Chris@43: {$ENDIF} Chris@43: Chris@43: FreeMem(compr, comprLen); Chris@43: FreeMem(uncompr, uncomprLen); Chris@43: end.