diff options
Diffstat (limited to 'test/core/compression')
-rw-r--r-- | test/core/compression/algorithm_test.c | 42 | ||||
-rw-r--r-- | test/core/compression/compression_test.c | 4 | ||||
-rw-r--r-- | test/core/compression/message_compress_test.c | 2 |
3 files changed, 22 insertions, 26 deletions
diff --git a/test/core/compression/algorithm_test.c b/test/core/compression/algorithm_test.c index 37397ced8d..ff17667b94 100644 --- a/test/core/compression/algorithm_test.c +++ b/test/core/compression/algorithm_test.c @@ -40,7 +40,6 @@ #include <grpc/support/log.h> #include <grpc/support/useful.h> -#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/transport/static_metadata.h" #include "test/core/util/test_config.h" @@ -52,33 +51,32 @@ static void test_algorithm_mesh(void) { for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) { char *name; grpc_compression_algorithm parsed; - grpc_slice mdstr; - grpc_mdelem mdelem; + grpc_mdstr *mdstr; + grpc_mdelem *mdelem; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GPR_ASSERT( grpc_compression_algorithm_name((grpc_compression_algorithm)i, &name)); - GPR_ASSERT(grpc_compression_algorithm_parse( - grpc_slice_from_static_string(name), &parsed)); + GPR_ASSERT(grpc_compression_algorithm_parse(name, strlen(name), &parsed)); GPR_ASSERT((int)parsed == i); - mdstr = grpc_slice_from_copied_string(name); - GPR_ASSERT(grpc_slice_eq(mdstr, grpc_compression_algorithm_slice(parsed))); - GPR_ASSERT(parsed == grpc_compression_algorithm_from_slice(mdstr)); + mdstr = grpc_mdstr_from_string(name); + GPR_ASSERT(mdstr == grpc_compression_algorithm_mdstr(parsed)); + GPR_ASSERT(parsed == grpc_compression_algorithm_from_mdstr(mdstr)); mdelem = grpc_compression_encoding_mdelem(parsed); - GPR_ASSERT(grpc_slice_eq(GRPC_MDVALUE(mdelem), mdstr)); - GPR_ASSERT(grpc_slice_eq(GRPC_MDKEY(mdelem), GRPC_MDSTR_GRPC_ENCODING)); - grpc_slice_unref_internal(&exec_ctx, mdstr); + GPR_ASSERT(mdelem->value == mdstr); + GPR_ASSERT(mdelem->key == GRPC_MDSTR_GRPC_ENCODING); + GRPC_MDSTR_UNREF(&exec_ctx, mdstr); GRPC_MDELEM_UNREF(&exec_ctx, mdelem); grpc_exec_ctx_finish(&exec_ctx); } /* test failure */ - GPR_ASSERT(GRPC_MDISNULL( - grpc_compression_encoding_mdelem(GRPC_COMPRESS_ALGORITHMS_COUNT))); + GPR_ASSERT(NULL == + grpc_compression_encoding_mdelem(GRPC_COMPRESS_ALGORITHMS_COUNT)); } static void test_algorithm_failure(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_slice mdstr; + grpc_mdstr *mdstr; gpr_log(GPR_DEBUG, "test_algorithm_failure"); @@ -86,16 +84,14 @@ static void test_algorithm_failure(void) { NULL) == 0); GPR_ASSERT(grpc_compression_algorithm_name(GRPC_COMPRESS_ALGORITHMS_COUNT + 1, NULL) == 0); - mdstr = grpc_slice_from_static_string("this-is-an-invalid-algorithm"); - GPR_ASSERT(grpc_compression_algorithm_from_slice(mdstr) == + mdstr = grpc_mdstr_from_string("this-is-an-invalid-algorithm"); + GPR_ASSERT(grpc_compression_algorithm_from_mdstr(mdstr) == GRPC_COMPRESS_ALGORITHMS_COUNT); - GPR_ASSERT(grpc_slice_eq( - grpc_compression_algorithm_slice(GRPC_COMPRESS_ALGORITHMS_COUNT), - grpc_empty_slice())); - GPR_ASSERT(grpc_slice_eq( - grpc_compression_algorithm_slice(GRPC_COMPRESS_ALGORITHMS_COUNT + 1), - grpc_empty_slice())); - grpc_slice_unref_internal(&exec_ctx, mdstr); + GPR_ASSERT(grpc_compression_algorithm_mdstr(GRPC_COMPRESS_ALGORITHMS_COUNT) == + NULL); + GPR_ASSERT(grpc_compression_algorithm_mdstr(GRPC_COMPRESS_ALGORITHMS_COUNT + + 1) == NULL); + GRPC_MDSTR_UNREF(&exec_ctx, mdstr); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/compression/compression_test.c b/test/core/compression/compression_test.c index 7b2e56dc01..4c43746e33 100644 --- a/test/core/compression/compression_test.c +++ b/test/core/compression/compression_test.c @@ -54,7 +54,7 @@ static void test_compression_algorithm_parse(void) { 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); + valid_name, strlen(valid_name), &algorithm); GPR_ASSERT(success != 0); GPR_ASSERT(algorithm == valid_algorithms[i]); } @@ -64,7 +64,7 @@ static void test_compression_algorithm_parse(void) { grpc_compression_algorithm algorithm; int success; success = grpc_compression_algorithm_parse( - grpc_slice_from_static_string(invalid_name), &algorithm); + invalid_name, strlen(invalid_name), &algorithm); GPR_ASSERT(success == 0); /* the value of "algorithm" is undefined upon failure */ } diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.c index 246a2b3a71..2432ca768a 100644 --- a/test/core/compression/message_compress_test.c +++ b/test/core/compression/message_compress_test.c @@ -114,7 +114,7 @@ static void assert_passthrough(grpc_slice value, } final = grpc_slice_merge(output.slices, output.count); - GPR_ASSERT(grpc_slice_eq(value, final)); + GPR_ASSERT(0 == grpc_slice_cmp(value, final)); grpc_slice_buffer_destroy(&input); grpc_slice_buffer_destroy(&compressed); |