aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/compression
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-06 14:39:17 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-06 14:43:31 -0800
commit40422d5fa621624868280094efb2f01c2cd1352b (patch)
treecbb2baa955e11c03fa004e9e0f4f3037ba3d6150 /test/core/compression
parentaae4ca01a315a69fcf182d09aea1efdfcda13d48 (diff)
parente759d2ad7abdb0702970eeccc5f033ff4b2a4c7f (diff)
Merge master
Diffstat (limited to 'test/core/compression')
-rw-r--r--test/core/compression/algorithm_test.cc4
-rw-r--r--test/core/compression/compression_test.cc14
-rw-r--r--test/core/compression/message_compress_test.cc34
-rw-r--r--test/core/compression/stream_compression_test.cc38
4 files changed, 46 insertions, 44 deletions
diff --git a/test/core/compression/algorithm_test.cc b/test/core/compression/algorithm_test.cc
index 4ca979e30f..bc3af410c5 100644
--- a/test/core/compression/algorithm_test.cc
+++ b/test/core/compression/algorithm_test.cc
@@ -35,7 +35,7 @@ static void test_algorithm_mesh(void) {
gpr_log(GPR_DEBUG, "test_algorithm_mesh");
for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
- const char *name;
+ const char* name;
grpc_compression_algorithm parsed;
grpc_slice mdstr;
grpc_mdelem mdelem;
@@ -87,7 +87,7 @@ static void test_algorithm_failure(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();
diff --git a/test/core/compression/compression_test.cc b/test/core/compression/compression_test.cc
index f4fa3a8d63..a1a9441c8d 100644
--- a/test/core/compression/compression_test.cc
+++ b/test/core/compression/compression_test.cc
@@ -28,15 +28,15 @@
static void test_compression_algorithm_parse(void) {
size_t i;
- const char *valid_names[] = {"identity", "gzip", "deflate"};
+ const char* valid_names[] = {"identity", "gzip", "deflate"};
const grpc_compression_algorithm valid_algorithms[] = {
GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_DEFLATE};
- const char *invalid_names[] = {"gzip2", "foo", "", "2gzip"};
+ const char* invalid_names[] = {"gzip2", "foo", "", "2gzip"};
gpr_log(GPR_DEBUG, "test_compression_algorithm_parse");
for (i = 0; i < GPR_ARRAY_SIZE(valid_names); i++) {
- const char *valid_name = valid_names[i];
+ const char* valid_name = valid_names[i];
grpc_compression_algorithm algorithm;
const int success = grpc_compression_algorithm_parse(
grpc_slice_from_static_string(valid_name), &algorithm);
@@ -45,7 +45,7 @@ static void test_compression_algorithm_parse(void) {
}
for (i = 0; i < GPR_ARRAY_SIZE(invalid_names); i++) {
- const char *invalid_name = invalid_names[i];
+ const char* invalid_name = invalid_names[i];
grpc_compression_algorithm algorithm;
int success;
success = grpc_compression_algorithm_parse(
@@ -57,9 +57,9 @@ static void test_compression_algorithm_parse(void) {
static void test_compression_algorithm_name(void) {
int success;
- const char *name;
+ const char* name;
size_t i;
- const char *valid_names[] = {"identity", "gzip", "deflate"};
+ const char* valid_names[] = {"identity", "gzip", "deflate"};
const grpc_compression_algorithm valid_algorithms[] = {
GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_DEFLATE};
@@ -208,7 +208,7 @@ static void test_compression_enable_disable_algorithm(void) {
}
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_init();
test_compression_algorithm_parse();
test_compression_algorithm_name();
diff --git a/test/core/compression/message_compress_test.cc b/test/core/compression/message_compress_test.cc
index 1395d42739..676415ba9d 100644
--- a/test/core/compression/message_compress_test.cc
+++ b/test/core/compression/message_compress_test.cc
@@ -49,17 +49,18 @@ static void assert_passthrough(grpc_slice value,
grpc_slice_buffer output;
grpc_slice final;
int was_compressed;
- const char *algorithm_name;
+ const char* algorithm_name;
GPR_ASSERT(grpc_compression_algorithm_name(algorithm, &algorithm_name) != 0);
- gpr_log(
- GPR_INFO, "assert_passthrough: value_length=%" PRIuPTR
- " value_hash=0x%08x "
- "algorithm='%s' uncompressed_split='%s' compressed_split='%s'",
- GRPC_SLICE_LENGTH(value), gpr_murmur_hash3(GRPC_SLICE_START_PTR(value),
- GRPC_SLICE_LENGTH(value), 0),
- algorithm_name, grpc_slice_split_mode_name(uncompressed_split_mode),
- grpc_slice_split_mode_name(compressed_split_mode));
+ gpr_log(GPR_INFO,
+ "assert_passthrough: value_length=%" PRIuPTR
+ " value_hash=0x%08x "
+ "algorithm='%s' uncompressed_split='%s' compressed_split='%s'",
+ GRPC_SLICE_LENGTH(value),
+ gpr_murmur_hash3(GRPC_SLICE_START_PTR(value),
+ GRPC_SLICE_LENGTH(value), 0),
+ algorithm_name, grpc_slice_split_mode_name(uncompressed_split_mode),
+ grpc_slice_split_mode_name(compressed_split_mode));
grpc_slice_buffer_init(&input);
grpc_slice_buffer_init(&compressed_raw);
@@ -253,10 +254,10 @@ static void test_bad_compression_algorithm(void) {
&input, &output);
GPR_ASSERT(0 == was_compressed);
- was_compressed =
- grpc_msg_compress(&exec_ctx, static_cast<grpc_compression_algorithm>(
- GRPC_COMPRESS_ALGORITHMS_COUNT + 123),
- &input, &output);
+ was_compressed = grpc_msg_compress(&exec_ctx,
+ static_cast<grpc_compression_algorithm>(
+ GRPC_COMPRESS_ALGORITHMS_COUNT + 123),
+ &input, &output);
GPR_ASSERT(0 == was_compressed);
grpc_exec_ctx_finish(&exec_ctx);
@@ -280,8 +281,9 @@ static void test_bad_decompression_algorithm(void) {
GPR_ASSERT(0 == was_decompressed);
was_decompressed =
- grpc_msg_decompress(&exec_ctx, static_cast<grpc_compression_algorithm>(
- GRPC_COMPRESS_ALGORITHMS_COUNT + 123),
+ grpc_msg_decompress(&exec_ctx,
+ static_cast<grpc_compression_algorithm>(
+ GRPC_COMPRESS_ALGORITHMS_COUNT + 123),
&input, &output);
GPR_ASSERT(0 == was_decompressed);
grpc_exec_ctx_finish(&exec_ctx);
@@ -290,7 +292,7 @@ static void test_bad_decompression_algorithm(void) {
grpc_slice_buffer_destroy(&output);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
unsigned i, j, k, m;
grpc_slice_split_mode uncompressed_split_modes[] = {
GRPC_SLICE_SPLIT_IDENTITY, GRPC_SLICE_SPLIT_ONE_BYTE};
diff --git a/test/core/compression/stream_compression_test.cc b/test/core/compression/stream_compression_test.cc
index d136408710..7cb583b88d 100644
--- a/test/core/compression/stream_compression_test.cc
+++ b/test/core/compression/stream_compression_test.cc
@@ -25,7 +25,7 @@
#include "src/core/lib/compression/stream_compression.h"
-static void generate_random_payload(char *payload, size_t size) {
+static void generate_random_payload(char* payload, size_t size) {
size_t i;
static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890";
for (i = 0; i < size - 1; ++i) {
@@ -34,8 +34,8 @@ static void generate_random_payload(char *payload, size_t size) {
payload[size - 1] = '\0';
}
-static bool slice_buffer_equals_string(grpc_slice_buffer *buf,
- const char *str) {
+static bool slice_buffer_equals_string(grpc_slice_buffer* buf,
+ const char* str) {
size_t i;
if (buf->length != strlen(str)) {
return false;
@@ -43,8 +43,8 @@ static bool slice_buffer_equals_string(grpc_slice_buffer *buf,
size_t pointer = 0;
for (i = 0; i < buf->count; i++) {
size_t slice_len = GRPC_SLICE_LENGTH(buf->slices[i]);
- if (0 != strncmp(str + pointer,
- (char *)GRPC_SLICE_START_PTR(buf->slices[i]), slice_len)) {
+ if (0 != strncmp(str + pointer, (char*)GRPC_SLICE_START_PTR(buf->slices[i]),
+ slice_len)) {
return false;
}
pointer += slice_len;
@@ -58,10 +58,10 @@ static void test_stream_compression_simple_compress_decompress() {
grpc_slice_buffer_init(&source);
grpc_slice_buffer_init(&relay);
grpc_slice_buffer_init(&sink);
- grpc_stream_compression_context *compress_ctx =
+ grpc_stream_compression_context* compress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
- grpc_stream_compression_context *decompress_ctx =
+ grpc_stream_compression_context* decompress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
@@ -91,10 +91,10 @@ test_stream_compression_simple_compress_decompress_with_output_size_constraint()
grpc_slice_buffer_init(&source);
grpc_slice_buffer_init(&relay);
grpc_slice_buffer_init(&sink);
- grpc_stream_compression_context *compress_ctx =
+ grpc_stream_compression_context* compress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
- grpc_stream_compression_context *decompress_ctx =
+ grpc_stream_compression_context* decompress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
@@ -112,7 +112,7 @@ test_stream_compression_simple_compress_decompress_with_output_size_constraint()
GPR_ASSERT(output_size == max_output_size);
GPR_ASSERT(end_of_context == false);
grpc_slice slice_recv = grpc_slice_buffer_take_first(&sink);
- char *str_recv = (char *)GRPC_SLICE_START_PTR(slice_recv);
+ char* str_recv = (char*)GRPC_SLICE_START_PTR(slice_recv);
GPR_ASSERT(GRPC_SLICE_LENGTH(slice_recv) == max_output_size);
GPR_ASSERT(0 == strncmp(test_str, str_recv, max_output_size));
grpc_slice_unref(slice_recv);
@@ -134,17 +134,17 @@ test_stream_compression_simple_compress_decompress_with_output_size_constraint()
#define LARGE_DATA_SIZE (1024 * 1024)
static void
test_stream_compression_simple_compress_decompress_with_large_data() {
- char *test_str =
- static_cast<char *>(gpr_malloc(LARGE_DATA_SIZE * sizeof(char)));
+ char* test_str =
+ static_cast<char*>(gpr_malloc(LARGE_DATA_SIZE * sizeof(char)));
generate_random_payload(test_str, LARGE_DATA_SIZE);
grpc_slice_buffer source, relay, sink;
grpc_slice_buffer_init(&source);
grpc_slice_buffer_init(&relay);
grpc_slice_buffer_init(&sink);
- grpc_stream_compression_context *compress_ctx =
+ grpc_stream_compression_context* compress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
- grpc_stream_compression_context *decompress_ctx =
+ grpc_stream_compression_context* decompress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
@@ -175,7 +175,7 @@ static void test_stream_compression_drop_context() {
grpc_slice_buffer_init(&source);
grpc_slice_buffer_init(&relay);
grpc_slice_buffer_init(&sink);
- grpc_stream_compression_context *compress_ctx =
+ grpc_stream_compression_context* compress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
@@ -208,7 +208,7 @@ static void test_stream_compression_drop_context() {
grpc_slice_unref(slice2);
grpc_slice_buffer_add(&relay, slice3);
- grpc_stream_compression_context *decompress_ctx =
+ grpc_stream_compression_context* decompress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
bool end_of_context;
@@ -244,7 +244,7 @@ static void test_stream_compression_sync_flush() {
grpc_slice_buffer_init(&source);
grpc_slice_buffer_init(&relay);
grpc_slice_buffer_init(&sink);
- grpc_stream_compression_context *compress_ctx =
+ grpc_stream_compression_context* compress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
@@ -253,7 +253,7 @@ static void test_stream_compression_sync_flush() {
~(size_t)0,
GRPC_STREAM_COMPRESSION_FLUSH_SYNC));
- grpc_stream_compression_context *decompress_ctx =
+ grpc_stream_compression_context* decompress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
bool end_of_context;
@@ -285,7 +285,7 @@ static void test_stream_compression_sync_flush() {
grpc_slice_buffer_destroy(&sink);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_init();
test_stream_compression_simple_compress_decompress();
test_stream_compression_simple_compress_decompress_with_output_size_constraint();