Added test

This commit is contained in:
Tatsuhiro Tsujikawa 2012-01-24 23:06:58 +09:00
parent a52ff39850
commit 5ececcd8e7
4 changed files with 19 additions and 13 deletions

View File

@ -94,8 +94,6 @@ int spdylay_frame_unpack_syn_stream(spdylay_syn_stream *frame,
const uint8_t *payload, size_t payloadlen, const uint8_t *payload, size_t payloadlen,
spdylay_zlib *inflater); spdylay_zlib *inflater);
/* /*
* Unpacks SYN_REPLY frame byte sequence into |frame|. This function * Unpacks SYN_REPLY frame byte sequence into |frame|. This function
* returns 0 if it succeeds or negative error code. * returns 0 if it succeeds or negative error code.

View File

@ -69,8 +69,9 @@ int main()
!CU_add_test(pSuite, "session_recv", test_spdylay_session_recv) || !CU_add_test(pSuite, "session_recv", test_spdylay_session_recv) ||
!CU_add_test(pSuite, "session_add_frame", !CU_add_test(pSuite, "session_add_frame",
test_spdylay_session_add_frame) || test_spdylay_session_add_frame) ||
!CU_add_test(pSuite, "frame_unpack_nv", !CU_add_test(pSuite, "frame_unpack_nv", test_spdylay_frame_unpack_nv) ||
test_spdylay_frame_unpack_nv)) { !CU_add_test(pSuite, "frame_count_nv_space",
test_spdylay_frame_count_nv_space)) {
CU_cleanup_registry(); CU_cleanup_registry();
return CU_get_error(); return CU_get_error();
} }

View File

@ -28,17 +28,18 @@
#include "spdylay_frame.h" #include "spdylay_frame.h"
void test_spdylay_frame_unpack_nv() static const char *headers[] = {
{
const char *headers[] = {
"method", "GET", "method", "GET",
"scheme", "https", "scheme", "https",
"url", "/", "url", "/",
"version", "HTTP/1.1",
"x-head", "foo", "x-head", "foo",
"x-head", "bar", "x-head", "bar",
"version", "HTTP/1.1",
NULL NULL
}; };
void test_spdylay_frame_unpack_nv()
{
const char in[1024]; const char in[1024];
char **nv; char **nv;
int i; int i;
@ -48,3 +49,8 @@ void test_spdylay_frame_unpack_nv()
free(nv); free(nv);
} }
void test_spdylay_frame_count_nv_space()
{
CU_ASSERT(83 == spdylay_frame_count_nv_space(headers));
}

View File

@ -26,5 +26,6 @@
#define SPDYLAY_FRAME_TEST_H #define SPDYLAY_FRAME_TEST_H
void test_spdylay_frame_unpack_nv(); void test_spdylay_frame_unpack_nv();
void test_spdylay_frame_count_nv_space();
#endif /* SPDYLAY_FRAME_TEST_H */ #endif /* SPDYLAY_FRAME_TEST_H */