|
|
@ -145,7 +145,7 @@ static void test_many_additions(void) { |
|
|
|
for (i = 0; i < 1000000; i++) { |
|
|
|
for (i = 0; i < 1000000; i++) { |
|
|
|
gpr_asprintf(&key, "K:%d", i); |
|
|
|
gpr_asprintf(&key, "K:%d", i); |
|
|
|
gpr_asprintf(&value, "VALUE:%d", i); |
|
|
|
gpr_asprintf(&value, "VALUE:%d", i); |
|
|
|
grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, key, value)); |
|
|
|
GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, key, value))); |
|
|
|
assert_index(&tbl, 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value); |
|
|
|
assert_index(&tbl, 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value); |
|
|
|
gpr_free(key); |
|
|
|
gpr_free(key); |
|
|
|
gpr_free(value); |
|
|
|
gpr_free(value); |
|
|
@ -182,9 +182,9 @@ static void test_find(void) { |
|
|
|
|
|
|
|
|
|
|
|
mdctx = grpc_mdctx_create(); |
|
|
|
mdctx = grpc_mdctx_create(); |
|
|
|
grpc_chttp2_hptbl_init(&tbl, mdctx); |
|
|
|
grpc_chttp2_hptbl_init(&tbl, mdctx); |
|
|
|
grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "abc", "xyz")); |
|
|
|
GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "abc", "xyz"))); |
|
|
|
grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "abc", "123")); |
|
|
|
GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "abc", "123"))); |
|
|
|
grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "x", "1")); |
|
|
|
GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "x", "1"))); |
|
|
|
|
|
|
|
|
|
|
|
r = find_simple(&tbl, "abc", "123"); |
|
|
|
r = find_simple(&tbl, "abc", "123"); |
|
|
|
GPR_ASSERT(r.index == 2 + GRPC_CHTTP2_LAST_STATIC_ENTRY); |
|
|
|
GPR_ASSERT(r.index == 2 + GRPC_CHTTP2_LAST_STATIC_ENTRY); |
|
|
@ -233,8 +233,8 @@ static void test_find(void) { |
|
|
|
/* overflow the string buffer, check find still works */ |
|
|
|
/* overflow the string buffer, check find still works */ |
|
|
|
for (i = 0; i < 10000; i++) { |
|
|
|
for (i = 0; i < 10000; i++) { |
|
|
|
gpr_ltoa(i, buffer); |
|
|
|
gpr_ltoa(i, buffer); |
|
|
|
grpc_chttp2_hptbl_add(&tbl, |
|
|
|
GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, |
|
|
|
grpc_mdelem_from_strings(mdctx, "test", buffer)); |
|
|
|
grpc_mdelem_from_strings(mdctx, "test", buffer))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
r = find_simple(&tbl, "abc", "123"); |
|
|
|
r = find_simple(&tbl, "abc", "123"); |
|
|
|