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