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
c6111b37
Commit
c6111b37
authored
Aug 16, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for nghttp2_hd_deflate_hd_vec
parent
c4d36aef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
0 deletions
+54
-0
tests/main.c
tests/main.c
+2
-0
tests/nghttp2_hd_test.c
tests/nghttp2_hd_test.c
+51
-0
tests/nghttp2_hd_test.h
tests/nghttp2_hd_test.h
+1
-0
No files found.
tests/main.c
View file @
c6111b37
...
...
@@ -383,6 +383,8 @@ int main(int argc _U_, char *argv[] _U_) {
!
CU_add_test
(
pSuite
,
"hd_no_index"
,
test_nghttp2_hd_no_index
)
||
!
CU_add_test
(
pSuite
,
"hd_deflate_bound"
,
test_nghttp2_hd_deflate_bound
)
||
!
CU_add_test
(
pSuite
,
"hd_public_api"
,
test_nghttp2_hd_public_api
)
||
!
CU_add_test
(
pSuite
,
"hd_deflate_hd_vec"
,
test_nghttp2_hd_deflate_hd_vec
)
||
!
CU_add_test
(
pSuite
,
"hd_decode_length"
,
test_nghttp2_hd_decode_length
)
||
!
CU_add_test
(
pSuite
,
"hd_huff_encode"
,
test_nghttp2_hd_huff_encode
)
||
!
CU_add_test
(
pSuite
,
"adjust_local_window_size"
,
...
...
tests/nghttp2_hd_test.c
View file @
c6111b37
...
...
@@ -1265,6 +1265,57 @@ void test_nghttp2_hd_public_api(void) {
nghttp2_hd_deflate_del
(
deflater
);
}
void
test_nghttp2_hd_deflate_hd_vec
(
void
)
{
nghttp2_hd_deflater
*
deflater
;
nghttp2_hd_inflater
*
inflater
;
nghttp2_nv
nva
[]
=
{
MAKE_NV
(
":method"
,
"PUT"
),
MAKE_NV
(
":scheme"
,
"https"
),
MAKE_NV
(
":authority"
,
"localhost:3000"
),
MAKE_NV
(
":path"
,
"/usr/foo/alpha/bravo"
),
MAKE_NV
(
"content-type"
,
"image/png"
),
MAKE_NV
(
"content-length"
,
"1000000007"
),
};
uint8_t
buf
[
4096
];
ssize_t
blocklen
;
nghttp2_mem
*
mem
;
uint8_t
*
bufsin
[
2
];
size_t
buflens
[
2
]
=
{
0
};
size_t
buflen
;
nghttp2_bufs
bufs
;
nva_out
out
;
mem
=
nghttp2_mem_default
();
nva_out_init
(
&
out
);
nghttp2_hd_deflate_new
(
&
deflater
,
4096
);
nghttp2_hd_inflate_new
(
&
inflater
);
buflen
=
nghttp2_hd_deflate_bound
(
deflater
,
nva
,
ARRLEN
(
nva
));
bufsin
[
0
]
=
&
buf
[
0
];
bufsin
[
1
]
=
&
buf
[
buflen
/
2
];
blocklen
=
nghttp2_hd_deflate_hd_vec
(
deflater
,
bufsin
,
ARRLEN
(
bufsin
),
buflen
/
2
,
buflens
,
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
)
{
size_t
k
=
(
size_t
)((
1
<<
prefix
)
-
1
);
size_t
len
=
0
;
...
...
tests/nghttp2_hd_test.h
View file @
c6111b37
...
...
@@ -47,6 +47,7 @@ void test_nghttp2_hd_deflate_inflate(void);
void
test_nghttp2_hd_no_index
(
void
);
void
test_nghttp2_hd_deflate_bound
(
void
);
void
test_nghttp2_hd_public_api
(
void
);
void
test_nghttp2_hd_deflate_hd_vec
(
void
);
void
test_nghttp2_hd_decode_length
(
void
);
void
test_nghttp2_hd_huff_encode
(
void
);
...
...
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