os/ossrv/compressionlibs/ziplib/test/pctools/linktest/src/linktest.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include <iostream>
sl@0
    17
#include <zlib.h>
sl@0
    18
sl@0
    19
using namespace std;
sl@0
    20
sl@0
    21
unsigned in OF((void FAR *in_desc, unsigned char FAR * FAR *in_buf))
sl@0
    22
    {
sl@0
    23
    in_desc = NULL;
sl@0
    24
    in_buf = NULL;
sl@0
    25
	return 0;
sl@0
    26
    }
sl@0
    27
sl@0
    28
int out OF((void FAR *out_desc, unsigned char FAR *out_buf, unsigned len))
sl@0
    29
    {
sl@0
    30
    out_desc = NULL;
sl@0
    31
    out_buf = NULL;
sl@0
    32
    len = 0;
sl@0
    33
	return 0;
sl@0
    34
    }
sl@0
    35
sl@0
    36
/**
sl@0
    37
@SYMTestCaseID       	SYSLIB-EZLIB2-CT-4311
sl@0
    38
@SYMTestCaseDesc     	To test that the all the zlib function calls can link against libz.dll and libzlib.a.
sl@0
    39
@SYMTestPriority     	High
sl@0
    40
@SYMTestActions      	Call every exported function in zlib.h.
sl@0
    41
@SYMTestExpectedResults The code should build with no errors.
sl@0
    42
*/
sl@0
    43
void LinkTest()
sl@0
    44
    {
sl@0
    45
	z_stream stream, copiedStream;
sl@0
    46
	Bytef bytefarray[1];
sl@0
    47
	gz_header header;
sl@0
    48
	unsigned char uchararray[1];
sl@0
    49
	uLongf *ulongfp = NULL;
sl@0
    50
	const char *constcharp = NULL;
sl@0
    51
	char *charp = NULL;
sl@0
    52
	gzFile file = NULL;
sl@0
    53
	z_off_t zofft = 0;
sl@0
    54
	int *intp = NULL;
sl@0
    55
	const Bytef *constbytefp = NULL;
sl@0
    56
sl@0
    57
	zlibVersion();
sl@0
    58
	deflateInit(&stream, Z_DEFAULT_COMPRESSION);
sl@0
    59
	deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);
sl@0
    60
	deflateSetDictionary(&stream, bytefarray, 1);
sl@0
    61
	deflateCopy(&copiedStream, &stream);
sl@0
    62
	deflateReset(&stream);
sl@0
    63
	deflateParams(&stream, Z_DEFAULT_COMPRESSION, Z_DEFAULT_STRATEGY);
sl@0
    64
	deflateTune(&stream, 1, 1, 1, 1);
sl@0
    65
	deflateBound(&stream, 1);
sl@0
    66
	deflatePrime(&stream, 0, 0);
sl@0
    67
	deflateSetHeader(&stream, &header);
sl@0
    68
	deflate(&stream, Z_NO_FLUSH);
sl@0
    69
	deflateEnd(&stream);
sl@0
    70
	inflateInit(&stream);
sl@0
    71
	inflateInit2(&stream, MAX_WBITS);
sl@0
    72
	inflateSetDictionary(&stream, bytefarray, 1);
sl@0
    73
	inflateSync(&stream);
sl@0
    74
	inflateCopy(&copiedStream, &stream);
sl@0
    75
	inflateReset(&stream);
sl@0
    76
	inflatePrime(&stream, 0, 0);
sl@0
    77
	inflateGetHeader(&stream, &header);
sl@0
    78
	inflate(&stream, Z_NO_FLUSH);
sl@0
    79
	inflateEnd(&stream);
sl@0
    80
	inflateBackInit(&stream, MAX_WBITS, uchararray);
sl@0
    81
	inflateBack(&stream, in, uchararray, out, uchararray);
sl@0
    82
	inflateBackEnd(&stream);
sl@0
    83
	zlibCompileFlags();
sl@0
    84
	compress(bytefarray, ulongfp, bytefarray, 1);
sl@0
    85
	compress2(bytefarray, ulongfp, bytefarray, 1, Z_DEFAULT_COMPRESSION);
sl@0
    86
	compressBound(1);
sl@0
    87
	uncompress(bytefarray, ulongfp, bytefarray, 1);
sl@0
    88
	gzopen(constcharp, constcharp);
sl@0
    89
	gzdopen(1, constcharp);
sl@0
    90
	gzsetparams(file, Z_DEFAULT_COMPRESSION, Z_DEFAULT_STRATEGY);
sl@0
    91
	gzread(file, uchararray, 1);
sl@0
    92
	gzwrite(file, constcharp, 0);
sl@0
    93
	gzprintf(file, constcharp);
sl@0
    94
	gzputs(file, constcharp);
sl@0
    95
	gzgets(file, charp, 0);
sl@0
    96
	gzputc(file, 0);
sl@0
    97
	gzgetc(file);
sl@0
    98
	gzungetc(0, file);
sl@0
    99
	gzflush(file, Z_NO_FLUSH);
sl@0
   100
	gzseek(file, zofft, 0);
sl@0
   101
	gzrewind(file);
sl@0
   102
	gztell(file);
sl@0
   103
	gzeof(file);
sl@0
   104
	gzdirect(file);
sl@0
   105
	gzclose(file);
sl@0
   106
	gzerror(file, intp);
sl@0
   107
	gzclearerr(file);
sl@0
   108
	adler32(0, constbytefp, 0);
sl@0
   109
	adler32_combine(0, 0, zofft);
sl@0
   110
	crc32(0, constbytefp, 0);
sl@0
   111
	crc32_combine(0, 0, zofft);
sl@0
   112
    }
sl@0
   113
sl@0
   114
int main()
sl@0
   115
    {
sl@0
   116
    LinkTest();
sl@0
   117
sl@0
   118
	return 0;
sl@0
   119
    }