aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/slice
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-12-06 18:52:18 -0800
committerGravatar Muxi Yan <mxyan@google.com>2017-12-06 18:55:05 -0800
commit38fcd0c6c3e70e516d1e4dcbfd9cdfe9654f4b0f (patch)
tree531100570cfbe084b31e65facc1c49dae5434f52 /test/core/slice
parentf5eb1cf9f0e832a2a6d301cc7adeec22e79ef903 (diff)
clang-format
Diffstat (limited to 'test/core/slice')
-rw-r--r--test/core/slice/b64_test.c18
-rw-r--r--test/core/slice/percent_decode_fuzzer.c4
-rw-r--r--test/core/slice/percent_encode_fuzzer.c6
-rw-r--r--test/core/slice/percent_encoding_test.c28
-rw-r--r--test/core/slice/slice_buffer_test.c2
-rw-r--r--test/core/slice/slice_string_helpers_test.c14
-rw-r--r--test/core/slice/slice_test.c10
7 files changed, 41 insertions, 41 deletions
diff --git a/test/core/slice/b64_test.c b/test/core/slice/b64_test.c
index bd375aa6a7..479198f9f9 100644
--- a/test/core/slice/b64_test.c
+++ b/test/core/slice/b64_test.c
@@ -27,8 +27,8 @@
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/test_config.h"
-static int buffers_are_equal(const unsigned char *buf1,
- const unsigned char *buf2, size_t size) {
+static int buffers_are_equal(const unsigned char* buf1,
+ const unsigned char* buf2, size_t size) {
size_t i;
for (i = 0; i < size; i++) {
if (buf1[i] != buf2[i]) {
@@ -41,13 +41,13 @@ static int buffers_are_equal(const unsigned char *buf1,
}
static void test_simple_encode_decode_b64(int url_safe, int multiline) {
- const char *hello = "hello";
- char *hello_b64 =
+ const char* hello = "hello";
+ char* hello_b64 =
grpc_base64_encode(hello, strlen(hello), url_safe, multiline);
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_slice hello_slice = grpc_base64_decode(&exec_ctx, hello_b64, url_safe);
GPR_ASSERT(GRPC_SLICE_LENGTH(hello_slice) == strlen(hello));
- GPR_ASSERT(strncmp((const char *)GRPC_SLICE_START_PTR(hello_slice), hello,
+ GPR_ASSERT(strncmp((const char*)GRPC_SLICE_START_PTR(hello_slice), hello,
GRPC_SLICE_LENGTH(hello_slice)) == 0);
grpc_slice_unref_internal(&exec_ctx, hello_slice);
@@ -58,7 +58,7 @@ static void test_simple_encode_decode_b64(int url_safe, int multiline) {
static void test_full_range_encode_decode_b64(int url_safe, int multiline) {
unsigned char orig[256];
size_t i;
- char *b64;
+ char* b64;
grpc_slice orig_decoded;
for (i = 0; i < sizeof(orig); i++) orig[i] = (uint8_t)i;
@@ -111,7 +111,7 @@ static void test_full_range_encode_decode_b64_urlsafe_multiline(void) {
static void test_url_safe_unsafe_mismatch_failure(void) {
unsigned char orig[256];
size_t i;
- char *b64;
+ char* b64;
grpc_slice orig_decoded;
int url_safe = 1;
for (i = 0; i < sizeof(orig); i++) orig[i] = (uint8_t)i;
@@ -132,7 +132,7 @@ static void test_url_safe_unsafe_mismatch_failure(void) {
}
static void test_rfc4648_test_vectors(void) {
- char *b64;
+ char* b64;
b64 = grpc_base64_encode("", 0, 0, 0);
GPR_ASSERT(strcmp("", b64) == 0);
@@ -202,7 +202,7 @@ static void test_unpadded_decode(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_simple_encode_decode_b64_no_multiline();
test_simple_encode_decode_b64_multiline();
diff --git a/test/core/slice/percent_decode_fuzzer.c b/test/core/slice/percent_decode_fuzzer.c
index ad4e3fed7a..e6458736d3 100644
--- a/test/core/slice/percent_decode_fuzzer.c
+++ b/test/core/slice/percent_decode_fuzzer.c
@@ -29,10 +29,10 @@
bool squelch = true;
bool leak_check = true;
-int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
struct grpc_memory_counters counters;
grpc_memory_counters_init();
- grpc_slice input = grpc_slice_from_copied_buffer((const char *)data, size);
+ grpc_slice input = grpc_slice_from_copied_buffer((const char*)data, size);
grpc_slice output;
if (grpc_strict_percent_decode_slice(
input, grpc_url_percent_encoding_unreserved_bytes, &output)) {
diff --git a/test/core/slice/percent_encode_fuzzer.c b/test/core/slice/percent_encode_fuzzer.c
index db3dc3bb3f..776a998e51 100644
--- a/test/core/slice/percent_encode_fuzzer.c
+++ b/test/core/slice/percent_encode_fuzzer.c
@@ -29,10 +29,10 @@
bool squelch = true;
bool leak_check = true;
-static void test(const uint8_t *data, size_t size, const uint8_t *dict) {
+static void test(const uint8_t* data, size_t size, const uint8_t* dict) {
struct grpc_memory_counters counters;
grpc_memory_counters_init();
- grpc_slice input = grpc_slice_from_copied_buffer((const char *)data, size);
+ grpc_slice input = grpc_slice_from_copied_buffer((const char*)data, size);
grpc_slice output = grpc_percent_encode_slice(input, dict);
grpc_slice decoded_output;
// encoder must always produce decodable output
@@ -51,7 +51,7 @@ static void test(const uint8_t *data, size_t size, const uint8_t *dict) {
GPR_ASSERT(counters.total_size_relative == 0);
}
-int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
test(data, size, grpc_url_percent_encoding_unreserved_bytes);
test(data, size, grpc_compatible_percent_encoding_unreserved_bytes);
return 0;
diff --git a/test/core/slice/percent_encoding_test.c b/test/core/slice/percent_encoding_test.c
index fcc8d33db3..253240faad 100644
--- a/test/core/slice/percent_encoding_test.c
+++ b/test/core/slice/percent_encoding_test.c
@@ -33,10 +33,10 @@
permissive_unencoded, \
sizeof(permissive_unencoded) - 1, dict)
-static void test_vector(const char *raw, size_t raw_length, const char *encoded,
- size_t encoded_length, const uint8_t *dict) {
- char *raw_msg = gpr_dump(raw, raw_length, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *encoded_msg =
+static void test_vector(const char* raw, size_t raw_length, const char* encoded,
+ size_t encoded_length, const uint8_t* dict) {
+ char* raw_msg = gpr_dump(raw, raw_length, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char* encoded_msg =
gpr_dump(encoded, encoded_length, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "Trial:\nraw = %s\nencoded = %s", raw_msg, encoded_msg);
gpr_free(raw_msg);
@@ -52,11 +52,11 @@ static void test_vector(const char *raw, size_t raw_length, const char *encoded,
grpc_slice encoded2raw_permissive_slice =
grpc_permissive_percent_decode_slice(encoded_slice);
- char *raw2encoded_msg =
+ char* raw2encoded_msg =
grpc_dump_slice(raw2encoded_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *encoded2raw_msg =
+ char* encoded2raw_msg =
grpc_dump_slice(encoded2raw_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *encoded2raw_permissive_msg = grpc_dump_slice(
+ char* encoded2raw_permissive_msg = grpc_dump_slice(
encoded2raw_permissive_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG,
"Result:\nraw2encoded = %s\nencoded2raw = %s\nencoded2raw_permissive "
@@ -77,15 +77,15 @@ static void test_vector(const char *raw, size_t raw_length, const char *encoded,
grpc_slice_unref(encoded_slice);
}
-static void test_nonconformant_vector(const char *encoded,
+static void test_nonconformant_vector(const char* encoded,
size_t encoded_length,
- const char *permissive_unencoded,
+ const char* permissive_unencoded,
size_t permissive_unencoded_length,
- const uint8_t *dict) {
- char *permissive_unencoded_msg =
+ const uint8_t* dict) {
+ char* permissive_unencoded_msg =
gpr_dump(permissive_unencoded, permissive_unencoded_length,
GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *encoded_msg =
+ char* encoded_msg =
gpr_dump(encoded, encoded_length, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "Trial:\nraw = %s\nencoded = %s", permissive_unencoded_msg,
encoded_msg);
@@ -102,7 +102,7 @@ static void test_nonconformant_vector(const char *encoded,
grpc_slice encoded2raw_permissive_slice =
grpc_permissive_percent_decode_slice(encoded_slice);
- char *encoded2raw_permissive_msg = grpc_dump_slice(
+ char* encoded2raw_permissive_msg = grpc_dump_slice(
encoded2raw_permissive_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "Result:\nencoded2raw_permissive = %s",
encoded2raw_permissive_msg);
@@ -116,7 +116,7 @@ static void test_nonconformant_vector(const char *encoded,
grpc_slice_unref(encoded_slice);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
TEST_VECTOR(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~",
diff --git a/test/core/slice/slice_buffer_test.c b/test/core/slice/slice_buffer_test.c
index 2fba496bd0..338e8079dc 100644
--- a/test/core/slice/slice_buffer_test.c
+++ b/test/core/slice/slice_buffer_test.c
@@ -104,7 +104,7 @@ void test_slice_buffer_move_first() {
GPR_ASSERT(dst.length == dst_len);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
test_slice_buffer_add();
diff --git a/test/core/slice/slice_string_helpers_test.c b/test/core/slice/slice_string_helpers_test.c
index 48f3701c0a..f59cec84eb 100644
--- a/test/core/slice/slice_string_helpers_test.c
+++ b/test/core/slice/slice_string_helpers_test.c
@@ -34,16 +34,16 @@
#define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x)
static void expect_slice_dump(grpc_slice slice, uint32_t flags,
- const char *result) {
- char *got = grpc_dump_slice(slice, flags);
+ const char* result) {
+ char* got = grpc_dump_slice(slice, flags);
GPR_ASSERT(0 == strcmp(got, result));
gpr_free(got);
grpc_slice_unref(slice);
}
static void test_dump_slice(void) {
- static const char *text = "HELLO WORLD!";
- static const char *long_text =
+ static const char* text = "HELLO WORLD!";
+ static const char* long_text =
"It was a bright cold day in April, and the clocks were striking "
"thirteen. Winston Smith, his chin nuzzled into his breast in an effort "
"to escape the vile wind, slipped quickly through the glass doors of "
@@ -62,7 +62,7 @@ static void test_dump_slice(void) {
}
static void test_strsplit(void) {
- grpc_slice_buffer *parts;
+ grpc_slice_buffer* parts;
grpc_slice str;
LOG_TEST_NAME("test_strsplit");
@@ -128,7 +128,7 @@ static void test_strsplit(void) {
}
static void test_strsplit_nospace(void) {
- grpc_slice_buffer *parts;
+ grpc_slice_buffer* parts;
grpc_slice str;
LOG_TEST_NAME("test_strsplit_nospace");
@@ -193,7 +193,7 @@ static void test_strsplit_nospace(void) {
gpr_free(parts);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
test_dump_slice();
test_strsplit();
diff --git a/test/core/slice/slice_test.c b/test/core/slice/slice_test.c
index cda37fb8d9..0a069c9ef9 100644
--- a/test/core/slice/slice_test.c
+++ b/test/core/slice/slice_test.c
@@ -64,7 +64,7 @@ static void test_slice_malloc_returns_something_sensible(void) {
}
}
-static void do_nothing(void *ignored) {}
+static void do_nothing(void* ignored) {}
static void test_slice_new_returns_something_sensible(void) {
uint8_t x;
@@ -77,7 +77,7 @@ static void test_slice_new_returns_something_sensible(void) {
}
/* destroy function that sets a mark to indicate it was called. */
-static void set_mark(void *p) { *((int *)p) = 1; }
+static void set_mark(void* p) { *((int*)p) = 1; }
static void test_slice_new_with_user_data(void) {
int marker = 0;
@@ -99,7 +99,7 @@ static void test_slice_new_with_user_data(void) {
static int do_nothing_with_len_1_calls = 0;
-static void do_nothing_with_len_1(void *ignored, size_t len) {
+static void do_nothing_with_len_1(void* ignored, size_t len) {
GPR_ASSERT(len == 1);
do_nothing_with_len_1_calls++;
}
@@ -228,7 +228,7 @@ static void test_slice_split_tail_works(size_t length) {
}
static void test_slice_from_copied_string_works(void) {
- static const char *text = "HELLO WORLD!";
+ static const char* text = "HELLO WORLD!";
grpc_slice slice;
LOG_TEST_NAME("test_slice_from_copied_string_works");
@@ -289,7 +289,7 @@ static void test_static_slice_copy_interning(void) {
grpc_shutdown();
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
unsigned length;
grpc_test_init(argc, argv);
test_slice_malloc_returns_something_sensible();