Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
34db3ee1
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
34db3ee1
编写于
2月 08, 2022
作者:
O
openharmony_ci
提交者:
Gitee
2月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1815 bms zlib xts
Merge pull request !1815 from dujingcheng/zlibxts
上级
0fcc2655
a756d8c0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
308 addition
and
35 deletion
+308
-35
appexecfwk/BUILD.gn
appexecfwk/BUILD.gn
+1
-1
appexecfwk/zlib/actszlibtest/ActsZlibTest.cpp
appexecfwk/zlib/actszlibtest/ActsZlibTest.cpp
+302
-29
appexecfwk/zlib/actszlibtest/BUILD.gn
appexecfwk/zlib/actszlibtest/BUILD.gn
+3
-3
appexecfwk/zlib/actszlibtest/Test.json
appexecfwk/zlib/actszlibtest/Test.json
+2
-2
未找到文件。
appexecfwk/BUILD.gn
浏览文件 @
34db3ee1
...
...
@@ -18,7 +18,7 @@ group("appexecfwk") {
if (is_standard_system) {
deps = [
"bundle_standard:bundle_standard",
"zlib
test/zlibcpptest:ZlibCpp
Test",
"zlib
/actszlibtest:ActsZlib
Test",
]
}
}
appexecfwk/zlib
test/zlibcpptest/ZlibCpp
Test.cpp
→
appexecfwk/zlib
/actszlibtest/ActsZlib
Test.cpp
浏览文件 @
34db3ee1
...
...
@@ -31,40 +31,42 @@ static const char GARBAGE[] = "garbage";
static
const
char
TESTFILE
[]
=
"foo.gz"
;
static
char
HELLO
[]
=
"hello, hello!"
;
static
unsigned
int
CALLOC_SIZE
=
1
;
static
int
ONE
=
1
;
static
int
FOUR
=
4
;
static
int
SIX
=
6
;
static
int
EIGHT
=
8
;
static
unsigned
BUFFER_SIZE
=
8192
;
}
class
ZlibCpp
Test
:
public
testing
::
Test
{
class
ActsZlib
Test
:
public
testing
::
Test
{
protected:
ZlibCpp
Test
();
~
ZlibCpp
Test
();
ActsZlib
Test
();
~
ActsZlib
Test
();
static
void
SetUpTestCase
();
static
void
TearDownTestCase
();
};
ZlibCppTest
::
ZlibCpp
Test
()
ActsZlibTest
::
ActsZlib
Test
()
{}
ZlibCppTest
::~
ZlibCpp
Test
()
ActsZlibTest
::~
ActsZlib
Test
()
{}
void
ZlibCpp
Test
::
SetUpTestCase
()
void
ActsZlib
Test
::
SetUpTestCase
()
{}
void
ZlibCpp
Test
::
TearDownTestCase
()
void
ActsZlib
Test
::
TearDownTestCase
()
{}
/**
* @tc.number :
ZlibCpp
Test_0100
* @tc.number :
ActsZlib
Test_0100
* @tc.name : Test compress and uncompress test
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ZlibCppTest
,
ZlibCpp
TestCompress
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
ActsZlibTest
,
ActsZlib
TestCompress
,
Function
|
MediumTest
|
Level2
)
{
#ifdef Z_SOLO
fprintf
(
stderr
,
"*********
ZlibCpp
TestCompress Z_SOLO**********
\n
"
);
fprintf
(
stderr
,
"*********
ActsZlib
TestCompress Z_SOLO**********
\n
"
);
#else
Byte
*
compr
,
*
uncompr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
/* don't overflow on MSDOS */
...
...
@@ -90,14 +92,14 @@ HWTEST_F(ZlibCppTest, ZlibCppTestCompress, Function | MediumTest | Level2)
}
/**
* @tc.number :
ZlibCpp
Test_0200
* @tc.number :
ActsZlib
Test_0200
* @tc.name : Test gzio
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ZlibCppTest
,
ZlibCpp
TestGzio
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
ActsZlibTest
,
ActsZlib
TestGzio
,
Function
|
MediumTest
|
Level2
)
{
#ifdef Z_SOLO
fprintf
(
stderr
,
"*********
ZlibCpp
TestGzio Z_SOLO**********
\n
"
);
fprintf
(
stderr
,
"*********
ActsZlib
TestGzio Z_SOLO**********
\n
"
);
#else
int
err
;
int
len
=
static_cast
<
int
>
(
strlen
(
HELLO
))
+
1
;
...
...
@@ -144,11 +146,11 @@ HWTEST_F(ZlibCppTest, ZlibCppTestGzio, Function | MediumTest | Level2)
}
/**
* @tc.number :
ZlibCpp
Test_0300
* @tc.number :
ActsZlib
Test_0300
* @tc.name : Test deflate
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ZlibCppTest
,
ZlibCpp
TestDeflate
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
ActsZlibTest
,
ActsZlib
TestDeflate
,
Function
|
MediumTest
|
Level2
)
{
Byte
*
compr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
...
...
@@ -192,11 +194,11 @@ HWTEST_F(ZlibCppTest, ZlibCppTestDeflate, Function | MediumTest | Level2)
}
/**
* @tc.number :
ZlibCpp
Test_0400
* @tc.number :
ActsZlib
Test_0400
* @tc.name : Test inflate
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ZlibCppTest
,
ZlibCpp
TestInflate
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
ActsZlibTest
,
ActsZlib
TestInflate
,
Function
|
MediumTest
|
Level2
)
{
Byte
*
compr
,
*
uncompr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
/* don't overflow on MSDOS */
...
...
@@ -234,11 +236,11 @@ HWTEST_F(ZlibCppTest, ZlibCppTestInflate, Function | MediumTest | Level2)
}
/**
* @tc.number :
ZlibCpp
Test_0500
* @tc.number :
ActsZlib
Test_0500
* @tc.name : Test deflate with large buffers and dynamic change of compression level
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ZlibCppTest
,
ZlibCpp
TestLargeDeflate
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
ActsZlibTest
,
ActsZlib
TestLargeDeflate
,
Function
|
MediumTest
|
Level2
)
{
Byte
*
compr
,
*
uncompr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
/* don't overflow on MSDOS */
...
...
@@ -295,11 +297,11 @@ HWTEST_F(ZlibCppTest, ZlibCppTestLargeDeflate, Function | MediumTest | Level2)
}
/**
* @tc.number :
ZlibCpp
Test_0600
* @tc.number :
ActsZlib
Test_0600
* @tc.name : Test inflate with large buffers
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ZlibCppTest
,
ZlibCpp
TestLargeInflate
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
ActsZlibTest
,
ActsZlib
TestLargeInflate
,
Function
|
MediumTest
|
Level2
)
{
Byte
*
compr
,
*
uncompr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
/* don't overflow on MSDOS */
...
...
@@ -336,11 +338,11 @@ HWTEST_F(ZlibCppTest, ZlibCppTestLargeInflate, Function | MediumTest | Level2)
}
/**
* @tc.number :
ZlibCpp
Test_0700
* @tc.number :
ActsZlib
Test_0700
* @tc.name : Test deflate with full flush
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ZlibCppTest
,
ZlibCpp
TestFlush
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
ActsZlibTest
,
ActsZlib
TestFlush
,
Function
|
MediumTest
|
Level2
)
{
Byte
*
compr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
...
...
@@ -377,11 +379,11 @@ HWTEST_F(ZlibCppTest, ZlibCppTestFlush, Function | MediumTest | Level2)
}
/**
* @tc.number :
ZlibCpp
Test_0800
* @tc.number :
ActsZlib
Test_0800
* @tc.name : Test inflateSync
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ZlibCppTest
,
ZlibCpp
TestSync
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
ActsZlibTest
,
ActsZlib
TestSync
,
Function
|
MediumTest
|
Level2
)
{
Byte
*
compr
,
*
uncompr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
/* don't overflow on MSDOS */
...
...
@@ -415,11 +417,11 @@ HWTEST_F(ZlibCppTest, ZlibCppTestSync, Function | MediumTest | Level2)
}
/**
* @tc.number :
ZlibCpp
Test_0900
* @tc.number :
ActsZlib
Test_0900
* @tc.name : Test deflate with preset dictionary
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ZlibCppTest
,
ZlibCpp
TestDictDeflate
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
ActsZlibTest
,
ActsZlib
TestDictDeflate
,
Function
|
MediumTest
|
Level2
)
{
Byte
*
compr
,
*
uncompr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
/* don't overflow on MSDOS */
...
...
@@ -454,11 +456,11 @@ HWTEST_F(ZlibCppTest, ZlibCppTestDictDeflate, Function | MediumTest | Level2)
}
/**
* @tc.number :
ZlibCpp
Test_1000
* @tc.number :
ActsZlib
Test_1000
* @tc.name : Test inflate with a preset dictionary
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ZlibCppTest
,
ZlibCpp
TestDictInflate
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
ActsZlibTest
,
ActsZlib
TestDictInflate
,
Function
|
MediumTest
|
Level2
)
{
Byte
*
compr
,
*
uncompr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
/* don't overflow on MSDOS */
...
...
@@ -504,4 +506,275 @@ HWTEST_F(ZlibCppTest, ZlibCppTestDictInflate, Function | MediumTest | Level2)
free
(
compr
);
free
(
uncompr
);
}
/**
* @tc.number : ActsZlibTest_1100
* @tc.name : Test compress2 with Z_BEST_COMPRESSION level
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsZlibTest
,
ActsZlibTestCompress2
,
Function
|
MediumTest
|
Level2
)
{
#ifdef Z_SOLO
fprintf
(
stderr
,
"*********ActsZlibTestCompress2 Z_BEST_COMPRESSION Z_SOLO**********
\n
"
);
#else
Byte
*
compr
,
*
uncompr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
/* don't overflow on MSDOS */
uLong
uncomprLen
=
comprLen
;
compr
=
static_cast
<
Byte
*>
(
calloc
(
static_cast
<
uInt
>
(
comprLen
),
CALLOC_SIZE
));
uncompr
=
static_cast
<
Byte
*>
(
calloc
(
static_cast
<
uInt
>
(
uncomprLen
),
CALLOC_SIZE
));
ASSERT_TRUE
(
compr
!=
Z_NULL
&&
uncompr
!=
Z_NULL
);
int
err
;
uLong
len
=
static_cast
<
uLong
>
(
strlen
(
HELLO
))
+
1
;
uLong
outLen
=
compressBound
(
len
);
fprintf
(
stderr
,
"compressBound result: %lu
\n
"
,
outLen
);
err
=
compress2
(
compr
,
&
comprLen
,
reinterpret_cast
<
const
Bytef
*>
(
HELLO
),
outLen
,
Z_BEST_COMPRESSION
);
fprintf
(
stderr
,
"compress2 Z_BEST_COMPRESSION result: %d
\n
"
,
err
);
ASSERT_EQ
(
err
,
Z_OK
);
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE
);
err
=
uncompress2
(
uncompr
,
&
uncomprLen
,
compr
,
&
comprLen
);
fprintf
(
stderr
,
"uncompress2 Z_BEST_COMPRESSION result: %d
\n
"
,
err
);
ASSERT_EQ
(
err
,
Z_OK
);
fprintf
(
stderr
,
"uncompress2: %s
\n
"
,
reinterpret_cast
<
char
*>
(
uncompr
));
free
(
compr
);
free
(
uncompr
);
#endif
}
/**
* @tc.number : ActsZlibTest_1200
* @tc.name : Test adler32
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsZlibTest
,
ActsZlibTestAdler
,
Function
|
MediumTest
|
Level2
)
{
uLong
err
=
Z_ERRNO
;
uLong
adler1
=
0L
;
uLong
adler2
=
0L
;
const
Bytef
*
buf
=
reinterpret_cast
<
const
Bytef
*>
(
DICTIONARY
);
err
=
adler32
(
0L
,
buf
,
0
);
fprintf
(
stderr
,
"adler32 result: %lu
\n
"
,
err
);
ASSERT_NE
(
err
,
Z_ERRNO
);
err
=
adler32_z
(
0L
,
buf
,
0
);
fprintf
(
stderr
,
"adler32_z result: %lu
\n
"
,
err
);
ASSERT_NE
(
err
,
Z_ERRNO
);
#ifdef Z_SOLO
#ifndef Z_LARGE64
err
=
adler32_combine64
(
adler1
,
adler2
,
0
);
fprintf
(
stderr
,
"adler32_combine64 result: %lu
\n
"
,
err
);
ASSERT_NE
(
err
,
Z_ERRNO
);
#endif
#else
err
=
adler32_combine
(
adler1
,
adler2
,
0
);
fprintf
(
stderr
,
"adler32_combine result: %lu
\n
"
,
err
);
ASSERT_NE
(
err
,
Z_ERRNO
);
#endif
}
/**
* @tc.number : ActsZlibTest_1300
* @tc.name : Test deflate state
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsZlibTest
,
ActsZlibTestDeflateState
,
Function
|
MediumTest
|
Level2
)
{
Byte
*
compr
,
*
uncompr
;
int
*
bits
=
nullptr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
/* don't overflow on MSDOS */
uLong
uncomprLen
=
comprLen
;
compr
=
static_cast
<
Byte
*>
(
calloc
(
static_cast
<
uInt
>
(
comprLen
),
CALLOC_SIZE
));
uncompr
=
static_cast
<
Byte
*>
(
calloc
(
static_cast
<
uInt
>
(
uncomprLen
),
CALLOC_SIZE
));
ASSERT_TRUE
(
compr
!=
Z_NULL
&&
uncompr
!=
Z_NULL
);
gz_headerp
headerp
=
nullptr
;
z_stream
c_stream
;
/* compression stream */
int
err
;
int
windowBits
=
EIGHT
;
int
memLevel
=
EIGHT
;
c_stream
.
zalloc
=
nullptr
;
c_stream
.
zfree
=
nullptr
;
c_stream
.
opaque
=
nullptr
;
err
=
deflateInit2
(
&
c_stream
,
Z_BEST_COMPRESSION
,
Z_DEFLATED
,
windowBits
,
memLevel
,
Z_FILTERED
);
ASSERT_EQ
(
err
,
Z_OK
);
deflateSetHeader
(
&
c_stream
,
headerp
);
deflateTune
(
&
c_stream
,
ONE
,
FOUR
,
EIGHT
,
ONE
);
memLevel
=
ONE
;
err
=
deflateParams
(
&
c_stream
,
memLevel
,
Z_DEFAULT_STRATEGY
);
fprintf
(
stderr
,
"deflateParams result: %d
\n
"
,
err
);
ASSERT_EQ
(
err
,
Z_OK
);
err
=
deflatePending
(
&
c_stream
,
nullptr
,
bits
);
fprintf
(
stderr
,
"deflatePending result: %d
\n
"
,
err
);
ASSERT_EQ
(
err
,
Z_OK
);
err
=
deflateSetDictionary
(
&
c_stream
,
reinterpret_cast
<
const
Bytef
*>
(
DICTIONARY
),
static_cast
<
int
>
(
sizeof
(
DICTIONARY
)));
fprintf
(
stderr
,
"deflateGetDictionary result: %d
\n
"
,
err
);
ASSERT_EQ
(
err
,
Z_OK
);
err
=
deflateGetDictionary
(
&
c_stream
,
uncompr
,
nullptr
);
fprintf
(
stderr
,
"deflateGetDictionary result: %d
\n
"
,
err
);
err
=
deflatePrime
(
&
c_stream
,
EIGHT
,
ONE
);
fprintf
(
stderr
,
"deflatePrime result: %d
\n
"
,
err
);
c_stream
.
next_out
=
compr
;
c_stream
.
avail_out
=
static_cast
<
uInt
>
(
comprLen
);
c_stream
.
next_in
=
reinterpret_cast
<
z_const
unsigned
char
*>
(
HELLO
);
c_stream
.
avail_in
=
static_cast
<
uInt
>
(
strlen
(
HELLO
))
+
1
;
err
=
deflate
(
&
c_stream
,
Z_FINISH
);
ASSERT_EQ
(
err
,
Z_STREAM_END
);
err
=
deflateEnd
(
&
c_stream
);
ASSERT_EQ
(
err
,
Z_OK
);
#ifdef Z_SOLO
err
=
deflateResetKeep
(
&
c_stream
);
fprintf
(
stderr
,
"deflateReset result: %d
\n
"
,
err
);
#else
err
=
deflateReset
(
&
c_stream
);
fprintf
(
stderr
,
"deflateReset result: %d
\n
"
,
err
);
#endif
free
(
compr
);
free
(
uncompr
);
}
/**
* @tc.number : ActsZlibTest_1400
* @tc.name : Test deflateBound
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsZlibTest
,
ActsZlibTestDeflateBound
,
Function
|
MediumTest
|
Level2
)
{
z_stream
defstream
;
char
*
inBuf
=
reinterpret_cast
<
char
*>
(
HELLO
);
uint32_t
inLen
=
strlen
(
inBuf
)
+
1
;
uint8_t
*
outBuf
=
nullptr
;
uint32_t
outLen
=
0
;
int
err
;
defstream
.
zalloc
=
nullptr
;
defstream
.
zfree
=
nullptr
;
defstream
.
opaque
=
nullptr
;
defstream
.
avail_in
=
static_cast
<
uInt
>
(
inLen
);
defstream
.
next_in
=
reinterpret_cast
<
Bytef
*>
(
inBuf
);
defstream
.
avail_out
=
static_cast
<
uInt
>
(
outLen
);
defstream
.
next_out
=
reinterpret_cast
<
Bytef
*>
(
outBuf
);
err
=
deflateInit
(
&
defstream
,
Z_DEFAULT_COMPRESSION
);
fprintf
(
stderr
,
"deflateInit result: %d
\n
"
,
err
);
ASSERT_EQ
(
err
,
Z_OK
);
uint32_t
estimateLen
=
deflateBound
(
&
defstream
,
inLen
);
outBuf
=
reinterpret_cast
<
uint8_t
*>
(
malloc
(
estimateLen
));
defstream
.
avail_out
=
static_cast
<
uInt
>
(
estimateLen
);
deflate
(
&
defstream
,
Z_FINISH
);
deflateEnd
(
&
defstream
);
z_stream
outStream
;
err
=
deflateCopy
(
&
defstream
,
&
outStream
);
fprintf
(
stderr
,
"deflateCopy result: %d
\n
"
,
err
);
free
(
inBuf
);
free
(
outBuf
);
}
/**
* @tc.number : ActsZlibTest_1500
* @tc.name : Test adler32
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsZlibTest
,
ActsZlibTestCRC
,
Function
|
MediumTest
|
Level2
)
{
uLong
err
=
Z_ERRNO
;
uLong
crc1
=
0L
;
uLong
crc2
=
0L
;
const
Bytef
*
buf
=
reinterpret_cast
<
const
Bytef
*>
(
DICTIONARY
);
err
=
crc32
(
0L
,
buf
,
0
);
fprintf
(
stderr
,
"crc32 result: %lu
\n
"
,
err
);
ASSERT_NE
(
err
,
Z_ERRNO
);
err
=
crc32_z
(
0L
,
buf
,
0
);
fprintf
(
stderr
,
"crc32_z result: %lu
\n
"
,
err
);
ASSERT_NE
(
err
,
Z_ERRNO
);
#ifdef Z_SOLO
#ifndef Z_LARGE64
err
=
crc32_combine64
(
crc1
,
crc2
,
0
);
fprintf
(
stderr
,
"crc32_combine64 result: %lu
\n
"
,
err
);
ASSERT_NE
(
err
,
Z_ERRNO
);
#endif
#else
err
=
adler32_combine
(
crc1
,
crc2
,
0
);
fprintf
(
stderr
,
"crc32_combine result: %lu
\n
"
,
err
);
ASSERT_NE
(
err
,
Z_ERRNO
);
#endif
}
/**
* @tc.number : ActsZlibTest_1600
* @tc.name : Test get_crc_table
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsZlibTest
,
ActsZlibTestGetCrcTable
,
Function
|
MediumTest
|
Level2
)
{
auto
table
=
get_crc_table
();
ASSERT_TRUE
(
table
!=
nullptr
);
}
/**
* @tc.number : ActsZlibTest_1700
* @tc.name : Test gzBuffer
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsZlibTest
,
ActsZlibTestGzBuffer
,
Function
|
MediumTest
|
Level2
)
{
#ifdef Z_SOLO
fprintf
(
stderr
,
"*********ActsZlibTestGzBuffer Z_SOLO**********
\n
"
);
#else
int
err
;
int
len
=
static_cast
<
int
>
(
strlen
(
HELLO
))
+
1
;
gzFile
file
;
z_off_t
pos
;
file
=
gzopen
(
TESTFILE
,
"wb"
);
ASSERT_TRUE
(
file
!=
NULL
);
err
=
gzbuffer
(
file
,
BUFFER_SIZE
);
ASSERT_EQ
(
err
,
Z_OK
);
gzclearerr
(
file
);
gzputc
(
file
,
'h'
);
ASSERT_TRUE
(
gzputs
(
file
,
"ello"
)
==
FOUR
);
if
(
gzprintf
(
file
,
", %s!"
,
"hello"
)
!=
EIGHT
)
{
fprintf
(
stderr
,
"gzprintf err: %s
\n
"
,
gzerror
(
file
,
&
err
));
ASSERT_TRUE
(
false
);
}
gzseek
(
file
,
1L
,
SEEK_CUR
);
/* add one zero byte */
gzclearerr
(
file
);
gzclose_w
(
file
);
file
=
gzopen
(
TESTFILE
,
"rb"
);
ASSERT_TRUE
(
file
!=
NULL
);
int
res
=
gzdirect
(
file
);
fprintf
(
stderr
,
"gzdirect result: %d
\n
"
,
res
);
Byte
*
compr
,
*
uncompr
;
uLong
comprLen
=
10000
*
sizeof
(
int
);
/* don't overflow on MSDOS */
uLong
uncomprLen
=
comprLen
;
compr
=
static_cast
<
Byte
*>
(
calloc
(
static_cast
<
uInt
>
(
comprLen
),
CALLOC_SIZE
));
uncompr
=
static_cast
<
Byte
*>
(
calloc
(
static_cast
<
uInt
>
(
uncomprLen
),
CALLOC_SIZE
));
ASSERT_TRUE
(
compr
!=
Z_NULL
&&
uncompr
!=
Z_NULL
);
strcpy
(
reinterpret_cast
<
char
*>
(
uncompr
),
GARBAGE
);
ASSERT_TRUE
(
gzread
(
file
,
uncompr
,
static_cast
<
unsigned
>
(
uncomprLen
))
==
len
);
ASSERT_FALSE
(
strcmp
(
reinterpret_cast
<
char
*>
(
uncompr
),
HELLO
));
pos
=
gzseek
(
file
,
-
8L
,
SEEK_CUR
);
ASSERT_FALSE
(
pos
!=
SIX
||
gztell
(
file
)
!=
pos
);
ASSERT_FALSE
(
gzgetc
(
file
)
!=
' '
);
ASSERT_FALSE
(
gzungetc
(
' '
,
file
)
!=
' '
);
fprintf
(
stderr
,
"gzgets
\n
"
);
gzgets
(
file
,
reinterpret_cast
<
char
*>
(
uncompr
),
static_cast
<
int
>
(
uncomprLen
));
ASSERT_FALSE
(
strcmp
(
reinterpret_cast
<
char
*>
(
uncompr
),
HELLO
+
SIX
));
gzclose_r
(
file
);
free
(
compr
);
free
(
uncompr
);
#endif
}
\ No newline at end of file
appexecfwk/zlib
test/zlibcpp
test/BUILD.gn
→
appexecfwk/zlib
/actszlib
test/BUILD.gn
浏览文件 @
34db3ee1
...
...
@@ -12,11 +12,11 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
module_output_path = "hits/
ZlibCpp
Test"
module_output_path = "hits/
ActsZlib
Test"
ohos_moduletest_suite("
ZlibCpp
Test") {
ohos_moduletest_suite("
ActsZlib
Test") {
module_out_path = module_output_path
sources = [ "
ZlibCpp
Test.cpp" ]
sources = [ "
ActsZlib
Test.cpp" ]
configs = [ "//third_party/zlib:zlib_config" ]
public_configs = [ "//third_party/zlib:zlib_public_config" ]
deps = [ "//third_party/zlib:libz" ]
...
...
appexecfwk/zlib
test/zlibcpp
test/Test.json
→
appexecfwk/zlib
/actszlib
test/Test.json
浏览文件 @
34db3ee1
{
"description"
:
"Config for zlib test cases"
,
"driver"
:
{
"module-name"
:
"
ZlibCpp
Test"
,
"module-name"
:
"
ActsZlib
Test"
,
"native-test-timeout"
:
"120000"
,
"native-test-device-path"
:
"/data/local/tmp"
,
"runtime-hint"
:
"1s"
,
...
...
@@ -13,7 +13,7 @@
"chmod -R 777 /data/local/tmp/*"
],
"push"
:
[
"
ZlibCppTest->/data/local/tmp/ZlibCpp
Test"
"
ActsZlibTest->/data/local/tmp/ActsZlib
Test"
],
"type"
:
"PushKit"
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录