aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/surface
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-06-30 17:17:23 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-06-30 17:30:08 -0700
commit6721d4f0f18c71f5e4ab1cef904944185ed86b89 (patch)
tree6b3b3ff93eba1bb9290ca44e4cdfc67dd60286ae /test/core/surface
parenta5596db1a53723789d7c90c23d9cbfbb8207f949 (diff)
Return success status of grpc_byte_buffer_reader
Diffstat (limited to 'test/core/surface')
-rw-r--r--test/core/surface/byte_buffer_reader_test.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.c
index 9c6734e179..1c779a8a84 100644
--- a/test/core/surface/byte_buffer_reader_test.c
+++ b/test/core/surface/byte_buffer_reader_test.c
@@ -59,7 +59,8 @@ static void test_read_one_slice(void) {
slice = gpr_slice_from_copied_string("test");
buffer = grpc_raw_byte_buffer_create(&slice, 1);
gpr_slice_unref(slice);
- grpc_byte_buffer_reader_init(&reader, buffer);
+ GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
+ "Couldn't init byte buffer reader");
first_code = grpc_byte_buffer_reader_next(&reader, &first_slice);
GPR_ASSERT(first_code != 0);
GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(first_slice), "test", 4) == 0);
@@ -81,7 +82,8 @@ static void test_read_one_slice_malloc(void) {
memcpy(GPR_SLICE_START_PTR(slice), "test", 4);
buffer = grpc_raw_byte_buffer_create(&slice, 1);
gpr_slice_unref(slice);
- grpc_byte_buffer_reader_init(&reader, buffer);
+ GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
+ "Couldn't init byte buffer reader");
first_code = grpc_byte_buffer_reader_next(&reader, &first_slice);
GPR_ASSERT(first_code != 0);
GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(first_slice), "test", 4) == 0);
@@ -102,7 +104,8 @@ static void test_read_none_compressed_slice(void) {
slice = gpr_slice_from_copied_string("test");
buffer = grpc_raw_byte_buffer_create(&slice, 1);
gpr_slice_unref(slice);
- grpc_byte_buffer_reader_init(&reader, buffer);
+ GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
+ "Couldn't init byte buffer reader");
first_code = grpc_byte_buffer_reader_next(&reader, &first_slice);
GPR_ASSERT(first_code != 0);
GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(first_slice), "test", 4) == 0);
@@ -132,7 +135,8 @@ static void read_compressed_slice(grpc_compression_algorithm algorithm,
buffer = grpc_raw_compressed_byte_buffer_create(sliceb_out.slices,
sliceb_out.count, algorithm);
- grpc_byte_buffer_reader_init(&reader, buffer);
+ GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
+ "Couldn't init byte buffer reader");
while (grpc_byte_buffer_reader_next(&reader, &read_slice)) {
GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(read_slice),
@@ -170,7 +174,8 @@ static void test_byte_buffer_from_reader(void) {
memcpy(GPR_SLICE_START_PTR(slice), "test", 4);
buffer = grpc_raw_byte_buffer_create(&slice, 1);
gpr_slice_unref(slice);
- grpc_byte_buffer_reader_init(&reader, buffer);
+ GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
+ "Couldn't init byte buffer reader");
buffer_from_reader = grpc_raw_byte_buffer_from_reader(&reader);
GPR_ASSERT(buffer->type == buffer_from_reader->type);
@@ -206,7 +211,8 @@ static void test_readall(void) {
gpr_slice_unref(slices[0]);
gpr_slice_unref(slices[1]);
- grpc_byte_buffer_reader_init(&reader, buffer);
+ GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
+ "Couldn't init byte buffer reader");
slice_out = grpc_byte_buffer_reader_readall(&reader);
GPR_ASSERT(GPR_SLICE_LENGTH(slice_out) == 512 + 1024);
@@ -241,7 +247,8 @@ static void test_byte_buffer_copy(void) {
gpr_slice_unref(slices[1]);
copied_buffer = grpc_byte_buffer_copy(buffer);
- grpc_byte_buffer_reader_init(&reader, copied_buffer);
+ GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
+ "Couldn't init byte buffer reader");
slice_out = grpc_byte_buffer_reader_readall(&reader);
GPR_ASSERT(GPR_SLICE_LENGTH(slice_out) == 512 + 1024);