@@ -41,37 +41,6 @@ const static int MAX_TABLE_SIZE = 4096;
4141 * *
4242 ***********************************************************************************/
4343
44- // [RFC 7541] C.1. Integer Representation Examples
45- const static struct {
46- uint32_t raw_integer;
47- uint8_t *encoded_field;
48- int encoded_field_len;
49- int prefix;
50- } integer_test_case[] = {{10 , (uint8_t *)" \x0A " , 1 , 5 }, {1337 , (uint8_t *)" \x1F\x9A\x0A " , 3 , 5 }, {42 , (uint8_t *)R"( *)" , 1 , 8 }};
51-
52- // Example: custom-key: custom-header
53- const static struct {
54- char *raw_string;
55- uint32_t raw_string_len;
56- uint8_t *encoded_field;
57- int encoded_field_len;
58- } string_test_case[] = {{(char *)" " , 0 ,
59- (uint8_t *)" \x0 "
60- " " ,
61- 1 },
62- {(char *)" custom-key" , 10 ,
63- (uint8_t *)" \xA "
64- " custom-key" ,
65- 11 },
66- {(char *)" " , 0 ,
67- (uint8_t *)" \x80 "
68- " " ,
69- 1 },
70- {(char *)" custom-key" , 10 ,
71- (uint8_t *)" \x88 "
72- " \x25\xa8\x49\xe9\x5b\xa9\x7d\x7f " ,
73- 9 }};
74-
7544// [RFC 7541] C.2.4. Indexed Header Field
7645const static struct {
7746 int index;
@@ -317,43 +286,6 @@ const static struct {
317286 * *
318287 ***********************************************************************************/
319288
320- REGRESSION_TEST (HPACK_EncodeInteger)(RegressionTest *t, int , int *pstatus)
321- {
322- TestBox box (t, pstatus);
323- box = REGRESSION_TEST_PASSED;
324- uint8_t buf[BUFSIZE_FOR_REGRESSION_TEST];
325-
326- for (const auto &i : integer_test_case) {
327- memset (buf, 0 , BUFSIZE_FOR_REGRESSION_TEST);
328-
329- int len = xpack_encode_integer (buf, buf + BUFSIZE_FOR_REGRESSION_TEST, i.raw_integer , i.prefix );
330-
331- box.check (len == i.encoded_field_len , " encoded length was %d, expecting %d" , len, i.encoded_field_len );
332- box.check (len > 0 && memcmp (buf, i.encoded_field , len) == 0 , " encoded value was invalid" );
333- }
334- }
335-
336- REGRESSION_TEST (HPACK_EncodeString)(RegressionTest *t, int , int *pstatus)
337- {
338- TestBox box (t, pstatus);
339- box = REGRESSION_TEST_PASSED;
340-
341- uint8_t buf[BUFSIZE_FOR_REGRESSION_TEST];
342- int len;
343-
344- // FIXME Current encoder support only huffman conding.
345- for (unsigned int i = 2 ; i < sizeof (string_test_case) / sizeof (string_test_case[0 ]); i++) {
346- memset (buf, 0 , BUFSIZE_FOR_REGRESSION_TEST);
347-
348- len = xpack_encode_string (buf, buf + BUFSIZE_FOR_REGRESSION_TEST, string_test_case[i].raw_string ,
349- string_test_case[i].raw_string_len );
350-
351- box.check (len == string_test_case[i].encoded_field_len , " encoded length was %d, expecting %d" , len,
352- string_test_case[i].encoded_field_len );
353- box.check (len > 0 && memcmp (buf, string_test_case[i].encoded_field , len) == 0 , " encoded string was invalid" );
354- }
355- }
356-
357289REGRESSION_TEST (HPACK_EncodeIndexedHeaderField)(RegressionTest *t, int , int *pstatus)
358290{
359291 TestBox box (t, pstatus);
@@ -467,42 +399,6 @@ REGRESSION_TEST(HPACK_Encode)(RegressionTest *t, int, int *pstatus)
467399 }
468400}
469401
470- REGRESSION_TEST (HPACK_DecodeInteger)(RegressionTest *t, int , int *pstatus)
471- {
472- TestBox box (t, pstatus);
473- box = REGRESSION_TEST_PASSED;
474-
475- uint64_t actual;
476-
477- for (const auto &i : integer_test_case) {
478- int len = xpack_decode_integer (actual, i.encoded_field , i.encoded_field + i.encoded_field_len , i.prefix );
479-
480- box.check (len == i.encoded_field_len , " decoded length was %d, expecting %d" , len, i.encoded_field_len );
481- box.check (actual == i.raw_integer , " decoded value was %" PRIu64 " , expected %d" , actual, i.raw_integer );
482- }
483- }
484-
485- REGRESSION_TEST (HPACK_DecodeString)(RegressionTest *t, int , int *pstatus)
486- {
487- TestBox box (t, pstatus);
488- box = REGRESSION_TEST_PASSED;
489-
490- Arena arena;
491- char *actual = nullptr ;
492- uint64_t actual_len = 0 ;
493-
494- hpack_huffman_init ();
495-
496- for (const auto &i : string_test_case) {
497- int len = xpack_decode_string (arena, &actual, actual_len, i.encoded_field , i.encoded_field + i.encoded_field_len );
498-
499- box.check (len == i.encoded_field_len , " decoded length was %d, expecting %d" , len, i.encoded_field_len );
500- box.check (actual_len == i.raw_string_len , " length of decoded string was %" PRIu64 " , expecting %d" , actual_len,
501- i.raw_string_len );
502- box.check (memcmp (actual, i.raw_string , actual_len) == 0 , " decoded string was invalid" );
503- }
504- }
505-
506402REGRESSION_TEST (HPACK_DecodeIndexedHeaderField)(RegressionTest *t, int , int *pstatus)
507403{
508404 TestBox box (t, pstatus);
0 commit comments