compressionlibs/ziplib/test/rtest/ezexample/ezexample.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /* Portions Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2  * All rights reserved.
       
     3  */
       
     4 
       
     5 /* ezexample.c -- usage example of the zlib compression library
       
     6  * Copyright (C) 1995-1998 Jean-loup Gailly.
       
     7  * For conditions of distribution and use, see copyright notice in zlib.h 
       
     8  */
       
     9 
       
    10 /* @(#) $Id$ */
       
    11 
       
    12 #include <stdio.h>
       
    13 #include <ezlib.h>
       
    14 #include <e32test.h>
       
    15 
       
    16 static RTest test(_L("ezexample.exe"));
       
    17 
       
    18 _LIT(KTestTitle, "Open Source Library Defect Tests.");
       
    19 
       
    20 #ifdef STDC
       
    21 #  include <string.h>
       
    22 #  include <stdlib.h>
       
    23 #else
       
    24    extern void exit  OF((int));
       
    25 #endif
       
    26 
       
    27 #if defined(VMS) || defined(RISCOS)
       
    28 #  define TESTFILE "foo-gz"
       
    29 #else
       
    30 #  define TESTFILE "foo.gz"
       
    31 #endif
       
    32 
       
    33 /* Test macro and function */
       
    34 void Check(TInt aValue, TInt aExpected, TInt aLine)
       
    35 	{
       
    36     if (aValue != aExpected)
       
    37     	{
       
    38         test.Printf(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
       
    39         test.operator()(EFalse, aLine);
       
    40         }
       
    41     }
       
    42 #define test2(a, b) Check(a, b, __LINE__)
       
    43 
       
    44 const char hello[] = "hello, hello!";
       
    45 /* "hello world" would be more standard, but the repeated "hello"
       
    46  * stresses the compression code better, sorry...
       
    47  */
       
    48 
       
    49 const char dictionary[] = "hello";
       
    50 uLong dictId; /* Adler32 value of the dictionary */
       
    51 
       
    52 void test_compress      OF((Byte *compr, uLong comprLen,
       
    53 		            Byte *uncompr, uLong uncomprLen)); 
       
    54 void test_deflate       OF((Byte *compr, uLong comprLen));
       
    55 void test_inflate       OF((Byte *compr, uLong comprLen,
       
    56 		            Byte *uncompr, uLong uncomprLen));
       
    57 void test_large_deflate OF((Byte *compr, uLong comprLen,
       
    58 		            Byte *uncompr, uLong uncomprLen));
       
    59 void test_large_inflate OF((Byte *compr, uLong comprLen,
       
    60 		            Byte *uncompr, uLong uncomprLen));
       
    61 void test_flush         OF((Byte *compr, uLong *comprLen));
       
    62 void test_sync          OF((Byte *compr, uLong comprLen,
       
    63 		            Byte *uncompr, uLong uncomprLen));
       
    64 void test_dict_deflate  OF((Byte *compr, uLong comprLen));
       
    65 void test_dict_inflate  OF((Byte *compr, uLong comprLen,
       
    66 		            Byte *uncompr, uLong uncomprLen));
       
    67 void PrintString(TRefByValue<const TDesC> aFmt, char* string);
       
    68 void RunTest();
       
    69 
       
    70 /**
       
    71 Test compress() and uncompress()
       
    72 
       
    73 @SYMTestCaseID          SYSLIB-EZLIB-CT-0820-0001
       
    74 @SYMTestCaseDesc	    Compression and decompression of a buffer test.
       
    75 @SYMTestPriority 	    High
       
    76 @SYMTestActions  	    Compress and uncompress string "hello" and check for integrity of the operation done.
       
    77 @SYMTestExpectedResults The test must not fail.
       
    78 @SYMREQ                 REQ0000
       
    79 */
       
    80 void test_compress(
       
    81     Byte *compr, uLong comprLen, Byte *uncompr,
       
    82      uLong uncomprLen)
       
    83 {
       
    84 	test.Next(_L("test_compress"));
       
    85 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB-CT-0820-0001 "));
       
    86     int err;
       
    87     uLong len = strlen(hello)+1;
       
    88 
       
    89     err = compress(compr, &comprLen, (const Bytef*)hello, len);
       
    90     test2(err, Z_OK);
       
    91 
       
    92     strcpy((char*)uncompr, "garbage");
       
    93 
       
    94     err = uncompress(uncompr, &uncomprLen, compr, comprLen);
       
    95     test2(err, Z_OK);
       
    96 
       
    97     test2(strcmp((char*)uncompr, hello), 0); /* Fails if bad uncompress */
       
    98 
       
    99     PrintString(_L("uncompress(): %S\n"), (char*)uncompr);
       
   100 }
       
   101 
       
   102 /**
       
   103 @SYMTestCaseID          SYSLIB-EZLIB-CT-0821-0001
       
   104 @SYMTestCaseDesc	    Read and write of .gz files test
       
   105 @SYMTestPriority 	    High
       
   106 @SYMTestActions  	    Tests deflate() with small buffers
       
   107 @SYMTestExpectedResults The test must not fail.
       
   108 @SYMREQ                 REQ0000
       
   109 */
       
   110 void test_deflate(
       
   111     Byte *compr,
       
   112     uLong comprLen)
       
   113 {
       
   114 	test.Next(_L("test_deflate"));
       
   115 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB-CT-0821-0001 "));
       
   116     z_stream c_stream; /* compression stream */
       
   117     int err;
       
   118     int len = strlen(hello)+1;
       
   119 
       
   120     c_stream.zalloc = (alloc_func)0;
       
   121     c_stream.zfree = (free_func)0;
       
   122     c_stream.opaque = (voidpf)0;
       
   123 
       
   124     err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
       
   125     test2(err, Z_OK);
       
   126 
       
   127     c_stream.next_in  = (Bytef*)hello;
       
   128     c_stream.next_out = compr;
       
   129 
       
   130     while (c_stream.total_in != (uLong)len && c_stream.total_out < comprLen) {
       
   131         c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */
       
   132         err = deflate(&c_stream, Z_NO_FLUSH);
       
   133         test2(err, Z_OK);
       
   134     }
       
   135     /* Finish the stream, still forcing small buffers: */
       
   136     for (;;) {
       
   137         c_stream.avail_out = 1;
       
   138         err = deflate(&c_stream, Z_FINISH);
       
   139         if (err == Z_STREAM_END) break;
       
   140         test2(err, Z_OK);
       
   141     }
       
   142 
       
   143     err = deflateEnd(&c_stream);
       
   144     test2(err, Z_OK);
       
   145 }
       
   146 
       
   147 /**
       
   148 @SYMTestCaseID          SYSLIB-EZLIB-CT-0822-0001
       
   149 @SYMTestCaseDesc	    Read and write of .gz files test
       
   150 @SYMTestPriority 	    High
       
   151 @SYMTestActions  	    Tests inflate() with small buffers
       
   152 @SYMTestExpectedResults The test must not fail.
       
   153 @SYMREQ                 REQ0000
       
   154 */
       
   155 void test_inflate(
       
   156     Byte *compr, uLong comprLen, Byte *uncompr,
       
   157      uLong uncomprLen)
       
   158 {
       
   159 	test.Next(_L("test_inflate"));
       
   160 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB-CT-0822-0001 "));
       
   161     int err;
       
   162     z_stream d_stream; /* decompression stream */
       
   163 
       
   164     strcpy((char*)uncompr, "garbage");
       
   165 
       
   166     d_stream.zalloc = (alloc_func)0;
       
   167     d_stream.zfree = (free_func)0;
       
   168     d_stream.opaque = (voidpf)0;
       
   169 
       
   170     d_stream.next_in  = compr;
       
   171     d_stream.avail_in = 0;
       
   172     d_stream.next_out = uncompr;
       
   173 
       
   174     err = inflateInit(&d_stream);
       
   175     test2(err, Z_OK);
       
   176 
       
   177     while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) {
       
   178         d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */
       
   179         err = inflate(&d_stream, Z_NO_FLUSH);
       
   180         if (err == Z_STREAM_END) break;
       
   181         test2(err, Z_OK);
       
   182     }
       
   183 
       
   184     err = inflateEnd(&d_stream);
       
   185     test2(err, Z_OK);
       
   186 
       
   187     test2(strcmp((char*)uncompr, hello), 0); /* Fails if bad inflate */
       
   188 
       
   189     PrintString(_L("inflate(): %S\n"), (char*)uncompr);   
       
   190 }
       
   191 
       
   192 /**
       
   193 @SYMTestCaseID          SYSLIB-EZLIB-CT-0823-0001
       
   194 @SYMTestCaseDesc	    Deflate with large buffers test
       
   195 @SYMTestPriority 	    High
       
   196 @SYMTestActions  	    Test deflate() with large buffers and dynamic change of compression level
       
   197 @SYMTestExpectedResults The test must not fail.
       
   198 @SYMREQ                 REQ0000
       
   199 */
       
   200 void test_large_deflate(
       
   201     Byte *compr, uLong comprLen, Byte *uncompr,
       
   202      uLong uncomprLen)
       
   203 {
       
   204 	test.Next(_L("test_large_deflate"));
       
   205 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB-CT-0823-0001	"));
       
   206     z_stream c_stream; /* compression stream */
       
   207     int err;
       
   208 
       
   209     c_stream.zalloc = (alloc_func)0;
       
   210     c_stream.zfree = (free_func)0;
       
   211     c_stream.opaque = (voidpf)0;
       
   212 
       
   213     err = deflateInit(&c_stream, Z_BEST_SPEED);
       
   214     test2(err, Z_OK);
       
   215 
       
   216     c_stream.next_out = compr;
       
   217     c_stream.avail_out = (uInt)comprLen;
       
   218 
       
   219     /* At this point, uncompr is still mostly zeroes, so it should compress
       
   220      * very well:
       
   221      */
       
   222     c_stream.next_in = uncompr;
       
   223     c_stream.avail_in = (uInt)uncomprLen;
       
   224     err = deflate(&c_stream, Z_NO_FLUSH);
       
   225     test2(err, Z_OK);
       
   226     
       
   227     test2(c_stream.avail_in, 0); /* Fails if deflate not greedy */
       
   228 
       
   229     /* Feed in already compressed data and switch to no compression: */
       
   230     deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
       
   231     c_stream.next_in = compr;
       
   232     c_stream.avail_in = (uInt)comprLen/2;
       
   233     err = deflate(&c_stream, Z_NO_FLUSH);
       
   234     test2(err, Z_OK);
       
   235 
       
   236     /* Switch back to compressing mode: */
       
   237     deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
       
   238     c_stream.next_in = uncompr;
       
   239     c_stream.avail_in = (uInt)uncomprLen;
       
   240     err = deflate(&c_stream, Z_NO_FLUSH);
       
   241     test2(err, Z_OK);
       
   242 
       
   243     err = deflate(&c_stream, Z_FINISH);
       
   244     test2(err, Z_STREAM_END);
       
   245 
       
   246     err = deflateEnd(&c_stream);
       
   247     test2(err, Z_OK);
       
   248 }
       
   249 
       
   250 /**
       
   251 @SYMTestCaseID          SYSLIB-EZLIB-CT-0824-0001
       
   252 @SYMTestCaseDesc	    Inflate with large buffers test
       
   253 @SYMTestPriority 	    High
       
   254 @SYMTestActions  	    Tests inflate() with large buffers
       
   255 @SYMTestExpectedResults The test must not fail.
       
   256 @SYMREQ                 REQ0000
       
   257 */
       
   258 
       
   259 void test_large_inflate(
       
   260     Byte *compr, uLong comprLen, Byte *uncompr,
       
   261      uLong uncomprLen)
       
   262 {
       
   263     test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB-CT-0824-0001 test_large_inflate "));
       
   264     int err;
       
   265     z_stream d_stream; /* decompression stream */
       
   266 
       
   267     strcpy((char*)uncompr, "garbage");
       
   268 
       
   269     d_stream.zalloc = (alloc_func)0;
       
   270     d_stream.zfree = (free_func)0;
       
   271     d_stream.opaque = (voidpf)0;
       
   272 
       
   273     d_stream.next_in  = compr;
       
   274     d_stream.avail_in = (uInt)comprLen;
       
   275 
       
   276     err = inflateInit(&d_stream);
       
   277     test2(err, Z_OK);
       
   278 
       
   279     for (;;) {
       
   280         d_stream.next_out = uncompr;            /* discard the output */
       
   281 	d_stream.avail_out = (uInt)uncomprLen;
       
   282         err = inflate(&d_stream, Z_NO_FLUSH);
       
   283         if (err == Z_STREAM_END) break;
       
   284         test2(err, Z_OK);
       
   285     }
       
   286 
       
   287     err = inflateEnd(&d_stream);
       
   288     test2(err, Z_OK);
       
   289 
       
   290     test2(d_stream.total_out, (2*uncomprLen + comprLen/2)); /* Fails if bad large inflate */
       
   291 
       
   292     test.Printf(_L("large_inflate(): OK\n"));
       
   293 }
       
   294 
       
   295 /**
       
   296 @SYMTestCaseID          SYSLIB-EZLIB-CT-0825-0001
       
   297 @SYMTestCaseDesc	    Test deflate() with full flush
       
   298 @SYMTestPriority 	    High
       
   299 @SYMTestActions  	    Test by flushing the output as random access is desired
       
   300 @SYMTestExpectedResults The test must not fail.
       
   301 @SYMREQ                 REQ0000
       
   302 */
       
   303 void test_flush(
       
   304     Byte *compr,
       
   305     uLong *comprLen)
       
   306 {
       
   307 	test.Next(_L("test_flush"));
       
   308 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB-CT-0825-0001 "));
       
   309     z_stream c_stream; /* compression stream */
       
   310     int err;
       
   311     int len = strlen(hello)+1;
       
   312 
       
   313     c_stream.zalloc = (alloc_func)0;
       
   314     c_stream.zfree = (free_func)0;
       
   315     c_stream.opaque = (voidpf)0;
       
   316 
       
   317     err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
       
   318     test2(err, Z_OK);
       
   319 
       
   320     c_stream.next_in  = (Bytef*)hello;
       
   321     c_stream.next_out = compr;
       
   322     c_stream.avail_in = 3;
       
   323     c_stream.avail_out = (uInt)*comprLen;
       
   324     err = deflate(&c_stream, Z_FULL_FLUSH);
       
   325     test2(err, Z_OK);
       
   326 
       
   327     compr[3]++; /* force an error in first compressed block */
       
   328     c_stream.avail_in = len - 3;
       
   329 
       
   330     err = deflate(&c_stream, Z_FINISH);
       
   331     if (err != Z_STREAM_END) {
       
   332     	test2(err, Z_OK);
       
   333     }
       
   334     err = deflateEnd(&c_stream);
       
   335     test2(err, Z_OK);
       
   336 
       
   337     *comprLen = c_stream.total_out;
       
   338 }
       
   339 
       
   340 /**
       
   341 @SYMTestCaseID          SYSLIB-EZLIB-CT-0826-0001
       
   342 @SYMTestCaseDesc	    Test the inflateSync() function
       
   343 @SYMTestPriority 	    High
       
   344 @SYMTestActions  	    Tests for reading of compressed data with damaged parts and check for errors.
       
   345 @SYMTestExpectedResults The test must not fail.
       
   346 @SYMREQ                 REQ0000
       
   347 */
       
   348 void test_sync(
       
   349     Byte *compr, uLong comprLen, Byte *uncompr,
       
   350      uLong uncomprLen)
       
   351 {
       
   352 	test.Next(_L("test_sync"));
       
   353 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB-CT-0826-0001 "));
       
   354     int err;
       
   355     z_stream d_stream; /* decompression stream */
       
   356 
       
   357     strcpy((char*)uncompr, "garbage");
       
   358 
       
   359     d_stream.zalloc = (alloc_func)0;
       
   360     d_stream.zfree = (free_func)0;
       
   361     d_stream.opaque = (voidpf)0;
       
   362 
       
   363     d_stream.next_in  = compr;
       
   364     d_stream.avail_in = 2; /* just read the zlib header */
       
   365 
       
   366     err = inflateInit(&d_stream);
       
   367     test2(err, Z_OK);
       
   368 
       
   369     d_stream.next_out = uncompr;
       
   370     d_stream.avail_out = (uInt)uncomprLen;
       
   371 
       
   372     inflate(&d_stream, Z_NO_FLUSH);
       
   373     test2(err, Z_OK);
       
   374 
       
   375     d_stream.avail_in = (uInt)comprLen-2;   /* read all compressed data */
       
   376     err = inflateSync(&d_stream);           /* but skip the damaged part */
       
   377     test2(err, Z_OK);
       
   378 
       
   379     err = inflate(&d_stream, Z_FINISH);
       
   380     test2(err, Z_DATA_ERROR); /* inflate should report DATA_ERROR because of incorrect adler32 */
       
   381 
       
   382     err = inflateEnd(&d_stream);
       
   383     test2(err, Z_OK);
       
   384 
       
   385     PrintString(_L("after inflateSync(): hel%S\n"), (char*)uncompr);
       
   386 }
       
   387 
       
   388 /**
       
   389 @SYMTestCaseID          SYSLIB-EZLIB-CT-0827-0001
       
   390 @SYMTestCaseDesc	    Deflation functionality test
       
   391 @SYMTestPriority 	    High
       
   392 @SYMTestActions  	    Test deflate() function with preset dictionary
       
   393 @SYMTestExpectedResults The test must not fail.
       
   394 @SYMREQ                 REQ0000
       
   395 */
       
   396 void test_dict_deflate(
       
   397     Byte *compr,
       
   398     uLong comprLen)
       
   399 {
       
   400 	test.Next(_L("test_dict_deflate"));
       
   401 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB-CT-0827-0001 "));
       
   402     z_stream c_stream; /* compression stream */
       
   403     int err;
       
   404 
       
   405     c_stream.zalloc = (alloc_func)0;
       
   406     c_stream.zfree = (free_func)0;
       
   407     c_stream.opaque = (voidpf)0;
       
   408 
       
   409     err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
       
   410     test2(err, Z_OK);
       
   411 
       
   412     err = deflateSetDictionary(&c_stream,
       
   413 			       (const Bytef*)dictionary, sizeof(dictionary));
       
   414     test2(err, Z_OK);
       
   415 
       
   416     dictId = c_stream.adler;
       
   417     c_stream.next_out = compr;
       
   418     c_stream.avail_out = (uInt)comprLen;
       
   419 
       
   420     c_stream.next_in = (Bytef*)hello;
       
   421     c_stream.avail_in = (uInt)strlen(hello)+1;
       
   422 
       
   423     err = deflate(&c_stream, Z_FINISH);
       
   424     test2(err, Z_STREAM_END);
       
   425 
       
   426     err = deflateEnd(&c_stream);
       
   427     test2(err, Z_OK);
       
   428 }
       
   429 
       
   430 /**
       
   431 @SYMTestCaseID          SYSLIB-EZLIB-CT-0828-0001
       
   432 @SYMTestCaseDesc	    Inflation functionality test
       
   433 @SYMTestPriority 	    High
       
   434 @SYMTestActions  	    Test inflate() with a preset dictionary
       
   435 @SYMTestExpectedResults The test must not fail.
       
   436 @SYMREQ                 REQ0000
       
   437 */
       
   438 void test_dict_inflate(
       
   439     Byte *compr, uLong comprLen, Byte *uncompr,
       
   440      uLong uncomprLen)
       
   441 {
       
   442 	test.Next(_L("test_dict_inflate"));
       
   443 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB-CT-0828-0001 "));
       
   444     int err;
       
   445     z_stream d_stream; /* decompression stream */
       
   446 
       
   447     strcpy((char*)uncompr, "garbage");
       
   448 
       
   449     d_stream.zalloc = (alloc_func)0;
       
   450     d_stream.zfree = (free_func)0;
       
   451     d_stream.opaque = (voidpf)0;
       
   452 
       
   453     d_stream.next_in  = compr;
       
   454     d_stream.avail_in = (uInt)comprLen;
       
   455 
       
   456     err = inflateInit(&d_stream);
       
   457     test2(err, Z_OK);
       
   458 
       
   459     d_stream.next_out = uncompr;
       
   460     d_stream.avail_out = (uInt)uncomprLen;
       
   461 
       
   462     for (;;) {
       
   463         err = inflate(&d_stream, Z_NO_FLUSH);
       
   464         if (err == Z_STREAM_END) break;
       
   465 		if (err == Z_NEED_DICT) {
       
   466 			test2(d_stream.adler, dictId); /* Fails if unexpected dictionary */
       
   467 
       
   468 		    err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,
       
   469 					       sizeof(dictionary));
       
   470 		}
       
   471 		test2(err, Z_OK);
       
   472     }
       
   473 
       
   474     err = inflateEnd(&d_stream);
       
   475     test2(err, Z_OK);
       
   476 
       
   477     test2(strcmp((char*)uncompr, hello), 0); /* Fails if bad inflate with dictionary */
       
   478 
       
   479     PrintString(_L("inflate with dictionary: %S\n"), (char*)uncompr);
       
   480 }
       
   481 
       
   482 /* ===========================================================================
       
   483  * Usage:  example [output.gz  [input.gz]]
       
   484  */
       
   485 
       
   486 void PrintString(TRefByValue<const TDesC> aFmt, char* string)
       
   487 	{
       
   488 	TPtrC8 ptrc8;
       
   489 	TBuf<100> buf;
       
   490 	ptrc8.Set((TUint8*)string, strlen(string));
       
   491 	buf.Copy(ptrc8);
       
   492 	test.Printf(aFmt, &buf);
       
   493 	}
       
   494 
       
   495 void RunTest()
       
   496 {
       
   497     Byte *compr, *uncompr;
       
   498     uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
       
   499     uLong uncomprLen = comprLen;
       
   500     static const char* myVersion = ZLIB_VERSION;
       
   501 
       
   502     test2(zlibVersion()[0], myVersion[0]); /* Fails if incompatible zlib version */
       
   503     
       
   504     if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) {
       
   505     	test.Printf(_L("warning: different zlib version\n"));
       
   506     }
       
   507 
       
   508     compr    = (Byte*)calloc((uInt)comprLen, 1);
       
   509     uncompr  = (Byte*)calloc((uInt)uncomprLen, 1);
       
   510     /* compr and uncompr are cleared to avoid reading uninitialized
       
   511      * data and to ensure that uncompr compresses well.
       
   512      */
       
   513     test2((compr == Z_NULL || uncompr == Z_NULL), 0); /* Fails if out of memory */
       
   514 
       
   515     test_compress(compr, comprLen, uncompr, uncomprLen);
       
   516 
       
   517     test_deflate(compr, comprLen);
       
   518     test_inflate(compr, comprLen, uncompr, uncomprLen);
       
   519 
       
   520     test_large_deflate(compr, comprLen, uncompr, uncomprLen);
       
   521     test_large_inflate(compr, comprLen, uncompr, uncomprLen);
       
   522 
       
   523     test_flush(compr, &comprLen);
       
   524     test_sync(compr, comprLen, uncompr, uncomprLen);
       
   525     comprLen = uncomprLen;
       
   526 
       
   527     test_dict_deflate(compr, comprLen);
       
   528     test_dict_inflate(compr, comprLen, uncompr, uncomprLen);
       
   529     
       
   530     delete compr;
       
   531     delete uncompr;
       
   532 }
       
   533 
       
   534 GLDEF_C TInt E32Main()
       
   535 	{
       
   536 	__UHEAP_MARK;
       
   537 
       
   538 	test.Printf(_L("\n"));
       
   539 	test.Title();
       
   540 	test.Start(KTestTitle);
       
   541 
       
   542 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   543 
       
   544 	TRAPD(err, RunTest());
       
   545 	test2(err, KErrNone);
       
   546 	
       
   547 	test.End();
       
   548 	test.Close();
       
   549 	delete cleanup;
       
   550 
       
   551 	__UHEAP_MARKEND;
       
   552 	return KErrNone;
       
   553 	}