From 5ececcd8e7e6f9aa71041915148dba8bab59a931 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 24 Jan 2012 23:06:58 +0900 Subject: [PATCH] Added test --- lib/spdylay_frame.h | 2 -- tests/main.c | 5 +++-- tests/spdylay_frame_test.c | 24 +++++++++++++++--------- tests/spdylay_frame_test.h | 1 + 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/spdylay_frame.h b/lib/spdylay_frame.h index 5b1a9f85..661b7b86 100644 --- a/lib/spdylay_frame.h +++ b/lib/spdylay_frame.h @@ -94,8 +94,6 @@ int spdylay_frame_unpack_syn_stream(spdylay_syn_stream *frame, const uint8_t *payload, size_t payloadlen, spdylay_zlib *inflater); - - /* * Unpacks SYN_REPLY frame byte sequence into |frame|. This function * returns 0 if it succeeds or negative error code. diff --git a/tests/main.c b/tests/main.c index 852294d6..82e338bc 100644 --- a/tests/main.c +++ b/tests/main.c @@ -69,8 +69,9 @@ int main() !CU_add_test(pSuite, "session_recv", test_spdylay_session_recv) || !CU_add_test(pSuite, "session_add_frame", test_spdylay_session_add_frame) || - !CU_add_test(pSuite, "frame_unpack_nv", - test_spdylay_frame_unpack_nv)) { + !CU_add_test(pSuite, "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(); return CU_get_error(); } diff --git a/tests/spdylay_frame_test.c b/tests/spdylay_frame_test.c index 62fa682c..c39fb9c4 100644 --- a/tests/spdylay_frame_test.c +++ b/tests/spdylay_frame_test.c @@ -28,17 +28,18 @@ #include "spdylay_frame.h" +static const char *headers[] = { + "method", "GET", + "scheme", "https", + "url", "/", + "x-head", "foo", + "x-head", "bar", + "version", "HTTP/1.1", + NULL +}; + void test_spdylay_frame_unpack_nv() { - const char *headers[] = { - "method", "GET", - "scheme", "https", - "url", "/", - "version", "HTTP/1.1", - "x-head", "foo", - "x-head", "bar", - NULL - }; const char in[1024]; char **nv; int i; @@ -48,3 +49,8 @@ void test_spdylay_frame_unpack_nv() free(nv); } +void test_spdylay_frame_count_nv_space() +{ + CU_ASSERT(83 == spdylay_frame_count_nv_space(headers)); +} + diff --git a/tests/spdylay_frame_test.h b/tests/spdylay_frame_test.h index 1df83d8a..f5397457 100644 --- a/tests/spdylay_frame_test.h +++ b/tests/spdylay_frame_test.h @@ -26,5 +26,6 @@ #define SPDYLAY_FRAME_TEST_H void test_spdylay_frame_unpack_nv(); +void test_spdylay_frame_count_nv_space(); #endif /* SPDYLAY_FRAME_TEST_H */