src: Add unittest for http2::index_header
This commit is contained in:
parent
ea0ab938c4
commit
730d47f7ad
|
@ -270,4 +270,16 @@ void test_http2_parse_http_status_code(void) {
|
|||
CU_ASSERT(-1 == http2::parse_http_status_code(""));
|
||||
}
|
||||
|
||||
void test_http2_index_header(void) {
|
||||
int hdidx[http2::HD_MAXIDX];
|
||||
http2::init_hdidx(hdidx);
|
||||
|
||||
http2::index_header(hdidx, reinterpret_cast<const uint8_t *>(":authority"),
|
||||
10, 0);
|
||||
http2::index_header(hdidx, reinterpret_cast<const uint8_t *>("hos"), 3, 1);
|
||||
|
||||
CU_ASSERT(0 == hdidx[http2::HD_AUTHORITY]);
|
||||
CU_ASSERT(-1 == hdidx[http2::HD_HOST]);
|
||||
}
|
||||
|
||||
} // namespace shrpx
|
||||
|
|
|
@ -36,6 +36,7 @@ void test_http2_build_http1_headers_from_norm_headers(void);
|
|||
void test_http2_lws(void);
|
||||
void test_http2_rewrite_location_uri(void);
|
||||
void test_http2_parse_http_status_code(void);
|
||||
void test_http2_index_header(void);
|
||||
|
||||
} // namespace shrpx
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ int main(int argc, char *argv[]) {
|
|||
shrpx::test_http2_rewrite_location_uri) ||
|
||||
!CU_add_test(pSuite, "http2_parse_http_status_code",
|
||||
shrpx::test_http2_parse_http_status_code) ||
|
||||
!CU_add_test(pSuite, "http2_index_header",
|
||||
shrpx::test_http2_index_header) ||
|
||||
!CU_add_test(pSuite, "downstream_normalize_request_headers",
|
||||
shrpx::test_downstream_normalize_request_headers) ||
|
||||
!CU_add_test(pSuite, "downstream_normalize_response_headers",
|
||||
|
|
Loading…
Reference in New Issue