Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
508c88f6
Commit
508c88f6
authored
Aug 17, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for nghttp2_hd_deflate_hd_vec with 1 byte chunk
parent
40d217be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
7 deletions
+35
-7
tests/nghttp2_hd_test.c
tests/nghttp2_hd_test.c
+35
-7
No files found.
tests/nghttp2_hd_test.c
View file @
508c88f6
...
...
@@ -1278,10 +1278,11 @@ void test_nghttp2_hd_deflate_hd_vec(void) {
uint8_t
buf
[
4096
];
ssize_t
blocklen
;
nghttp2_mem
*
mem
;
nghttp2_vec
vec
[
2
];
nghttp2_vec
vec
[
2
56
];
size_t
buflen
;
nghttp2_bufs
bufs
;
nva_out
out
;
size_t
i
;
mem
=
nghttp2_mem_default
();
...
...
@@ -1297,8 +1298,7 @@ void test_nghttp2_hd_deflate_hd_vec(void) {
vec
[
1
].
base
=
&
buf
[
buflen
/
2
];
vec
[
1
].
len
=
buflen
/
2
;
blocklen
=
nghttp2_hd_deflate_hd_vec
(
deflater
,
vec
,
ARRLEN
(
vec
),
nva
,
ARRLEN
(
nva
));
blocklen
=
nghttp2_hd_deflate_hd_vec
(
deflater
,
vec
,
2
,
nva
,
ARRLEN
(
nva
));
CU_ASSERT
(
blocklen
>
0
);
...
...
@@ -1336,8 +1336,7 @@ void test_nghttp2_hd_deflate_hd_vec(void) {
nghttp2_hd_deflate_new
(
&
deflater
,
4096
);
nghttp2_hd_inflate_new
(
&
inflater
);
blocklen
=
nghttp2_hd_deflate_hd_vec
(
deflater
,
vec
,
ARRLEN
(
vec
),
nva
,
ARRLEN
(
nva
));
blocklen
=
nghttp2_hd_deflate_hd_vec
(
deflater
,
vec
,
2
,
nva
,
ARRLEN
(
nva
));
CU_ASSERT
(
NGHTTP2_ERR_INSUFF_BUFSIZE
==
blocklen
);
...
...
@@ -1355,13 +1354,42 @@ void test_nghttp2_hd_deflate_hd_vec(void) {
vec
[
1
].
base
=
&
buf
[
buflen
/
2
];
vec
[
1
].
len
=
(
buflen
/
2
)
-
1
;
blocklen
=
nghttp2_hd_deflate_hd_vec
(
deflater
,
vec
,
ARRLEN
(
vec
),
nva
,
ARRLEN
(
nva
));
blocklen
=
nghttp2_hd_deflate_hd_vec
(
deflater
,
vec
,
2
,
nva
,
ARRLEN
(
nva
));
CU_ASSERT
(
NGHTTP2_ERR_INVALID_ARGUMENT
==
blocklen
);
nghttp2_hd_inflate_del
(
inflater
);
nghttp2_hd_deflate_del
(
deflater
);
/* check the case where chunk size is 1 */
nghttp2_hd_deflate_new
(
&
deflater
,
4096
);
nghttp2_hd_inflate_new
(
&
inflater
);
buflen
=
nghttp2_hd_deflate_bound
(
deflater
,
nva
,
ARRLEN
(
nva
));
assert
(
buflen
<=
ARRLEN
(
vec
));
for
(
i
=
0
;
i
<
buflen
;
++
i
)
{
vec
[
i
].
base
=
&
buf
[
i
];
vec
[
i
].
len
=
1
;
}
blocklen
=
nghttp2_hd_deflate_hd_vec
(
deflater
,
vec
,
buflen
,
nva
,
ARRLEN
(
nva
));
CU_ASSERT
(
blocklen
>
0
);
nghttp2_bufs_wrap_init
(
&
bufs
,
buf
,
(
size_t
)
blocklen
,
mem
);
bufs
.
head
->
buf
.
last
+=
blocklen
;
CU_ASSERT
(
blocklen
==
inflate_hd
(
inflater
,
&
out
,
&
bufs
,
0
,
mem
));
CU_ASSERT
(
ARRLEN
(
nva
)
==
out
.
nvlen
);
assert_nv_equal
(
nva
,
out
.
nva
,
ARRLEN
(
nva
),
mem
);
nghttp2_bufs_wrap_free
(
&
bufs
);
nghttp2_hd_inflate_del
(
inflater
);
nghttp2_hd_deflate_del
(
deflater
);
nva_out_reset
(
&
out
,
mem
);
}
static
size_t
encode_length
(
uint8_t
*
buf
,
uint64_t
n
,
size_t
prefix
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment