diff options
Diffstat (limited to 'test/core/transport')
-rw-r--r-- | test/core/transport/BUILD | 24 | ||||
-rw-r--r-- | test/core/transport/bdp_estimator_test.cc | 6 | ||||
-rw-r--r-- | test/core/transport/byte_stream_test.cc (renamed from test/core/transport/byte_stream_test.c) | 18 | ||||
-rw-r--r-- | test/core/transport/chttp2/BUILD | 34 | ||||
-rw-r--r-- | test/core/transport/chttp2/alpn_test.cc (renamed from test/core/transport/chttp2/alpn_test.c) | 4 | ||||
-rw-r--r-- | test/core/transport/chttp2/bin_decoder_test.cc (renamed from test/core/transport/chttp2/bin_decoder_test.c) | 18 | ||||
-rw-r--r-- | test/core/transport/chttp2/bin_encoder_test.cc (renamed from test/core/transport/chttp2/bin_encoder_test.c) | 24 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_encoder_test.cc (renamed from test/core/transport/chttp2/hpack_encoder_test.c) | 77 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_parser_fuzzer_test.cc (renamed from test/core/transport/chttp2/hpack_parser_fuzzer_test.c) | 6 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_parser_test.cc (renamed from test/core/transport/chttp2/hpack_parser_test.c) | 22 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_table_test.cc (renamed from test/core/transport/chttp2/hpack_table_test.c) | 20 | ||||
-rw-r--r-- | test/core/transport/chttp2/stream_map_test.cc (renamed from test/core/transport/chttp2/stream_map_test.c) | 27 | ||||
-rw-r--r-- | test/core/transport/chttp2/varint_test.cc (renamed from test/core/transport/chttp2/varint_test.c) | 4 | ||||
-rw-r--r-- | test/core/transport/connectivity_state_test.cc (renamed from test/core/transport/connectivity_state_test.c) | 18 | ||||
-rw-r--r-- | test/core/transport/metadata_test.cc (renamed from test/core/transport/metadata_test.c) | 30 | ||||
-rw-r--r-- | test/core/transport/status_conversion_test.cc (renamed from test/core/transport/status_conversion_test.c) | 2 | ||||
-rw-r--r-- | test/core/transport/stream_owned_slice_test.cc (renamed from test/core/transport/stream_owned_slice_test.c) | 4 | ||||
-rw-r--r-- | test/core/transport/timeout_encoding_test.cc (renamed from test/core/transport/timeout_encoding_test.c) | 10 |
18 files changed, 178 insertions, 170 deletions
diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD index edd27b8a5f..b31d4ff899 100644 --- a/test/core/transport/BUILD +++ b/test/core/transport/BUILD @@ -35,8 +35,8 @@ grpc_cc_test( grpc_cc_test( name = "byte_stream_test", - srcs = ["byte_stream_test.c"], - language = "C", + srcs = ["byte_stream_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -47,8 +47,8 @@ grpc_cc_test( grpc_cc_test( name = "connectivity_state_test", - srcs = ["connectivity_state_test.c"], - language = "C", + srcs = ["connectivity_state_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -59,8 +59,8 @@ grpc_cc_test( grpc_cc_test( name = "metadata_test", - srcs = ["metadata_test.c"], - language = "C", + srcs = ["metadata_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -86,8 +86,8 @@ grpc_cc_test( grpc_cc_test( name = "status_conversion_test", - srcs = ["status_conversion_test.c"], - language = "C", + srcs = ["status_conversion_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -98,8 +98,8 @@ grpc_cc_test( grpc_cc_test( name = "stream_owned_slice_test", - srcs = ["stream_owned_slice_test.c"], - language = "C", + srcs = ["stream_owned_slice_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -110,8 +110,8 @@ grpc_cc_test( grpc_cc_test( name = "timeout_encoding_test", - srcs = ["timeout_encoding_test.c"], - language = "C", + srcs = ["timeout_encoding_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", diff --git a/test/core/transport/bdp_estimator_test.cc b/test/core/transport/bdp_estimator_test.cc index 2c4fc4588b..2a6fa95162 100644 --- a/test/core/transport/bdp_estimator_test.cc +++ b/test/core/transport/bdp_estimator_test.cc @@ -55,7 +55,7 @@ TEST(BdpEstimatorTest, EstimateBdpNoSamples) { } namespace { -void AddSamples(BdpEstimator *estimator, int64_t *samples, size_t n) { +void AddSamples(BdpEstimator* estimator, int64_t* samples, size_t n) { estimator->AddIncomingBytes(1234567); inc_time(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -71,7 +71,7 @@ void AddSamples(BdpEstimator *estimator, int64_t *samples, size_t n) { grpc_exec_ctx_finish(&exec_ctx); } -void AddSample(BdpEstimator *estimator, int64_t sample) { +void AddSample(BdpEstimator* estimator, int64_t sample) { AddSamples(estimator, &sample, 1); } } // namespace @@ -137,7 +137,7 @@ INSTANTIATE_TEST_CASE_P(TooManyNames, BdpEstimatorRandomTest, } // namespace testing } // namespace grpc_core -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); gpr_now_impl = grpc_core::testing::fake_gpr_now; grpc_init(); diff --git a/test/core/transport/byte_stream_test.c b/test/core/transport/byte_stream_test.cc index a0c5f961cf..e62a697284 100644 --- a/test/core/transport/byte_stream_test.c +++ b/test/core/transport/byte_stream_test.cc @@ -30,8 +30,8 @@ // grpc_slice_buffer_stream tests // -static void not_called_closure(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { +static void not_called_closure(grpc_exec_ctx* exec_ctx, void* arg, + grpc_error* error) { GPR_ASSERT(false); } @@ -60,7 +60,7 @@ static void test_slice_buffer_stream_basic(void) { GPR_ASSERT( grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure)); grpc_slice output; - grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); + grpc_error* error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); GPR_ASSERT(error == GRPC_ERROR_NONE); GPR_ASSERT(grpc_slice_eq(input[i], output)); grpc_slice_unref_internal(&exec_ctx, output); @@ -95,12 +95,12 @@ static void test_slice_buffer_stream_shutdown(void) { GPR_ASSERT( grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure)); grpc_slice output; - grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); + grpc_error* error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); GPR_ASSERT(error == GRPC_ERROR_NONE); GPR_ASSERT(grpc_slice_eq(input[0], output)); grpc_slice_unref_internal(&exec_ctx, output); // Now shutdown. - grpc_error *shutdown_error = + grpc_error* shutdown_error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("shutdown error"); grpc_byte_stream_shutdown(&exec_ctx, &stream.base, GRPC_ERROR_REF(shutdown_error)); @@ -150,7 +150,7 @@ static void test_caching_byte_stream_basic(void) { GPR_ASSERT( grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure)); grpc_slice output; - grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); + grpc_error* error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); GPR_ASSERT(error == GRPC_ERROR_NONE); GPR_ASSERT(grpc_slice_eq(input[i], output)); grpc_slice_unref_internal(&exec_ctx, output); @@ -189,7 +189,7 @@ static void test_caching_byte_stream_reset(void) { GPR_ASSERT( grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure)); grpc_slice output; - grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); + grpc_error* error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); GPR_ASSERT(error == GRPC_ERROR_NONE); GPR_ASSERT(grpc_slice_eq(input[0], output)); grpc_slice_unref_internal(&exec_ctx, output); @@ -240,7 +240,7 @@ static void test_caching_byte_stream_shared_cache(void) { GPR_ASSERT( grpc_byte_stream_next(&exec_ctx, &stream1.base, ~(size_t)0, &closure)); grpc_slice output; - grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream1.base, &output); + grpc_error* error = grpc_byte_stream_pull(&exec_ctx, &stream1.base, &output); GPR_ASSERT(error == GRPC_ERROR_NONE); GPR_ASSERT(grpc_slice_eq(input[0], output)); grpc_slice_unref_internal(&exec_ctx, output); @@ -268,7 +268,7 @@ static void test_caching_byte_stream_shared_cache(void) { grpc_exec_ctx_finish(&exec_ctx); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); test_slice_buffer_stream_basic(); test_slice_buffer_stream_shutdown(); diff --git a/test/core/transport/chttp2/BUILD b/test/core/transport/chttp2/BUILD index 6081940243..1ea7d0341d 100644 --- a/test/core/transport/chttp2/BUILD +++ b/test/core/transport/chttp2/BUILD @@ -22,7 +22,7 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( name = "hpack_parser_fuzzer", - srcs = ["hpack_parser_fuzzer_test.c"], + srcs = ["hpack_parser_fuzzer_test.cc"], corpus = "hpack_parser_corpus", deps = [ "//:grpc", @@ -32,8 +32,8 @@ grpc_fuzzer( grpc_cc_test( name = "alpn_test", - srcs = ["alpn_test.c"], - language = "C", + srcs = ["alpn_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -44,8 +44,8 @@ grpc_cc_test( grpc_cc_test( name = "bin_decoder_test", - srcs = ["bin_decoder_test.c"], - language = "C", + srcs = ["bin_decoder_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -56,8 +56,8 @@ grpc_cc_test( grpc_cc_test( name = "bin_encoder_test", - srcs = ["bin_encoder_test.c"], - language = "C", + srcs = ["bin_encoder_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -68,8 +68,8 @@ grpc_cc_test( grpc_cc_test( name = "hpack_encoder_test", - srcs = ["hpack_encoder_test.c"], - language = "C", + srcs = ["hpack_encoder_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -80,8 +80,8 @@ grpc_cc_test( grpc_cc_test( name = "hpack_parser_test", - srcs = ["hpack_parser_test.c"], - language = "C", + srcs = ["hpack_parser_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -92,8 +92,8 @@ grpc_cc_test( grpc_cc_test( name = "hpack_table_test", - srcs = ["hpack_table_test.c"], - language = "C", + srcs = ["hpack_table_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -104,8 +104,8 @@ grpc_cc_test( grpc_cc_test( name = "stream_map_test", - srcs = ["stream_map_test.c"], - language = "C", + srcs = ["stream_map_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -116,8 +116,8 @@ grpc_cc_test( grpc_cc_test( name = "varint_test", - srcs = ["varint_test.c"], - language = "C", + srcs = ["varint_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", diff --git a/test/core/transport/chttp2/alpn_test.c b/test/core/transport/chttp2/alpn_test.cc index 72c30c40eb..a43377393e 100644 --- a/test/core/transport/chttp2/alpn_test.c +++ b/test/core/transport/chttp2/alpn_test.cc @@ -33,7 +33,7 @@ static void test_alpn_failure(void) { // First index in ALPN supported version list of a given protocol. Returns a // value one beyond the last valid element index if not found. -static size_t alpn_version_index(const char *version, size_t size) { +static size_t alpn_version_index(const char* version, size_t size) { size_t i; for (i = 0; i < grpc_chttp2_num_alpn_versions(); ++i) { if (!strncmp(version, grpc_chttp2_get_alpn_version_index(i), size)) { @@ -48,7 +48,7 @@ static void test_alpn_grpc_before_h2(void) { GPR_ASSERT(alpn_version_index("grpc-exp", 8) < alpn_version_index("h2", 2)); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); test_alpn_success(); test_alpn_failure(); diff --git a/test/core/transport/chttp2/bin_decoder_test.c b/test/core/transport/chttp2/bin_decoder_test.cc index 775161ec91..a29ec8a13f 100644 --- a/test/core/transport/chttp2/bin_decoder_test.c +++ b/test/core/transport/chttp2/bin_decoder_test.cc @@ -29,11 +29,11 @@ static int all_ok = 1; -static void expect_slice_eq(grpc_exec_ctx *exec_ctx, grpc_slice expected, - grpc_slice slice, char *debug, int line) { +static void expect_slice_eq(grpc_exec_ctx* exec_ctx, grpc_slice expected, + grpc_slice slice, const char* debug, int line) { if (!grpc_slice_eq(slice, expected)) { - char *hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); - char *he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); gpr_log(GPR_ERROR, "FAILED:%d: %s\ngot: %s\nwant: %s", line, debug, hs, he); gpr_free(hs); @@ -44,22 +44,22 @@ static void expect_slice_eq(grpc_exec_ctx *exec_ctx, grpc_slice expected, grpc_slice_unref_internal(exec_ctx, slice); } -static grpc_slice base64_encode(grpc_exec_ctx *exec_ctx, const char *s) { +static grpc_slice base64_encode(grpc_exec_ctx* exec_ctx, const char* s) { grpc_slice ss = grpc_slice_from_copied_string(s); grpc_slice out = grpc_chttp2_base64_encode(ss); grpc_slice_unref_internal(exec_ctx, ss); return out; } -static grpc_slice base64_decode(grpc_exec_ctx *exec_ctx, const char *s) { +static grpc_slice base64_decode(grpc_exec_ctx* exec_ctx, const char* s) { grpc_slice ss = grpc_slice_from_copied_string(s); grpc_slice out = grpc_chttp2_base64_decode(exec_ctx, ss); grpc_slice_unref_internal(exec_ctx, ss); return out; } -static grpc_slice base64_decode_with_length(grpc_exec_ctx *exec_ctx, - const char *s, +static grpc_slice base64_decode_with_length(grpc_exec_ctx* exec_ctx, + const char* s, size_t output_length) { grpc_slice ss = grpc_slice_from_copied_string(s); grpc_slice out = @@ -78,7 +78,7 @@ static grpc_slice base64_decode_with_length(grpc_exec_ctx *exec_ctx, grpc_chttp2_base64_decode_with_length( \ exec_ctx, base64_encode(exec_ctx, s), strlen(s))); -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; /* ENCODE_AND_DECODE tests grpc_chttp2_base64_decode_with_length(), which diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.cc index acadcf6c89..78b8808c41 100644 --- a/test/core/transport/chttp2/bin_encoder_test.c +++ b/test/core/transport/chttp2/bin_encoder_test.cc @@ -31,11 +31,11 @@ static int all_ok = 1; -static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char *debug, - int line) { +static void expect_slice_eq(grpc_slice expected, grpc_slice slice, + const char* debug, int line) { if (!grpc_slice_eq(slice, expected)) { - char *hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); - char *he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); gpr_log(GPR_ERROR, "FAILED:%d: %s\ngot: %s\nwant: %s", line, debug, hs, he); gpr_free(hs); @@ -46,14 +46,14 @@ static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char *debug, grpc_slice_unref(slice); } -static grpc_slice B64(const char *s) { +static grpc_slice B64(const char* s) { grpc_slice ss = grpc_slice_from_copied_string(s); grpc_slice out = grpc_chttp2_base64_encode(ss); grpc_slice_unref(ss); return out; } -static grpc_slice HUFF(const char *s) { +static grpc_slice HUFF(const char* s) { grpc_slice ss = grpc_slice_from_copied_string(s); grpc_slice out = grpc_chttp2_huffman_compress(ss); grpc_slice_unref(ss); @@ -65,15 +65,15 @@ static grpc_slice HUFF(const char *s) { grpc_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \ #slice, __LINE__); -static void expect_combined_equiv(const char *s, size_t len, int line) { +static void expect_combined_equiv(const char* s, size_t len, int line) { grpc_slice input = grpc_slice_from_copied_buffer(s, len); grpc_slice base64 = grpc_chttp2_base64_encode(input); grpc_slice expect = grpc_chttp2_huffman_compress(base64); grpc_slice got = grpc_chttp2_base64_encode_and_huffman_compress(input); if (!grpc_slice_eq(expect, got)) { - char *t = grpc_dump_slice(input, GPR_DUMP_HEX | GPR_DUMP_ASCII); - char *e = grpc_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII); - char *g = grpc_dump_slice(got, GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* t = grpc_dump_slice(input, GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* e = grpc_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* g = grpc_dump_slice(got, GPR_DUMP_HEX | GPR_DUMP_ASCII); gpr_log(GPR_ERROR, "FAILED:%d:\ntest: %s\ngot: %s\nwant: %s", line, t, g, e); gpr_free(t); @@ -90,7 +90,7 @@ static void expect_combined_equiv(const char *s, size_t len, int line) { #define EXPECT_COMBINED_EQUIV(x) \ expect_combined_equiv(x, sizeof(x) - 1, __LINE__) -static void expect_binary_header(const char *hdr, int binary) { +static void expect_binary_header(const char* hdr, int binary) { if (grpc_is_binary_header(grpc_slice_from_static_string(hdr)) != binary) { gpr_log(GPR_ERROR, "FAILED: expected header '%s' to be %s", hdr, binary ? "binary" : "not binary"); @@ -98,7 +98,7 @@ static void expect_binary_header(const char *hdr, int binary) { } } -int main(int argc, char **argv) { +int main(int argc, char** argv) { /* Base64 test vectors from RFC 4648, with padding removed */ /* BASE64("") = "" */ EXPECT_SLICE_EQ("", B64("")); diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.cc index a2af83b6cb..a7e44abc2b 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.cc @@ -39,7 +39,7 @@ grpc_chttp2_hpack_compressor g_compressor; int g_failure = 0; -void **to_delete = NULL; +void** to_delete = NULL; size_t num_to_delete = 0; size_t cap_to_delete = 0; @@ -51,22 +51,23 @@ typedef struct { /* verify that the output generated by encoding the stream matches the hexstring passed in */ -static void verify(grpc_exec_ctx *exec_ctx, const verify_params params, - const char *expected, size_t nheaders, ...) { +static void verify(grpc_exec_ctx* exec_ctx, const verify_params params, + const char* expected, size_t nheaders, ...) { grpc_slice_buffer output; grpc_slice merged; grpc_slice expect = parse_hexstring(expected); size_t i; va_list l; - grpc_linked_mdelem *e = gpr_malloc(sizeof(*e) * nheaders); + grpc_linked_mdelem* e = + static_cast<grpc_linked_mdelem*>(gpr_malloc(sizeof(*e) * nheaders)); grpc_metadata_batch b; grpc_metadata_batch_init(&b); va_start(l, nheaders); for (i = 0; i < nheaders; i++) { - char *key = va_arg(l, char *); - char *value = va_arg(l, char *); + char* key = va_arg(l, char*); + char* value = va_arg(l, char*); if (i) { e[i - 1].next = &e[i]; e[i].prev = &e[i - 1]; @@ -89,7 +90,8 @@ static void verify(grpc_exec_ctx *exec_ctx, const verify_params params, if (cap_to_delete == num_to_delete) { cap_to_delete = GPR_MAX(2 * cap_to_delete, 1000); - to_delete = gpr_realloc(to_delete, sizeof(*to_delete) * cap_to_delete); + to_delete = static_cast<void**>( + gpr_realloc(to_delete, sizeof(*to_delete) * cap_to_delete)); } to_delete[num_to_delete++] = e; @@ -98,11 +100,11 @@ static void verify(grpc_exec_ctx *exec_ctx, const verify_params params, grpc_transport_one_way_stats stats; memset(&stats, 0, sizeof(stats)); grpc_encode_header_options hopt = { - .stream_id = 0xdeadbeef, - .is_eof = params.eof, - .use_true_binary_metadata = params.use_true_binary_metadata, - .max_frame_size = 16384, - .stats = &stats, + 0xdeadbeef, /* stream_id */ + params.eof, /* is_eof */ + params.use_true_binary_metadata, /* use_true_binary_metadata */ + 16384, /* max_frame_size */ + &stats /* stats */ }; grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt, &output); @@ -111,8 +113,8 @@ static void verify(grpc_exec_ctx *exec_ctx, const verify_params params, grpc_metadata_batch_destroy(exec_ctx, &b); if (!grpc_slice_eq(merged, expect)) { - char *expect_str = grpc_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII); - char *got_str = grpc_dump_slice(merged, GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* expect_str = grpc_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* got_str = grpc_dump_slice(merged, GPR_DUMP_HEX | GPR_DUMP_ASCII); gpr_log(GPR_ERROR, "mismatched output for %s", expected); gpr_log(GPR_ERROR, "EXPECT: %s", expect_str); gpr_log(GPR_ERROR, "GOT: %s", got_str); @@ -125,11 +127,13 @@ static void verify(grpc_exec_ctx *exec_ctx, const verify_params params, grpc_slice_unref_internal(exec_ctx, expect); } -static void test_basic_headers(grpc_exec_ctx *exec_ctx) { +static void test_basic_headers(grpc_exec_ctx* exec_ctx) { int i; verify_params params = { - .eof = false, .use_true_binary_metadata = false, .only_intern_key = false, + false, + false, + false, }; verify(exec_ctx, params, "000005 0104 deadbeef 40 0161 0161", 1, "a", "a"); verify(exec_ctx, params, "000001 0104 deadbeef be", 1, "a", "a"); @@ -151,7 +155,7 @@ static void test_basic_headers(grpc_exec_ctx *exec_ctx) { verify(exec_ctx, params, "000004 0104 deadbeef 0f 2f 0176", 1, "a", "v"); } -static void encode_int_to_str(int i, char *p) { +static void encode_int_to_str(int i, char* p) { p[0] = (char)('a' + i % 26); i /= 26; GPR_ASSERT(i < 26); @@ -159,13 +163,15 @@ static void encode_int_to_str(int i, char *p) { p[2] = 0; } -static void test_decode_table_overflow(grpc_exec_ctx *exec_ctx) { +static void test_decode_table_overflow(grpc_exec_ctx* exec_ctx) { int i; char key[3], value[3]; - char *expect; + char* expect; verify_params params = { - .eof = false, .use_true_binary_metadata = false, .only_intern_key = false, + false, + false, + false, }; for (i = 0; i < 114; i++) { @@ -199,9 +205,9 @@ static void test_decode_table_overflow(grpc_exec_ctx *exec_ctx) { "ba"); } -static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, - const char *key, - const char *value, +static void verify_table_size_change_match_elem_size(grpc_exec_ctx* exec_ctx, + const char* key, + const char* value, bool use_true_binary) { grpc_slice_buffer output; grpc_mdelem elem = grpc_mdelem_from_slices( @@ -209,7 +215,8 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, grpc_slice_intern(grpc_slice_from_static_string(value))); size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem, use_true_binary); size_t initial_table_size = g_compressor.table_size; - grpc_linked_mdelem *e = gpr_malloc(sizeof(*e)); + grpc_linked_mdelem* e = + static_cast<grpc_linked_mdelem*>(gpr_malloc(sizeof(*e))); grpc_metadata_batch b; grpc_metadata_batch_init(&b); e[0].md = elem; @@ -223,11 +230,11 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, grpc_transport_one_way_stats stats; memset(&stats, 0, sizeof(stats)); grpc_encode_header_options hopt = { - .stream_id = 0xdeadbeef, - .is_eof = false, - .use_true_binary_metadata = use_true_binary, - .max_frame_size = 16384, - .stats = &stats}; + 0xdeadbeef, /* stream_id */ + false, /* is_eof */ + use_true_binary, /* use_true_binary_metadata */ + 16384, /* max_frame_size */ + &stats /* stats */}; grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt, &output); grpc_slice_buffer_destroy_internal(exec_ctx, &output); @@ -237,7 +244,7 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, gpr_free(e); } -static void test_encode_header_size(grpc_exec_ctx *exec_ctx) { +static void test_encode_header_size(grpc_exec_ctx* exec_ctx) { verify_table_size_change_match_elem_size(exec_ctx, "hello", "world", false); verify_table_size_change_match_elem_size(exec_ctx, "hello-bin", "world", false); @@ -245,11 +252,9 @@ static void test_encode_header_size(grpc_exec_ctx *exec_ctx) { "I_am_true_binary_value", true); } -static void test_interned_key_indexed(grpc_exec_ctx *exec_ctx) { +static void test_interned_key_indexed(grpc_exec_ctx* exec_ctx) { int i; - verify_params params = { - .eof = false, .use_true_binary_metadata = false, .only_intern_key = true, - }; + verify_params params = {false, false, true}; verify(exec_ctx, params, "000009 0104 deadbeef 40 0161 0162 0f2f 0163", 2, "a", "b", "a", "c"); for (i = 0; i < 10; i++) { @@ -258,7 +263,7 @@ static void test_interned_key_indexed(grpc_exec_ctx *exec_ctx) { } } -static void run_test(void (*test)(grpc_exec_ctx *exec_ctx), const char *name) { +static void run_test(void (*test)(grpc_exec_ctx* exec_ctx), const char* name) { gpr_log(GPR_INFO, "RUN TEST: %s", name); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_chttp2_hpack_compressor_init(&g_compressor); @@ -267,7 +272,7 @@ static void run_test(void (*test)(grpc_exec_ctx *exec_ctx), const char *name) { grpc_exec_ctx_finish(&exec_ctx); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { size_t i; grpc_test_only_set_slice_hash_seed(0); grpc_test_init(argc, argv); diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc index 03834084cb..942f25e0b7 100644 --- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c +++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc @@ -29,12 +29,12 @@ bool squelch = true; bool leak_check = true; -static void onhdr(grpc_exec_ctx *exec_ctx, void *ud, grpc_mdelem md) { +static void onhdr(grpc_exec_ctx* exec_ctx, void* ud, grpc_mdelem md) { GRPC_MDELEM_UNREF(exec_ctx, md); } -static void dont_log(gpr_log_func_args *args) {} +static void dont_log(gpr_log_func_args* args) {} -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); if (squelch) gpr_set_log_function(dont_log); grpc_init(); diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.cc index 0946c05261..434b46eb2e 100644 --- a/test/core/transport/chttp2/hpack_parser_test.c +++ b/test/core/transport/chttp2/hpack_parser_test.cc @@ -28,25 +28,27 @@ #include "test/core/util/slice_splitter.h" #include "test/core/util/test_config.h" -typedef struct { va_list args; } test_checker; +typedef struct { + va_list args; +} test_checker; -static void onhdr(grpc_exec_ctx *exec_ctx, void *ud, grpc_mdelem md) { +static void onhdr(grpc_exec_ctx* exec_ctx, void* ud, grpc_mdelem md) { const char *ekey, *evalue; - test_checker *chk = ud; - ekey = va_arg(chk->args, char *); + test_checker* chk = static_cast<test_checker*>(ud); + ekey = va_arg(chk->args, char*); GPR_ASSERT(ekey); - evalue = va_arg(chk->args, char *); + evalue = va_arg(chk->args, char*); GPR_ASSERT(evalue); GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDKEY(md), ekey) == 0); GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDVALUE(md), evalue) == 0); GRPC_MDELEM_UNREF(exec_ctx, md); } -static void test_vector(grpc_chttp2_hpack_parser *parser, - grpc_slice_split_mode mode, const char *hexstring, +static void test_vector(grpc_chttp2_hpack_parser* parser, + grpc_slice_split_mode mode, const char* hexstring, ... /* char *key, char *value */) { grpc_slice input = parse_hexstring(hexstring); - grpc_slice *slices; + grpc_slice* slices; size_t nslices; size_t i; test_checker chk; @@ -71,7 +73,7 @@ static void test_vector(grpc_chttp2_hpack_parser *parser, } gpr_free(slices); - GPR_ASSERT(NULL == va_arg(chk.args, char *)); + GPR_ASSERT(NULL == va_arg(chk.args, char*)); va_end(chk.args); } @@ -206,7 +208,7 @@ static void test_vectors(grpc_slice_split_mode mode) { grpc_exec_ctx_finish(&exec_ctx); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); test_vectors(GRPC_SLICE_SPLIT_MERGE_ALL); diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.cc index 430ece33c7..ff7c2de538 100644 --- a/test/core/transport/chttp2/hpack_table_test.c +++ b/test/core/transport/chttp2/hpack_table_test.cc @@ -31,13 +31,13 @@ #define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x) -static void assert_str(const grpc_chttp2_hptbl *tbl, grpc_slice mdstr, - const char *str) { +static void assert_str(const grpc_chttp2_hptbl* tbl, grpc_slice mdstr, + const char* str) { GPR_ASSERT(grpc_slice_str_cmp(mdstr, str) == 0); } -static void assert_index(const grpc_chttp2_hptbl *tbl, uint32_t idx, - const char *key, const char *value) { +static void assert_index(const grpc_chttp2_hptbl* tbl, uint32_t idx, + const char* key, const char* value) { grpc_mdelem md = grpc_chttp2_hptbl_lookup(tbl, idx); assert_str(tbl, GRPC_MDKEY(md), key); assert_str(tbl, GRPC_MDVALUE(md), value); @@ -119,8 +119,8 @@ static void test_static_lookup(void) { static void test_many_additions(void) { grpc_chttp2_hptbl tbl; int i; - char *key; - char *value; + char* key; + char* value; LOG_TEST("test_many_additions"); @@ -152,9 +152,9 @@ static void test_many_additions(void) { grpc_exec_ctx_finish(&exec_ctx); } -static grpc_chttp2_hptbl_find_result find_simple(grpc_chttp2_hptbl *tbl, - const char *key, - const char *value) { +static grpc_chttp2_hptbl_find_result find_simple(grpc_chttp2_hptbl* tbl, + const char* key, + const char* value) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_mdelem md = grpc_mdelem_from_slices(&exec_ctx, grpc_slice_from_copied_string(key), @@ -274,7 +274,7 @@ static void test_find(void) { grpc_exec_ctx_finish(&exec_ctx); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); test_static_lookup(); diff --git a/test/core/transport/chttp2/stream_map_test.c b/test/core/transport/chttp2/stream_map_test.cc index ae2583ab84..23a7b3f4c2 100644 --- a/test/core/transport/chttp2/stream_map_test.c +++ b/test/core/transport/chttp2/stream_map_test.cc @@ -51,10 +51,10 @@ static void test_double_deletion(void) { grpc_chttp2_stream_map_init(&map, 8); GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map)); - grpc_chttp2_stream_map_add(&map, 1, (void *)1); - GPR_ASSERT((void *)1 == grpc_chttp2_stream_map_find(&map, 1)); + grpc_chttp2_stream_map_add(&map, 1, (void*)1); + GPR_ASSERT((void*)1 == grpc_chttp2_stream_map_find(&map, 1)); GPR_ASSERT(1 == grpc_chttp2_stream_map_size(&map)); - GPR_ASSERT((void *)1 == grpc_chttp2_stream_map_delete(&map, 1)); + GPR_ASSERT((void*)1 == grpc_chttp2_stream_map_delete(&map, 1)); GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map)); GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, 1)); GPR_ASSERT(NULL == grpc_chttp2_stream_map_delete(&map, 1)); @@ -78,7 +78,7 @@ static void test_basic_add_find(uint32_t n) { grpc_chttp2_stream_map_init(&map, 8); GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map)); for (i = 1; i <= n; i++) { - grpc_chttp2_stream_map_add(&map, i, (void *)(uintptr_t)i); + grpc_chttp2_stream_map_add(&map, i, (void*)(uintptr_t)i); } GPR_ASSERT(n == grpc_chttp2_stream_map_size(&map)); GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, 0)); @@ -91,14 +91,14 @@ static void test_basic_add_find(uint32_t n) { } /* verify that for_each gets the right values during test_delete_evens_XXX */ -static void verify_for_each(void *user_data, uint32_t stream_id, void *ptr) { - uint32_t *for_each_check = user_data; +static void verify_for_each(void* user_data, uint32_t stream_id, void* ptr) { + uint32_t* for_each_check = static_cast<uint32_t*>(user_data); GPR_ASSERT(ptr); GPR_ASSERT(*for_each_check == stream_id); *for_each_check += 2; } -static void check_delete_evens(grpc_chttp2_stream_map *map, uint32_t n) { +static void check_delete_evens(grpc_chttp2_stream_map* map, uint32_t n) { uint32_t for_each_check = 1; uint32_t i; size_t got; @@ -133,12 +133,11 @@ static void test_delete_evens_sweep(uint32_t n) { grpc_chttp2_stream_map_init(&map, 8); for (i = 1; i <= n; i++) { - grpc_chttp2_stream_map_add(&map, i, (void *)(uintptr_t)i); + grpc_chttp2_stream_map_add(&map, i, (void*)(uintptr_t)i); } for (i = 1; i <= n; i++) { if ((i & 1) == 0) { - GPR_ASSERT((void *)(uintptr_t)i == - grpc_chttp2_stream_map_delete(&map, i)); + GPR_ASSERT((void*)(uintptr_t)i == grpc_chttp2_stream_map_delete(&map, i)); } } check_delete_evens(&map, n); @@ -156,7 +155,7 @@ static void test_delete_evens_incremental(uint32_t n) { grpc_chttp2_stream_map_init(&map, 8); for (i = 1; i <= n; i++) { - grpc_chttp2_stream_map_add(&map, i, (void *)(uintptr_t)i); + grpc_chttp2_stream_map_add(&map, i, (void*)(uintptr_t)i); if ((i & 1) == 0) { grpc_chttp2_stream_map_delete(&map, i); } @@ -178,10 +177,10 @@ static void test_periodic_compaction(uint32_t n) { grpc_chttp2_stream_map_init(&map, 16); GPR_ASSERT(map.capacity == 16); for (i = 1; i <= n; i++) { - grpc_chttp2_stream_map_add(&map, i, (void *)(uintptr_t)i); + grpc_chttp2_stream_map_add(&map, i, (void*)(uintptr_t)i); if (i > 8) { del = i - 8; - GPR_ASSERT((void *)(uintptr_t)del == + GPR_ASSERT((void*)(uintptr_t)del == grpc_chttp2_stream_map_delete(&map, del)); } } @@ -189,7 +188,7 @@ static void test_periodic_compaction(uint32_t n) { grpc_chttp2_stream_map_destroy(&map); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { uint32_t n = 1; uint32_t prev = 1; uint32_t tmp; diff --git a/test/core/transport/chttp2/varint_test.c b/test/core/transport/chttp2/varint_test.cc index 0986a2cde6..413b461b3a 100644 --- a/test/core/transport/chttp2/varint_test.c +++ b/test/core/transport/chttp2/varint_test.cc @@ -24,7 +24,7 @@ #include "test/core/util/test_config.h" static void test_varint(uint32_t value, uint32_t prefix_bits, uint8_t prefix_or, - const char *expect_bytes, size_t expect_length) { + const char* expect_bytes, size_t expect_length) { uint32_t nbytes = GRPC_CHTTP2_VARINT_LENGTH(value, prefix_bits); grpc_slice expect = grpc_slice_from_copied_buffer(expect_bytes, expect_length); @@ -42,7 +42,7 @@ static void test_varint(uint32_t value, uint32_t prefix_bits, uint8_t prefix_or, #define TEST_VARINT(value, prefix_bits, prefix_or, expect) \ test_varint(value, prefix_bits, prefix_or, expect, sizeof(expect) - 1) -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); TEST_VARINT(0, 1, 0, "\x00"); TEST_VARINT(128, 1, 0, "\x7f\x01"); diff --git a/test/core/transport/connectivity_state_test.c b/test/core/transport/connectivity_state_test.cc index 4ef8683107..8cd7b30b66 100644 --- a/test/core/transport/connectivity_state_test.c +++ b/test/core/transport/connectivity_state_test.cc @@ -24,18 +24,18 @@ #include "test/core/util/test_config.h" -#define THE_ARG ((void *)(size_t)0xcafebabe) +#define THE_ARG ((void*)(size_t)0xcafebabe) int g_counter; -static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { +static void must_succeed(grpc_exec_ctx* exec_ctx, void* arg, + grpc_error* error) { GPR_ASSERT(error == GRPC_ERROR_NONE); GPR_ASSERT(arg == THE_ARG); g_counter++; } -static void must_fail(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { +static void must_fail(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { GPR_ASSERT(error != GRPC_ERROR_NONE); GPR_ASSERT(arg == THE_ARG); g_counter++; @@ -59,7 +59,7 @@ static void test_connectivity_state_name(void) { static void test_check(void) { grpc_connectivity_state_tracker tracker; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_error *error; + grpc_error* error; gpr_log(GPR_DEBUG, "test_check"); grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_IDLE, "xxx"); GPR_ASSERT(grpc_connectivity_state_get(&tracker, &error) == @@ -72,7 +72,7 @@ static void test_check(void) { static void test_subscribe_then_unsubscribe(void) { grpc_connectivity_state_tracker tracker; - grpc_closure *closure = + grpc_closure* closure = GRPC_CLOSURE_CREATE(must_fail, THE_ARG, grpc_schedule_on_exec_ctx); grpc_connectivity_state state = GRPC_CHANNEL_IDLE; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -96,7 +96,7 @@ static void test_subscribe_then_unsubscribe(void) { static void test_subscribe_then_destroy(void) { grpc_connectivity_state_tracker tracker; - grpc_closure *closure = + grpc_closure* closure = GRPC_CLOSURE_CREATE(must_succeed, THE_ARG, grpc_schedule_on_exec_ctx); grpc_connectivity_state state = GRPC_CHANNEL_IDLE; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -116,7 +116,7 @@ static void test_subscribe_then_destroy(void) { static void test_subscribe_with_failure_then_destroy(void) { grpc_connectivity_state_tracker tracker; - grpc_closure *closure = + grpc_closure* closure = GRPC_CLOSURE_CREATE(must_fail, THE_ARG, grpc_schedule_on_exec_ctx); grpc_connectivity_state state = GRPC_CHANNEL_SHUTDOWN; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -134,7 +134,7 @@ static void test_subscribe_with_failure_then_destroy(void) { GPR_ASSERT(g_counter == 1); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_connectivity_state_trace.value = 1; test_connectivity_state_name(); diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.cc index f7124d29a7..b60a9619fb 100644 --- a/test/core/transport/metadata_test.c +++ b/test/core/transport/metadata_test.cc @@ -114,7 +114,8 @@ static void test_create_many_ephemeral_metadata(bool intern_keys, static void test_create_many_persistant_metadata(void) { char buffer[GPR_LTOA_MIN_BUFSIZE]; long i; - grpc_mdelem *created = gpr_malloc(sizeof(grpc_mdelem) * MANY); + grpc_mdelem* created = + static_cast<grpc_mdelem*>(gpr_malloc(sizeof(grpc_mdelem) * MANY)); grpc_mdelem md; gpr_log(GPR_INFO, "test_create_many_persistant_metadata"); @@ -224,10 +225,11 @@ static void test_identity_laws(bool intern_keys, bool intern_values) { static void test_things_stick_around(void) { size_t i, j; - char *buffer; + char* buffer; size_t nstrs = 1000; - grpc_slice *strs = gpr_malloc(sizeof(grpc_slice) * nstrs); - size_t *shuf = gpr_malloc(sizeof(size_t) * nstrs); + grpc_slice* strs = + static_cast<grpc_slice*>(gpr_malloc(sizeof(grpc_slice) * nstrs)); + size_t* shuf = static_cast<size_t*>(gpr_malloc(sizeof(size_t) * nstrs)); grpc_slice test; gpr_log(GPR_INFO, "test_things_stick_around"); @@ -274,16 +276,16 @@ static void test_things_stick_around(void) { } static void test_user_data_works(void) { - int *ud1; - int *ud2; + int* ud1; + int* ud2; grpc_mdelem md; gpr_log(GPR_INFO, "test_user_data_works"); grpc_init(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - ud1 = gpr_malloc(sizeof(int)); + ud1 = static_cast<int*>(gpr_malloc(sizeof(int))); *ud1 = 1; - ud2 = gpr_malloc(sizeof(int)); + ud2 = static_cast<int*>(gpr_malloc(sizeof(int))); *ud2 = 2; md = grpc_mdelem_from_slices( &exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc")), @@ -296,8 +298,8 @@ static void test_user_data_works(void) { grpc_shutdown(); } -static void verify_ascii_header_size(grpc_exec_ctx *exec_ctx, const char *key, - const char *value, bool intern_key, +static void verify_ascii_header_size(grpc_exec_ctx* exec_ctx, const char* key, + const char* value, bool intern_key, bool intern_value) { grpc_mdelem elem = grpc_mdelem_from_slices( exec_ctx, maybe_intern(grpc_slice_from_static_string(key), intern_key), @@ -308,8 +310,8 @@ static void verify_ascii_header_size(grpc_exec_ctx *exec_ctx, const char *key, GRPC_MDELEM_UNREF(exec_ctx, elem); } -static void verify_binary_header_size(grpc_exec_ctx *exec_ctx, const char *key, - const uint8_t *value, size_t value_len, +static void verify_binary_header_size(grpc_exec_ctx* exec_ctx, const char* key, + const uint8_t* value, size_t value_len, bool intern_key, bool intern_value) { grpc_mdelem elem = grpc_mdelem_from_slices( exec_ctx, maybe_intern(grpc_slice_from_static_string(key), intern_key), @@ -318,7 +320,7 @@ static void verify_binary_header_size(grpc_exec_ctx *exec_ctx, const char *key, GPR_ASSERT(grpc_is_binary_header(GRPC_MDKEY(elem))); size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem, false); grpc_slice value_slice = - grpc_slice_from_copied_buffer((const char *)value, value_len); + grpc_slice_from_copied_buffer((const char*)value, value_len); grpc_slice base64_encoded = grpc_chttp2_base64_encode(value_slice); size_t expected_size = 32 + strlen(key) + GRPC_SLICE_LENGTH(base64_encoded); GPR_ASSERT(expected_size == elem_size); @@ -382,7 +384,7 @@ static void test_copied_static_metadata(bool dup_key, bool dup_value) { grpc_shutdown(); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); test_no_op(); for (int k = 0; k <= 1; k++) { diff --git a/test/core/transport/status_conversion_test.c b/test/core/transport/status_conversion_test.cc index 02dad86693..7af5d12cb7 100644 --- a/test/core/transport/status_conversion_test.c +++ b/test/core/transport/status_conversion_test.cc @@ -34,7 +34,7 @@ #define HTTP2_STATUS_TO_GRPC_STATUS(a, b) \ GPR_ASSERT(grpc_http2_status_to_grpc_status(a) == (b)) -int main(int argc, char **argv) { +int main(int argc, char** argv) { int i; grpc_test_init(argc, argv); diff --git a/test/core/transport/stream_owned_slice_test.c b/test/core/transport/stream_owned_slice_test.cc index 774ad4e72e..0b592a0496 100644 --- a/test/core/transport/stream_owned_slice_test.c +++ b/test/core/transport/stream_owned_slice_test.cc @@ -22,9 +22,9 @@ #include <grpc/support/log.h> -static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {} +static void do_nothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {} -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); uint8_t buffer[] = "abc123"; diff --git a/test/core/transport/timeout_encoding_test.c b/test/core/transport/timeout_encoding_test.cc index 30357faed3..0930bc836d 100644 --- a/test/core/transport/timeout_encoding_test.c +++ b/test/core/transport/timeout_encoding_test.cc @@ -31,7 +31,7 @@ #define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x) -static void assert_encodes_as(grpc_millis ts, const char *s) { +static void assert_encodes_as(grpc_millis ts, const char* s) { char buffer[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE]; grpc_http2_encode_timeout(ts, buffer); gpr_log(GPR_INFO, "check '%s' == '%s'", buffer, s); @@ -63,7 +63,7 @@ void test_encoding(void) { assert_encodes_as(10 * 60 * 60 * GPR_MS_PER_SEC, "10H"); } -static void assert_decodes_as(const char *buffer, grpc_millis expected) { +static void assert_decodes_as(const char* buffer, grpc_millis expected) { grpc_millis got; uint32_t hash = gpr_murmur_hash3(buffer, strlen(buffer), 0); gpr_log(GPR_INFO, "check decoding '%s' (hash=0x%x)", buffer, hash); @@ -81,7 +81,7 @@ void decode_suite(char ext, grpc_millis (*answer)(int64_t x)) { 1234567, 12345678, 123456789, 98765432, 9876543, 987654, 98765, 9876, 987, 98, 9}; unsigned i; - char *input; + char* input; for (i = 0; i < GPR_ARRAY_SIZE(test_vals); i++) { gpr_asprintf(&input, "%ld%c", test_vals[i], ext); assert_decodes_as(input, answer(test_vals[i])); @@ -133,7 +133,7 @@ void test_decoding(void) { assert_decodes_as("9999999999S", GRPC_MILLIS_INF_FUTURE); } -static void assert_decoding_fails(const char *s) { +static void assert_decoding_fails(const char* s) { grpc_millis x; GPR_ASSERT(0 == grpc_http2_decode_timeout(grpc_slice_from_static_string(s), &x)); @@ -152,7 +152,7 @@ void test_decoding_fails(void) { assert_decoding_fails("-1u"); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_test_init(argc, argv); test_encoding(); test_decoding(); |