|
|
|
@ -115,6 +115,20 @@ static void test_read_none_compressed_slice(void) { |
|
|
|
|
grpc_byte_buffer_destroy(buffer); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void test_read_corrupted_slice(void) { |
|
|
|
|
gpr_slice slice; |
|
|
|
|
grpc_byte_buffer *buffer; |
|
|
|
|
grpc_byte_buffer_reader reader; |
|
|
|
|
|
|
|
|
|
LOG_TEST(__func__); |
|
|
|
|
slice = gpr_slice_from_copied_string("test"); |
|
|
|
|
buffer = grpc_raw_byte_buffer_create(&slice, 1); |
|
|
|
|
buffer->data.raw.compression = GRPC_COMPRESS_GZIP; /* lies! */ |
|
|
|
|
gpr_slice_unref(slice); |
|
|
|
|
GPR_ASSERT(!grpc_byte_buffer_reader_init(&reader, buffer)); |
|
|
|
|
grpc_byte_buffer_destroy(buffer); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void read_compressed_slice(grpc_compression_algorithm algorithm, |
|
|
|
|
size_t input_size) { |
|
|
|
|
gpr_slice input_slice; |
|
|
|
@ -267,6 +281,7 @@ int main(int argc, char **argv) { |
|
|
|
|
test_read_none_compressed_slice(); |
|
|
|
|
test_read_gzip_compressed_slice(); |
|
|
|
|
test_read_deflate_compressed_slice(); |
|
|
|
|
test_read_corrupted_slice(); |
|
|
|
|
test_byte_buffer_from_reader(); |
|
|
|
|
test_byte_buffer_copy(); |
|
|
|
|
test_readall(); |
|
|
|
|