diff options
author | Craig Tiller <ctiller@google.com> | 2017-08-31 10:54:11 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-08-31 10:54:11 -0700 |
commit | 8fd40d5ed9303c693865ff431b7565173a4b898e (patch) | |
tree | 5d3f6ce958de74e79a8bbaf71b7eb8bbd8acfecd /test/core | |
parent | c9c78ee96c5a73234513decd398a63d48f14aa89 (diff) | |
parent | 8d51e8d17e012f81ca8e94c18f525e1781130481 (diff) |
Merge github.com:grpc/grpc into wc
Diffstat (limited to 'test/core')
56 files changed, 3842 insertions, 2305 deletions
diff --git a/test/core/bad_client/BUILD b/test/core/bad_client/BUILD index 8cc9dfa77a..99593dc5f3 100644 --- a/test/core/bad_client/BUILD +++ b/test/core/bad_client/BUILD @@ -12,14 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/bad_client") licenses(["notice"]) # Apache v2 diff --git a/test/core/bad_ssl/BUILD b/test/core/bad_ssl/BUILD index e13d43258a..0ea1520213 100644 --- a/test/core/bad_ssl/BUILD +++ b/test/core/bad_ssl/BUILD @@ -12,14 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/bad_ssl") licenses(["notice"]) # Apache v2 diff --git a/test/core/census/BUILD b/test/core/census/BUILD index 988d9a813a..24fd2807d0 100644 --- a/test/core/census/BUILD +++ b/test/core/census/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/census") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 grpc_cc_test( name = "context_test", diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD index 18dd112eb7..ef861cc5e7 100644 --- a/test/core/channel/BUILD +++ b/test/core/channel/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/channel") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 grpc_cc_test( name = "channel_args_test", diff --git a/test/core/client_channel/BUILD b/test/core/client_channel/BUILD index 7fc5b977a9..c4a93238f2 100644 --- a/test/core/client_channel/BUILD +++ b/test/core/client_channel/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/client_channel") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") diff --git a/test/core/client_channel/resolvers/BUILD b/test/core/client_channel/resolvers/BUILD index 8af4a2d5f0..0907e06623 100644 --- a/test/core/client_channel/resolvers/BUILD +++ b/test/core/client_channel/resolvers/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/client_channel_resolvers") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 grpc_cc_test( name = "dns_resolver_connectivity_test", diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c index 6e3d69c265..364e180963 100644 --- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c +++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c @@ -60,7 +60,8 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, static grpc_ares_request *my_dns_lookup_ares( grpc_exec_ctx *exec_ctx, const char *dns_server, const char *addr, const char *default_port, grpc_pollset_set *interested_parties, - grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb) { + grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb, + char **service_config_json) { gpr_mu_lock(&g_mu); GPR_ASSERT(0 == strcmp("test", addr)); grpc_error *error = GRPC_ERROR_NONE; diff --git a/test/core/compression/BUILD b/test/core/compression/BUILD index e4432b3b9d..1ab6e35f0d 100644 --- a/test/core/compression/BUILD +++ b/test/core/compression/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/compression") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 grpc_cc_test( name = "algorithm_test", diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD index 9e788bf7e5..49bfc43646 100644 --- a/test/core/end2end/BUILD +++ b/test/core/end2end/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") licenses(["notice"]) # Apache v2 -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/end2end") load(":generate_tests.bzl", "grpc_end2end_tests") diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 6a061a4e2d..3236feea56 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -130,6 +130,12 @@ extern void simple_metadata(grpc_end2end_test_config config); extern void simple_metadata_pre_init(void); extern void simple_request(grpc_end2end_test_config config); extern void simple_request_pre_init(void); +extern void stream_compression_compressed_payload(grpc_end2end_test_config config); +extern void stream_compression_compressed_payload_pre_init(void); +extern void stream_compression_payload(grpc_end2end_test_config config); +extern void stream_compression_payload_pre_init(void); +extern void stream_compression_ping_pong_streaming(grpc_end2end_test_config config); +extern void stream_compression_ping_pong_streaming_pre_init(void); extern void streaming_error_response(grpc_end2end_test_config config); extern void streaming_error_response_pre_init(void); extern void trailing_metadata(grpc_end2end_test_config config); @@ -195,6 +201,9 @@ void grpc_end2end_tests_pre_init(void) { simple_delayed_request_pre_init(); simple_metadata_pre_init(); simple_request_pre_init(); + stream_compression_compressed_payload_pre_init(); + stream_compression_payload_pre_init(); + stream_compression_ping_pong_streaming_pre_init(); streaming_error_response_pre_init(); trailing_metadata_pre_init(); workaround_cronet_compression_pre_init(); @@ -259,6 +268,9 @@ void grpc_end2end_tests(int argc, char **argv, simple_delayed_request(config); simple_metadata(config); simple_request(config); + stream_compression_compressed_payload(config); + stream_compression_payload(config); + stream_compression_ping_pong_streaming(config); streaming_error_response(config); trailing_metadata(config); workaround_cronet_compression(config); @@ -468,6 +480,18 @@ void grpc_end2end_tests(int argc, char **argv, simple_request(config); continue; } + if (0 == strcmp("stream_compression_compressed_payload", argv[i])) { + stream_compression_compressed_payload(config); + continue; + } + if (0 == strcmp("stream_compression_payload", argv[i])) { + stream_compression_payload(config); + continue; + } + if (0 == strcmp("stream_compression_ping_pong_streaming", argv[i])) { + stream_compression_ping_pong_streaming(config); + continue; + } if (0 == strcmp("streaming_error_response", argv[i])) { streaming_error_response(config); continue; diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 3fc7c3fb6c..ca9443b642 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -132,6 +132,12 @@ extern void simple_metadata(grpc_end2end_test_config config); extern void simple_metadata_pre_init(void); extern void simple_request(grpc_end2end_test_config config); extern void simple_request_pre_init(void); +extern void stream_compression_compressed_payload(grpc_end2end_test_config config); +extern void stream_compression_compressed_payload_pre_init(void); +extern void stream_compression_payload(grpc_end2end_test_config config); +extern void stream_compression_payload_pre_init(void); +extern void stream_compression_ping_pong_streaming(grpc_end2end_test_config config); +extern void stream_compression_ping_pong_streaming_pre_init(void); extern void streaming_error_response(grpc_end2end_test_config config); extern void streaming_error_response_pre_init(void); extern void trailing_metadata(grpc_end2end_test_config config); @@ -198,6 +204,9 @@ void grpc_end2end_tests_pre_init(void) { simple_delayed_request_pre_init(); simple_metadata_pre_init(); simple_request_pre_init(); + stream_compression_compressed_payload_pre_init(); + stream_compression_payload_pre_init(); + stream_compression_ping_pong_streaming_pre_init(); streaming_error_response_pre_init(); trailing_metadata_pre_init(); workaround_cronet_compression_pre_init(); @@ -263,6 +272,9 @@ void grpc_end2end_tests(int argc, char **argv, simple_delayed_request(config); simple_metadata(config); simple_request(config); + stream_compression_compressed_payload(config); + stream_compression_payload(config); + stream_compression_ping_pong_streaming(config); streaming_error_response(config); trailing_metadata(config); workaround_cronet_compression(config); @@ -476,6 +488,18 @@ void grpc_end2end_tests(int argc, char **argv, simple_request(config); continue; } + if (0 == strcmp("stream_compression_compressed_payload", argv[i])) { + stream_compression_compressed_payload(config); + continue; + } + if (0 == strcmp("stream_compression_payload", argv[i])) { + stream_compression_payload(config); + continue; + } + if (0 == strcmp("stream_compression_ping_pong_streaming", argv[i])) { + stream_compression_ping_pong_streaming(config); + continue; + } if (0 == strcmp("streaming_error_response", argv[i])) { streaming_error_response(config); continue; diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c index 9cbaaa0811..ee1d0b1416 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.c @@ -137,10 +137,11 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) { static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack( grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_credentials *ssl_creds = grpc_ssl_credentials_create(test_root_cert, NULL, NULL); - grpc_call_credentials *oauth2_creds = - grpc_md_only_test_credentials_create("authorization", oauth2_md, 1); + grpc_call_credentials *oauth2_creds = grpc_md_only_test_credentials_create( + &exec_ctx, "authorization", oauth2_md, true /* is_async */); grpc_channel_credentials *ssl_oauth2_creds = grpc_composite_channel_credentials_create(ssl_creds, oauth2_creds, NULL); grpc_arg ssl_name_override = {GRPC_ARG_STRING, @@ -149,13 +150,10 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack( grpc_channel_args *new_client_args = grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); chttp2_init_client_secure_fullstack(f, new_client_args, ssl_oauth2_creds); - { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_channel_args_destroy(&exec_ctx, new_client_args); - grpc_exec_ctx_finish(&exec_ctx); - } + grpc_channel_args_destroy(&exec_ctx, new_client_args); grpc_channel_credentials_release(ssl_creds); grpc_call_credentials_release(oauth2_creds); + grpc_exec_ctx_finish(&exec_ctx); } static int fail_server_auth_check(grpc_channel_args *server_args) { diff --git a/test/core/end2end/fuzzers/BUILD b/test/core/end2end/fuzzers/BUILD index bf3a62ad37..4ed9a70578 100644 --- a/test/core/end2end/fuzzers/BUILD +++ b/test/core/end2end/fuzzers/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/end2end/fuzzers") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index 281a1af20c..1228c9fe9a 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -34,6 +34,7 @@ #include "src/core/lib/iomgr/timer.h" #include "src/core/lib/iomgr/timer_manager.h" #include "src/core/lib/slice/slice_internal.h" +#include "src/core/lib/support/env.h" #include "src/core/lib/surface/server.h" #include "src/core/lib/transport/metadata.h" #include "test/core/end2end/data/ssl_test_data.h" @@ -415,7 +416,8 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, grpc_ares_request *my_dns_lookup_ares( grpc_exec_ctx *exec_ctx, const char *dns_server, const char *addr, const char *default_port, grpc_pollset_set *interested_parties, - grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb) { + grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb, + char **service_config_json) { addr_req *r = gpr_malloc(sizeof(*r)); r->addr = gpr_strdup(addr); r->on_done = on_done; @@ -731,7 +733,9 @@ static validator *make_finished_batch_validator(call_state *cs, int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_test_only_set_slice_hash_seed(0); - if (squelch) gpr_set_log_function(dont_log); + char *grpc_trace_fuzzer = gpr_getenv("GRPC_TRACE_FUZZER"); + if (squelch && grpc_trace_fuzzer == NULL) gpr_set_log_function(dont_log); + gpr_free(grpc_trace_fuzzer); input_stream inp = {data, data + size}; grpc_tcp_client_connect_impl = my_tcp_client_connect; gpr_now_impl = now_impl; diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-minimized-4688823906729984 b/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-minimized-4688823906729984 Binary files differnew file mode 100644 index 0000000000..a5b730382e --- /dev/null +++ b/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-minimized-4688823906729984 diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary index 2bb9de34c5..7c77512aa9 100644 --- a/test/core/end2end/fuzzers/hpack.dictionary +++ b/test/core/end2end/fuzzers/hpack.dictionary @@ -14,7 +14,10 @@ "\x0Dgrpc-tags-bin" "\x0Egrpc-trace-bin" "\x0Ccontent-type" +"\x10content-encoding" +"\x0Faccept-encoding" "\x1Egrpc-internal-encoding-request" +"%grpc-internal-stream-encoding-request" "\x0Auser-agent" "\x04host" "\x08lb-token" @@ -49,7 +52,6 @@ "\x03400" "\x03500" "\x0Eaccept-charset" -"\x0Faccept-encoding" "\x0Dgzip, deflate" "\x0Faccept-language" "\x0Daccept-ranges" @@ -60,7 +62,6 @@ "\x0Dauthorization" "\x0Dcache-control" "\x13content-disposition" -"\x10content-encoding" "\x10content-language" "\x0Econtent-length" "\x10content-location" @@ -134,6 +135,8 @@ "\x00\x0Dauthorization\x00" "\x00\x0Dcache-control\x00" "\x00\x13content-disposition\x00" +"\x00\x10content-encoding\x08identity" +"\x00\x10content-encoding\x04gzip" "\x00\x10content-encoding\x00" "\x00\x10content-language\x00" "\x00\x0Econtent-length\x00" @@ -179,3 +182,6 @@ "\x00\x14grpc-accept-encoding\x0Didentity,gzip" "\x00\x14grpc-accept-encoding\x0Cdeflate,gzip" "\x00\x14grpc-accept-encoding\x15identity,deflate,gzip" +"\x00\x0Faccept-encoding\x08identity" +"\x00\x0Faccept-encoding\x04gzip" +"\x00\x0Faccept-encoding\x0Didentity,gzip" diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c index 3ddc1ae907..ef4c0a4bfd 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.c +++ b/test/core/end2end/fuzzers/server_fuzzer.c @@ -72,8 +72,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_metadata_array_init(&request_metadata1); int requested_calls = 0; - grpc_server_request_call(server, &call1, &call_details1, &request_metadata1, - cq, cq, tag(1)); + GPR_ASSERT(GRPC_CALL_OK == + grpc_server_request_call(server, &call1, &call_details1, + &request_metadata1, cq, cq, tag(1))); requested_calls++; grpc_event ev; diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index 18bae63a8a..33fd97f3bd 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -137,6 +137,10 @@ END2END_TESTS = { 'shutdown_finishes_calls': default_test_options._replace(cpu_cost=LOWCPU), 'shutdown_finishes_tags': default_test_options._replace(cpu_cost=LOWCPU), 'simple_cacheable_request': default_test_options._replace(cpu_cost=LOWCPU), + 'stream_compression_compressed_payload': default_test_options._replace(proxyable=False, + exclude_inproc=True), + 'stream_compression_payload': default_test_options._replace(exclude_inproc=True), + 'stream_compression_ping_pong_streaming': default_test_options._replace(exclude_inproc=True), 'simple_delayed_request': connectivity_test_options, 'simple_metadata': default_test_options, 'simple_request': default_test_options, diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl index 6d1917c0ff..9bbba26108 100755 --- a/test/core/end2end/generate_tests.bzl +++ b/test/core/end2end/generate_tests.bzl @@ -138,6 +138,9 @@ END2END_TESTS = { 'simple_metadata': test_options(), 'simple_request': test_options(), 'streaming_error_response': test_options(), + 'stream_compression_compressed_payload': test_options(proxyable=False, exclude_inproc=True), + 'stream_compression_payload': test_options(exclude_inproc=True), + 'stream_compression_ping_pong_streaming': test_options(exclude_inproc=True), 'trailing_metadata': test_options(), 'authority_not_supported': test_options(), 'filter_latency': test_options(), diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.c index bf90e2525d..c3aca13249 100644 --- a/test/core/end2end/goaway_server_test.c +++ b/test/core/end2end/goaway_server_test.c @@ -48,7 +48,8 @@ static void (*iomgr_resolve_address)(grpc_exec_ctx *exec_ctx, const char *addr, static grpc_ares_request *(*iomgr_dns_lookup_ares)( grpc_exec_ctx *exec_ctx, const char *dns_server, const char *addr, const char *default_port, grpc_pollset_set *interested_parties, - grpc_closure *on_done, grpc_lb_addresses **addresses, bool check_grpclb); + grpc_closure *on_done, grpc_lb_addresses **addresses, bool check_grpclb, + char **service_config_json); static void set_resolve_port(int port) { gpr_mu_lock(&g_mu); @@ -90,11 +91,12 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, static grpc_ares_request *my_dns_lookup_ares( grpc_exec_ctx *exec_ctx, const char *dns_server, const char *addr, const char *default_port, grpc_pollset_set *interested_parties, - grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb) { + grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb, + char **service_config_json) { if (0 != strcmp(addr, "test")) { return iomgr_dns_lookup_ares(exec_ctx, dns_server, addr, default_port, interested_parties, on_done, lb_addrs, - check_grpclb); + check_grpclb, service_config_json); } grpc_error *error = GRPC_ERROR_NONE; diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index d659d1173a..fd26fd122e 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -25,6 +25,7 @@ #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> +#include <grpc/support/string_util.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> #include "src/core/lib/support/string.h" @@ -138,7 +139,12 @@ static void simple_request_body(grpc_end2end_test_config config, error = grpc_call_start_batch(c, ops, num_ops, tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); - grpc_call_cancel_with_status(c, GRPC_STATUS_UNIMPLEMENTED, "xyz", NULL); + char *dynamic_string = gpr_strdup("xyz"); + grpc_call_cancel_with_status(c, GRPC_STATUS_UNIMPLEMENTED, + (const char *)dynamic_string, NULL); + // The API of \a description allows for it to be a dynamic/non-const + // string, test this guarantee. + gpr_free(dynamic_string); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.c b/test/core/end2end/tests/stream_compression_compressed_payload.c new file mode 100644 index 0000000000..11e7999a1c --- /dev/null +++ b/test/core/end2end/tests/stream_compression_compressed_payload.c @@ -0,0 +1,652 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "test/core/end2end/end2end_tests.h" + +#include <stdio.h> +#include <string.h> + +#include <grpc/byte_buffer.h> +#include <grpc/byte_buffer_reader.h> +#include <grpc/compression.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/string_util.h> +#include <grpc/support/time.h> +#include <grpc/support/useful.h> + +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/surface/call.h" +#include "src/core/lib/surface/call_test_only.h" +#include "src/core/lib/transport/static_metadata.h" +#include "test/core/end2end/cq_verifier.h" + +static void *tag(intptr_t t) { return (void *)t; } + +static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, + const char *test_name, + grpc_channel_args *client_args, + grpc_channel_args *server_args) { + grpc_end2end_test_fixture f; + gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name); + f = config.create_fixture(client_args, server_args); + config.init_server(&f, server_args); + config.init_client(&f, client_args); + return f; +} + +static gpr_timespec n_seconds_from_now(int n) { + return grpc_timeout_seconds_to_deadline(n); +} + +static gpr_timespec five_seconds_from_now(void) { + return n_seconds_from_now(5); +} + +static void drain_cq(grpc_completion_queue *cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void shutdown_server(grpc_end2end_test_fixture *f) { + if (!f->server) return; + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) + .type == GRPC_OP_COMPLETE); + grpc_server_destroy(f->server); + f->server = NULL; +} + +static void shutdown_client(grpc_end2end_test_fixture *f) { + if (!f->client) return; + grpc_channel_destroy(f->client); + f->client = NULL; +} + +static void end_test(grpc_end2end_test_fixture *f) { + shutdown_server(f); + shutdown_client(f); + + grpc_completion_queue_shutdown(f->cq); + drain_cq(f->cq); + grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); +} + +static void request_for_disabled_algorithm( + grpc_end2end_test_config config, const char *test_name, + uint32_t send_flags_bitmask, + grpc_stream_compression_algorithm algorithm_to_disable, + grpc_stream_compression_algorithm requested_client_compression_algorithm, + grpc_status_code expected_error, grpc_metadata *client_metadata) { + grpc_call *c; + grpc_call *s; + grpc_slice request_payload_slice; + grpc_byte_buffer *request_payload; + grpc_channel_args *client_args; + grpc_channel_args *server_args; + grpc_end2end_test_fixture f; + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_byte_buffer *request_payload_recv = NULL; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + grpc_slice details; + int was_cancelled = 2; + cq_verifier *cqv; + char str[1024]; + + memset(str, 'x', 1023); + str[1023] = '\0'; + request_payload_slice = grpc_slice_from_copied_string(str); + request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + + client_args = grpc_channel_args_set_stream_compression_algorithm( + NULL, requested_client_compression_algorithm); + server_args = grpc_channel_args_set_stream_compression_algorithm( + NULL, GRPC_STREAM_COMPRESS_NONE); + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + server_args = grpc_channel_args_stream_compression_algorithm_set_state( + &exec_ctx, &server_args, algorithm_to_disable, false); + grpc_exec_ctx_finish(&exec_ctx); + } + + f = begin_test(config, test_name, client_args, server_args); + cqv = cq_verifier_create(f.cq); + + gpr_timespec deadline = five_seconds_from_now(); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, + NULL); + GPR_ASSERT(c); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + if (client_metadata != NULL) { + op->data.send_initial_metadata.count = 1; + op->data.send_initial_metadata.metadata = client_metadata; + } else { + op->data.send_initial_metadata.count = 0; + } + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = send_flags_bitmask; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(101), true); + cq_verify(cqv); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &request_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(102), false); + + op = ops; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(103), true); + CQ_EXPECT_COMPLETION(cqv, tag(1), true); + cq_verify(cqv); + + /* call was cancelled (closed) ... */ + GPR_ASSERT(was_cancelled != 0); + /* with a certain error */ + GPR_ASSERT(status == expected_error); + + char *algo_name = NULL; + GPR_ASSERT( + grpc_stream_compression_algorithm_name(algorithm_to_disable, &algo_name)); + char *expected_details = NULL; + gpr_asprintf(&expected_details, + "Stream compression algorithm '%s' is disabled.", algo_name); + /* and we expect a specific reason for it */ + GPR_ASSERT(0 == grpc_slice_str_cmp(details, expected_details)); + gpr_free(expected_details); + GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); + + grpc_slice_unref(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_unref(c); + grpc_call_unref(s); + + cq_verifier_destroy(cqv); + + grpc_slice_unref(request_payload_slice); + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(request_payload_recv); + + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_args_destroy(&exec_ctx, client_args); + grpc_channel_args_destroy(&exec_ctx, server_args); + grpc_exec_ctx_finish(&exec_ctx); + } + + end_test(&f); + config.tear_down_data(&f); +} + +static void request_with_payload_template( + grpc_end2end_test_config config, const char *test_name, + uint32_t client_send_flags_bitmask, + grpc_stream_compression_algorithm + default_client_channel_compression_algorithm, + grpc_stream_compression_algorithm + default_server_channel_compression_algorithm, + grpc_stream_compression_algorithm expected_client_compression_algorithm, + grpc_stream_compression_algorithm expected_server_compression_algorithm, + grpc_metadata *client_init_metadata, bool set_server_level, + grpc_stream_compression_level server_compression_level, + bool send_message_before_initial_metadata, + bool set_default_server_message_compression_algorithm, + grpc_compression_algorithm default_server_message_compression_algorithm) { + grpc_call *c; + grpc_call *s; + grpc_slice request_payload_slice; + grpc_byte_buffer *request_payload = NULL; + grpc_channel_args *client_args; + grpc_channel_args *server_args; + grpc_end2end_test_fixture f; + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_byte_buffer *request_payload_recv = NULL; + grpc_byte_buffer *response_payload; + grpc_byte_buffer *response_payload_recv; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + grpc_slice details; + int was_cancelled = 2; + cq_verifier *cqv; + char request_str[1024]; + char response_str[1024]; + + memset(request_str, 'x', 1023); + request_str[1023] = '\0'; + + memset(response_str, 'y', 1023); + response_str[1023] = '\0'; + + request_payload_slice = grpc_slice_from_copied_string(request_str); + grpc_slice response_payload_slice = + grpc_slice_from_copied_string(response_str); + + client_args = grpc_channel_args_set_stream_compression_algorithm( + NULL, default_client_channel_compression_algorithm); + if (set_default_server_message_compression_algorithm) { + server_args = grpc_channel_args_set_compression_algorithm( + NULL, default_server_message_compression_algorithm); + } else { + server_args = grpc_channel_args_set_stream_compression_algorithm( + NULL, default_server_channel_compression_algorithm); + } + + f = begin_test(config, test_name, client_args, server_args); + cqv = cq_verifier_create(f.cq); + + gpr_timespec deadline = five_seconds_from_now(); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, + NULL); + GPR_ASSERT(c); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + if (send_message_before_initial_metadata) { + request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = client_send_flags_bitmask; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(2), true); + } + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + if (client_init_metadata != NULL) { + op->data.send_initial_metadata.count = 1; + op->data.send_initial_metadata.metadata = client_init_metadata; + } else { + op->data.send_initial_metadata.count = 0; + } + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(100)); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(100), true); + cq_verify(cqv); + + GPR_ASSERT(GPR_BITCOUNT(grpc_call_test_only_get_encodings_accepted_by_peer( + s)) == GRPC_COMPRESS_ALGORITHMS_COUNT); + GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s), + GRPC_COMPRESS_NONE) != 0); + GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s), + GRPC_COMPRESS_DEFLATE) != 0); + GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s), + GRPC_COMPRESS_GZIP) != 0); + GPR_ASSERT( + GPR_BITCOUNT(grpc_call_test_only_get_stream_encodings_accepted_by_peer( + s)) == GRPC_STREAM_COMPRESS_ALGORITHMS_COUNT); + GPR_ASSERT( + GPR_BITGET(grpc_call_test_only_get_stream_encodings_accepted_by_peer(s), + GRPC_STREAM_COMPRESS_NONE) != 0); + GPR_ASSERT( + GPR_BITGET(grpc_call_test_only_get_stream_encodings_accepted_by_peer(s), + GRPC_STREAM_COMPRESS_GZIP) != 0); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + if (set_server_level) { + op->data.send_initial_metadata.maybe_stream_compression_level.is_set = true; + op->data.send_initial_metadata.maybe_stream_compression_level.level = + server_compression_level; + } + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + for (int i = 0; i < 2; i++) { + response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); + + if (i > 0 || !send_message_before_initial_metadata) { + request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = client_send_flags_bitmask; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(2), 1); + } + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &request_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(102), 1); + cq_verify(cqv); + + GPR_ASSERT(request_payload_recv->type == GRPC_BB_RAW); + GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, request_str)); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = response_payload; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(103), 1); + CQ_EXPECT_COMPLETION(cqv, tag(3), 1); + cq_verify(cqv); + + GPR_ASSERT(response_payload_recv->type == GRPC_BB_RAW); + GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, response_str)); + + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(response_payload); + grpc_byte_buffer_destroy(request_payload_recv); + grpc_byte_buffer_destroy(response_payload_recv); + } + + grpc_slice_unref(request_payload_slice); + grpc_slice_unref(response_payload_slice); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_OK; + grpc_slice status_details = grpc_slice_from_static_string("xyz"); + op->data.send_status_from_server.status_details = &status_details; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + CQ_EXPECT_COMPLETION(cqv, tag(4), 1); + CQ_EXPECT_COMPLETION(cqv, tag(101), 1); + CQ_EXPECT_COMPLETION(cqv, tag(104), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_OK); + GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); + GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); + GPR_ASSERT(was_cancelled == 0); + + grpc_slice_unref(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_unref(c); + grpc_call_unref(s); + + cq_verifier_destroy(cqv); + + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_args_destroy(&exec_ctx, client_args); + grpc_channel_args_destroy(&exec_ctx, server_args); + grpc_exec_ctx_finish(&exec_ctx); + } + + end_test(&f); + config.tear_down_data(&f); +} + +static void test_invoke_request_with_compressed_payload( + grpc_end2end_test_config config) { + request_with_payload_template( + config, "test_invoke_request_with_compressed_payload", 0, + GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, + GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, NULL, + false, /* ignored */ + GRPC_STREAM_COMPRESS_LEVEL_NONE, false, false, GRPC_COMPRESS_NONE); +} + +static void test_invoke_request_with_send_message_before_initial_metadata( + grpc_end2end_test_config config) { + request_with_payload_template( + config, "test_invoke_request_with_send_message_before_initial_metadata", + 0, GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, + GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, NULL, + false, /* ignored */ + GRPC_STREAM_COMPRESS_LEVEL_NONE, true, false, GRPC_COMPRESS_NONE); +} + +static void test_invoke_request_with_server_level( + grpc_end2end_test_config config) { + request_with_payload_template( + config, "test_invoke_request_with_server_level", 0, + GRPC_STREAM_COMPRESS_NONE, GRPC_STREAM_COMPRESS_NONE, + GRPC_STREAM_COMPRESS_NONE, GRPC_STREAM_COMPRESS_GZIP, + /* ignored */ NULL, true, GRPC_STREAM_COMPRESS_LEVEL_HIGH, false, false, + GRPC_COMPRESS_NONE); +} + +static void test_invoke_request_with_compressed_payload_md_override( + grpc_end2end_test_config config) { + grpc_metadata gzip_compression_override; + grpc_metadata identity_compression_override; + + gzip_compression_override.key = + GRPC_MDSTR_GRPC_INTERNAL_STREAM_ENCODING_REQUEST; + gzip_compression_override.value = grpc_slice_from_static_string("gzip"); + memset(&gzip_compression_override.internal_data, 0, + sizeof(gzip_compression_override.internal_data)); + + identity_compression_override.key = + GRPC_MDSTR_GRPC_INTERNAL_STREAM_ENCODING_REQUEST; + identity_compression_override.value = + grpc_slice_from_static_string("identity"); + memset(&identity_compression_override.internal_data, 0, + sizeof(identity_compression_override.internal_data)); + + /* Channel default NONE (aka IDENTITY), call override to stream GZIP */ + request_with_payload_template( + config, "test_invoke_request_with_compressed_payload_md_override_1", 0, + GRPC_STREAM_COMPRESS_NONE, GRPC_STREAM_COMPRESS_NONE, + GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_NONE, + &gzip_compression_override, false, + /*ignored*/ GRPC_STREAM_COMPRESS_LEVEL_NONE, false, false, + GRPC_COMPRESS_NONE); + + /* Channel default stream GZIP, call override to NONE (aka IDENTITY) */ + request_with_payload_template( + config, "test_invoke_request_with_compressed_payload_md_override_3", 0, + GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_NONE, + GRPC_STREAM_COMPRESS_NONE, GRPC_STREAM_COMPRESS_NONE, + &identity_compression_override, false, + /*ignored*/ GRPC_STREAM_COMPRESS_LEVEL_NONE, false, false, + GRPC_COMPRESS_NONE); +} + +static void test_invoke_request_with_disabled_algorithm( + grpc_end2end_test_config config) { + request_for_disabled_algorithm( + config, "test_invoke_request_with_disabled_algorithm", 0, + GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, + GRPC_STATUS_UNIMPLEMENTED, NULL); +} + +static void test_stream_compression_override_message_compression( + grpc_end2end_test_config config) { + grpc_stream_compression_level level = GRPC_STREAM_COMPRESS_LEVEL_MED; + request_with_payload_template( + config, "test_stream_compression_override_message_compression", 0, + GRPC_STREAM_COMPRESS_NONE, GRPC_STREAM_COMPRESS_NONE, + GRPC_STREAM_COMPRESS_NONE, + grpc_stream_compression_algorithm_for_level( + level, (1u << GRPC_STREAM_COMPRESS_ALGORITHMS_COUNT) - 1), + /* ignored */ NULL, true, level, false, true, GRPC_COMPRESS_GZIP); +} + +void stream_compression_compressed_payload(grpc_end2end_test_config config) { + test_invoke_request_with_compressed_payload(config); + test_invoke_request_with_send_message_before_initial_metadata(config); + test_invoke_request_with_server_level(config); + test_invoke_request_with_compressed_payload_md_override(config); + test_invoke_request_with_disabled_algorithm(config); + test_stream_compression_override_message_compression(config); +} + +void stream_compression_compressed_payload_pre_init(void) {} diff --git a/test/core/end2end/tests/stream_compression_payload.c b/test/core/end2end/tests/stream_compression_payload.c new file mode 100644 index 0000000000..5135df81ed --- /dev/null +++ b/test/core/end2end/tests/stream_compression_payload.c @@ -0,0 +1,305 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "test/core/end2end/end2end_tests.h" + +#include <stdio.h> +#include <string.h> + +#include <grpc/byte_buffer.h> +#include <grpc/compression.h> +#include <grpc/compression.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/time.h> +#include <grpc/support/useful.h> +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/surface/call.h" +#include "test/core/end2end/cq_verifier.h" + +static void *tag(intptr_t t) { return (void *)t; } + +static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, + const char *test_name, + grpc_channel_args *client_args, + grpc_channel_args *server_args) { + grpc_end2end_test_fixture f; + gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name); + f = config.create_fixture(client_args, server_args); + config.init_server(&f, server_args); + config.init_client(&f, client_args); + return f; +} + +static gpr_timespec n_seconds_from_now(int n) { + return grpc_timeout_seconds_to_deadline(n); +} + +static gpr_timespec five_seconds_from_now(void) { + return n_seconds_from_now(5); +} + +static void drain_cq(grpc_completion_queue *cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void shutdown_server(grpc_end2end_test_fixture *f) { + if (!f->server) return; + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) + .type == GRPC_OP_COMPLETE); + grpc_server_destroy(f->server); + f->server = NULL; +} + +static void shutdown_client(grpc_end2end_test_fixture *f) { + if (!f->client) return; + grpc_channel_destroy(f->client); + f->client = NULL; +} + +static void end_test(grpc_end2end_test_fixture *f) { + shutdown_server(f); + shutdown_client(f); + + grpc_completion_queue_shutdown(f->cq); + drain_cq(f->cq); + grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); +} + +/* Creates and returns a grpc_slice containing random alphanumeric characters. + */ +static grpc_slice generate_random_slice() { + size_t i; + static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890"; + char *output; + const size_t output_size = 1024 * 1024; + output = gpr_malloc(output_size); + for (i = 0; i < output_size - 1; ++i) { + output[i] = chars[rand() % (int)(sizeof(chars) - 1)]; + } + output[output_size - 1] = '\0'; + grpc_slice out = grpc_slice_from_copied_string(output); + gpr_free(output); + return out; +} + +static void request_response_with_payload(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { + /* Create large request and response bodies. These are big enough to require + * multiple round trips to deliver to the peer, and their exact contents of + * will be verified on completion. */ + grpc_slice request_payload_slice = generate_random_slice(); + grpc_slice response_payload_slice = generate_random_slice(); + + grpc_call *c; + grpc_call *s; + grpc_byte_buffer *request_payload = + grpc_raw_byte_buffer_create(&request_payload_slice, 1); + grpc_byte_buffer *response_payload = + grpc_raw_byte_buffer_create(&response_payload_slice, 1); + cq_verifier *cqv = cq_verifier_create(f.cq); + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_byte_buffer *request_payload_recv = NULL; + grpc_byte_buffer *response_payload_recv = NULL; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + grpc_slice details; + int was_cancelled = 2; + + gpr_timespec deadline = n_seconds_from_now(60); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, + NULL); + GPR_ASSERT(c); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(101), 1); + cq_verify(cqv); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &request_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(102), 1); + cq_verify(cqv); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = response_payload; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_OK; + grpc_slice status_details = grpc_slice_from_static_string("xyz"); + op->data.send_status_from_server.status_details = &status_details; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(103), 1); + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_OK); + GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); + GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); + GPR_ASSERT(was_cancelled == 0); + GPR_ASSERT(byte_buffer_eq_slice(request_payload_recv, request_payload_slice)); + GPR_ASSERT( + byte_buffer_eq_slice(response_payload_recv, response_payload_slice)); + + grpc_slice_unref(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_unref(c); + grpc_call_unref(s); + + cq_verifier_destroy(cqv); + + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(response_payload); + grpc_byte_buffer_destroy(request_payload_recv); + grpc_byte_buffer_destroy(response_payload_recv); +} + +/* Client sends a request with payload, server reads then returns a response + payload and status. */ +static void test_invoke_request_response_with_payload( + grpc_end2end_test_config config) { + grpc_channel_args *client_args = + grpc_channel_args_set_stream_compression_algorithm( + NULL, GRPC_STREAM_COMPRESS_GZIP); + grpc_channel_args *server_args = + grpc_channel_args_set_stream_compression_algorithm( + NULL, GRPC_STREAM_COMPRESS_GZIP); + grpc_end2end_test_fixture f = + begin_test(config, "test_invoke_request_response_with_payload", + client_args, server_args); + request_response_with_payload(config, f); + end_test(&f); + config.tear_down_data(&f); + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_args_destroy(&exec_ctx, client_args); + grpc_channel_args_destroy(&exec_ctx, server_args); + grpc_exec_ctx_finish(&exec_ctx); + } +} + +static void test_invoke_10_request_response_with_payload( + grpc_end2end_test_config config) { + int i; + grpc_end2end_test_fixture f = begin_test( + config, "test_invoke_10_request_response_with_payload", NULL, NULL); + for (i = 0; i < 10; i++) { + request_response_with_payload(config, f); + } + end_test(&f); + config.tear_down_data(&f); +} + +void stream_compression_payload(grpc_end2end_test_config config) { + test_invoke_request_response_with_payload(config); + test_invoke_10_request_response_with_payload(config); +} + +void stream_compression_payload_pre_init(void) {} diff --git a/test/core/end2end/tests/stream_compression_ping_pong_streaming.c b/test/core/end2end/tests/stream_compression_ping_pong_streaming.c new file mode 100644 index 0000000000..4c1a34cc64 --- /dev/null +++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.c @@ -0,0 +1,291 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "test/core/end2end/end2end_tests.h" + +#include <stdio.h> +#include <string.h> + +#include <grpc/byte_buffer.h> +#include <grpc/compression.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/time.h> +#include <grpc/support/useful.h> +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/surface/call.h" +#include "test/core/end2end/cq_verifier.h" + +static void *tag(intptr_t t) { return (void *)t; } + +static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, + const char *test_name, + grpc_channel_args *client_args, + grpc_channel_args *server_args) { + grpc_end2end_test_fixture f; + gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name); + f = config.create_fixture(client_args, server_args); + config.init_server(&f, server_args); + config.init_client(&f, client_args); + return f; +} + +static gpr_timespec n_seconds_from_now(int n) { + return grpc_timeout_seconds_to_deadline(n); +} + +static gpr_timespec five_seconds_from_now(void) { + return n_seconds_from_now(5); +} + +static void drain_cq(grpc_completion_queue *cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void shutdown_server(grpc_end2end_test_fixture *f) { + if (!f->server) return; + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) + .type == GRPC_OP_COMPLETE); + grpc_server_destroy(f->server); + f->server = NULL; +} + +static void shutdown_client(grpc_end2end_test_fixture *f) { + if (!f->client) return; + grpc_channel_destroy(f->client); + f->client = NULL; +} + +static void end_test(grpc_end2end_test_fixture *f) { + shutdown_server(f); + shutdown_client(f); + + grpc_completion_queue_shutdown(f->cq); + drain_cq(f->cq); + grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); +} + +/* Client pings and server pongs. Repeat messages rounds before finishing. */ +static void test_pingpong_streaming(grpc_end2end_test_config config, + int messages) { + grpc_channel_args *client_args = + grpc_channel_args_set_stream_compression_algorithm( + NULL, GRPC_STREAM_COMPRESS_GZIP); + grpc_channel_args *server_args = + grpc_channel_args_set_stream_compression_algorithm( + NULL, GRPC_STREAM_COMPRESS_GZIP); + grpc_end2end_test_fixture f = + begin_test(config, "test_pingpong_streaming", client_args, server_args); + grpc_call *c; + grpc_call *s; + cq_verifier *cqv = cq_verifier_create(f.cq); + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + grpc_slice details; + int was_cancelled = 2; + grpc_byte_buffer *request_payload; + grpc_byte_buffer *request_payload_recv; + grpc_byte_buffer *response_payload; + grpc_byte_buffer *response_payload_recv; + int i; + grpc_slice request_payload_slice = + grpc_slice_from_copied_string("hello world"); + grpc_slice response_payload_slice = + grpc_slice_from_copied_string("hello you"); + + gpr_timespec deadline = five_seconds_from_now(); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, + NULL); + GPR_ASSERT(c); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(100)); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(100), 1); + cq_verify(cqv); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + for (i = 0; i < messages; i++) { + request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &request_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(102), 1); + cq_verify(cqv); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = response_payload; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(103), 1); + CQ_EXPECT_COMPLETION(cqv, tag(2), 1); + cq_verify(cqv); + + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(response_payload); + grpc_byte_buffer_destroy(request_payload_recv); + grpc_byte_buffer_destroy(response_payload_recv); + } + + grpc_slice_unref(request_payload_slice); + grpc_slice_unref(response_payload_slice); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; + grpc_slice status_details = grpc_slice_from_static_string("xyz"); + op->data.send_status_from_server.status_details = &status_details; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + CQ_EXPECT_COMPLETION(cqv, tag(3), 1); + CQ_EXPECT_COMPLETION(cqv, tag(101), 1); + CQ_EXPECT_COMPLETION(cqv, tag(104), 1); + cq_verify(cqv); + + grpc_call_unref(c); + grpc_call_unref(s); + + cq_verifier_destroy(cqv); + + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + grpc_slice_unref(details); + + end_test(&f); + config.tear_down_data(&f); + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_args_destroy(&exec_ctx, client_args); + grpc_channel_args_destroy(&exec_ctx, server_args); + grpc_exec_ctx_finish(&exec_ctx); + } +} + +void stream_compression_ping_pong_streaming(grpc_end2end_test_config config) { + int i; + + for (i = 1; i < 10; i++) { + test_pingpong_streaming(config, i); + } +} + +void stream_compression_ping_pong_streaming_pre_init(void) {} diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index fd8fa7ff6c..9d562b9090 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -185,6 +185,19 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { CQ_EXPECT_COMPLETION(cqv, tag(103), 1); cq_verify(cqv); + if (!request_status_early) { + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload2_recv; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(2), 1); + cq_verify(cqv); + } + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; @@ -199,21 +212,9 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); GPR_ASSERT(GRPC_CALL_OK == error); - if (!request_status_early) { - memset(ops, 0, sizeof(ops)); - op = ops; - op->op = GRPC_OP_RECV_MESSAGE; - op->data.recv_message.recv_message = &response_payload2_recv; - op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); - GPR_ASSERT(GRPC_CALL_OK == error); - } - CQ_EXPECT_COMPLETION(cqv, tag(104), 1); if (request_status_early) { CQ_EXPECT_COMPLETION(cqv, tag(1), 1); - } else { - CQ_EXPECT_COMPLETION(cqv, tag(2), 1); } cq_verify(cqv); diff --git a/test/core/fling/BUILD b/test/core/fling/BUILD index b0d34e9eb0..27b2b5bec6 100644 --- a/test/core/fling/BUILD +++ b/test/core/fling/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/fling") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") diff --git a/test/core/fling/server.c b/test/core/fling/server.c index 0f0f22ffcf..b3a7fa21ec 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -77,8 +77,10 @@ typedef struct { static void request_call(void) { grpc_metadata_array_init(&request_metadata_recv); - grpc_server_request_call(server, &call, &call_details, &request_metadata_recv, - cq, cq, tag(FLING_SERVER_NEW_REQUEST)); + GPR_ASSERT(GRPC_CALL_OK == + grpc_server_request_call(server, &call, &call_details, + &request_metadata_recv, cq, cq, + tag(FLING_SERVER_NEW_REQUEST))); } static void handle_unary_method(void) { diff --git a/test/core/handshake/BUILD b/test/core/handshake/BUILD index c93ddc8c21..8e462cfc5b 100644 --- a/test/core/handshake/BUILD +++ b/test/core/handshake/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/handshake") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 grpc_cc_test( name = "client_ssl", diff --git a/test/core/http/BUILD b/test/core/http/BUILD index 28313082c6..fffdac5e08 100644 --- a/test/core/http/BUILD +++ b/test/core/http/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/http") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") diff --git a/test/core/iomgr/BUILD b/test/core/iomgr/BUILD index 3e6fd37ec6..7620d1de21 100644 --- a/test/core/iomgr/BUILD +++ b/test/core/iomgr/BUILD @@ -12,19 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") licenses(["notice"]) # Apache v2 load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") -package( - default_visibility = ["//visibility:public"], # Useful for third party devs to test their io manager implementation. - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/iomgr", visibility = "public") # Useful for third party devs to test their io manager implementation. grpc_cc_library( name = "endpoint_tests", diff --git a/test/core/iomgr/ev_epollsig_linux_test.c b/test/core/iomgr/ev_epollsig_linux_test.c index 1d272fa406..c702065d4d 100644 --- a/test/core/iomgr/ev_epollsig_linux_test.c +++ b/test/core/iomgr/ev_epollsig_linux_test.c @@ -79,7 +79,8 @@ static void test_fd_cleanup(grpc_exec_ctx *exec_ctx, test_fd *tfds, GRPC_ERROR_CREATE_FROM_STATIC_STRING("test_fd_cleanup")); grpc_exec_ctx_flush(exec_ctx); - grpc_fd_orphan(exec_ctx, tfds[i].fd, NULL, &release_fd, "test_fd_cleanup"); + grpc_fd_orphan(exec_ctx, tfds[i].fd, NULL, &release_fd, + false /* already_closed */, "test_fd_cleanup"); grpc_exec_ctx_flush(exec_ctx); GPR_ASSERT(release_fd == tfds[i].inner_fd); @@ -294,7 +295,8 @@ static void test_threading(void) { { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_fd_shutdown(&exec_ctx, shared.wakeup_desc, GRPC_ERROR_CANCELLED); - grpc_fd_orphan(&exec_ctx, shared.wakeup_desc, NULL, NULL, "done"); + grpc_fd_orphan(&exec_ctx, shared.wakeup_desc, NULL, NULL, + false /* already_closed */, "done"); grpc_pollset_shutdown(&exec_ctx, shared.pollset, GRPC_CLOSURE_CREATE(destroy_pollset, shared.pollset, grpc_schedule_on_exec_ctx)); diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c index 02596450d2..85d5d9c07f 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.c @@ -114,7 +114,8 @@ static void session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */ bool success) { session *se = arg; server *sv = se->sv; - grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, "a"); + grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, false /* already_closed */, + "a"); gpr_free(se); /* Start to shutdown listen fd. */ grpc_fd_shutdown(exec_ctx, sv->em_fd, @@ -171,7 +172,8 @@ static void listen_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*server */, int success) { server *sv = arg; - grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, NULL, "b"); + grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, NULL, false /* already_closed */, + "b"); gpr_mu_lock(g_mu); sv->done = 1; @@ -291,7 +293,8 @@ static void client_init(client *cl) { static void client_session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*client */, int success) { client *cl = arg; - grpc_fd_orphan(exec_ctx, cl->em_fd, NULL, NULL, "c"); + grpc_fd_orphan(exec_ctx, cl->em_fd, NULL, NULL, false /* already_closed */, + "c"); cl->done = 1; GPR_ASSERT( GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL))); @@ -511,7 +514,7 @@ static void test_grpc_fd_change(void) { GPR_ASSERT(b.cb_that_ran == second_read_callback); gpr_mu_unlock(g_mu); - grpc_fd_orphan(&exec_ctx, em_fd, NULL, NULL, "d"); + grpc_fd_orphan(&exec_ctx, em_fd, NULL, NULL, false /* already_closed */, "d"); grpc_exec_ctx_finish(&exec_ctx); destroy_change_data(&a); destroy_change_data(&b); diff --git a/test/core/iomgr/pollset_set_test.c b/test/core/iomgr/pollset_set_test.c index 6aedaf1081..5750ac0f4b 100644 --- a/test/core/iomgr/pollset_set_test.c +++ b/test/core/iomgr/pollset_set_test.c @@ -137,7 +137,8 @@ static void cleanup_test_fds(grpc_exec_ctx *exec_ctx, test_fd *tfds, * grpc_wakeup_fd and we would like to destroy it ourselves (by calling * grpc_wakeup_fd_destroy). To prevent grpc_fd from calling close() on the * underlying fd, call it with a non-NULL 'release_fd' parameter */ - grpc_fd_orphan(exec_ctx, tfds[i].fd, NULL, &release_fd, "test_fd_cleanup"); + grpc_fd_orphan(exec_ctx, tfds[i].fd, NULL, &release_fd, + false /* already_closed */, "test_fd_cleanup"); grpc_exec_ctx_flush(exec_ctx); grpc_wakeup_fd_destroy(&tfds[i].wakeup_fd); diff --git a/test/core/json/BUILD b/test/core/json/BUILD index 36b0897d80..3ff7918677 100644 --- a/test/core/json/BUILD +++ b/test/core/json/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/json") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") diff --git a/test/core/nanopb/BUILD b/test/core/nanopb/BUILD index bdb468867d..f332207e2d 100644 --- a/test/core/nanopb/BUILD +++ b/test/core/nanopb/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/nanopb") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") diff --git a/test/core/network_benchmarks/BUILD b/test/core/network_benchmarks/BUILD index cee23ecd51..0e15393030 100644 --- a/test/core/network_benchmarks/BUILD +++ b/test/core/network_benchmarks/BUILD @@ -12,17 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 - -package( - features = [ - "-layering_check", - "-parse_headers", - ], +grpc_package(name = "test/core/network_benchmarks", + features = ["-layering_check", "-parse_headers" ] ) +licenses(["notice"]) # Apache v2 + grpc_cc_binary( name = "low_level_ping_pong", srcs = ["low_level_ping_pong.c"], diff --git a/test/core/security/BUILD b/test/core/security/BUILD index 241ffc0591..dc41759922 100644 --- a/test/core/security/BUILD +++ b/test/core/security/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") licenses(["notice"]) # Apache v2 -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/security") load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index a76cb0499d..441c431135 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -105,8 +105,6 @@ static const char valid_oauth2_json_response[] = " \"expires_in\":3599, " " \"token_type\":\"Bearer\"}"; -static const char test_user_data[] = "user data"; - static const char test_scope[] = "perm1 perm2"; static const char test_signed_jwt[] = @@ -134,11 +132,6 @@ static char *test_json_key_str(void) { return result; } -typedef struct { - const char *key; - const char *value; -} expected_md; - static grpc_httpcli_response http_response(int status, const char *body) { grpc_httpcli_response response; memset(&response, 0, sizeof(grpc_httpcli_response)); @@ -150,89 +143,57 @@ static grpc_httpcli_response http_response(int status, const char *body) { /* -- Tests. -- */ -static void test_empty_md_store(void) { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *store = grpc_credentials_md_store_create(0); - GPR_ASSERT(store->num_entries == 0); - GPR_ASSERT(store->allocated == 0); - grpc_credentials_md_store_unref(&exec_ctx, store); - grpc_exec_ctx_finish(&exec_ctx); -} - -static void test_ref_unref_empty_md_store(void) { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *store = grpc_credentials_md_store_create(0); - grpc_credentials_md_store_ref(store); - grpc_credentials_md_store_ref(store); - GPR_ASSERT(store->num_entries == 0); - GPR_ASSERT(store->allocated == 0); - grpc_credentials_md_store_unref(&exec_ctx, store); - grpc_credentials_md_store_unref(&exec_ctx, store); - grpc_credentials_md_store_unref(&exec_ctx, store); - grpc_exec_ctx_finish(&exec_ctx); -} - -static void test_add_to_empty_md_store(void) { +static void test_empty_md_array(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *store = grpc_credentials_md_store_create(0); - const char *key_str = "hello"; - const char *value_str = "there blah blah blah blah blah blah blah"; - grpc_slice key = grpc_slice_from_copied_string(key_str); - grpc_slice value = grpc_slice_from_copied_string(value_str); - grpc_credentials_md_store_add(store, key, value); - GPR_ASSERT(store->num_entries == 1); - GPR_ASSERT(grpc_slice_eq(key, store->entries[0].key)); - GPR_ASSERT(grpc_slice_eq(value, store->entries[0].value)); - grpc_slice_unref(key); - grpc_slice_unref(value); - grpc_credentials_md_store_unref(&exec_ctx, store); + grpc_credentials_mdelem_array md_array; + memset(&md_array, 0, sizeof(md_array)); + GPR_ASSERT(md_array.md == NULL); + GPR_ASSERT(md_array.size == 0); + grpc_credentials_mdelem_array_destroy(&exec_ctx, &md_array); grpc_exec_ctx_finish(&exec_ctx); } -static void test_add_cstrings_to_empty_md_store(void) { +static void test_add_to_empty_md_array(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *store = grpc_credentials_md_store_create(0); - const char *key_str = "hello"; - const char *value_str = "there blah blah blah blah blah blah blah"; - grpc_credentials_md_store_add_cstrings(store, key_str, value_str); - GPR_ASSERT(store->num_entries == 1); - GPR_ASSERT(grpc_slice_str_cmp(store->entries[0].key, key_str) == 0); - GPR_ASSERT(grpc_slice_str_cmp(store->entries[0].value, value_str) == 0); - grpc_credentials_md_store_unref(&exec_ctx, store); + grpc_credentials_mdelem_array md_array; + memset(&md_array, 0, sizeof(md_array)); + const char *key = "hello"; + const char *value = "there blah blah blah blah blah blah blah"; + grpc_mdelem md = + grpc_mdelem_from_slices(&exec_ctx, grpc_slice_from_copied_string(key), + grpc_slice_from_copied_string(value)); + grpc_credentials_mdelem_array_add(&md_array, md); + GPR_ASSERT(md_array.size == 1); + GPR_ASSERT(grpc_mdelem_eq(md, md_array.md[0])); + GRPC_MDELEM_UNREF(&exec_ctx, md); + grpc_credentials_mdelem_array_destroy(&exec_ctx, &md_array); grpc_exec_ctx_finish(&exec_ctx); } -static void test_empty_preallocated_md_store(void) { +static void test_add_abunch_to_md_array(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *store = grpc_credentials_md_store_create(4); - GPR_ASSERT(store->num_entries == 0); - GPR_ASSERT(store->allocated == 4); - GPR_ASSERT(store->entries != NULL); - grpc_credentials_md_store_unref(&exec_ctx, store); - grpc_exec_ctx_finish(&exec_ctx); -} - -static void test_add_abunch_to_md_store(void) { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *store = grpc_credentials_md_store_create(4); + grpc_credentials_mdelem_array md_array; + memset(&md_array, 0, sizeof(md_array)); + const char *key = "hello"; + const char *value = "there blah blah blah blah blah blah blah"; + grpc_mdelem md = + grpc_mdelem_from_slices(&exec_ctx, grpc_slice_from_copied_string(key), + grpc_slice_from_copied_string(value)); size_t num_entries = 1000; - const char *key_str = "hello"; - const char *value_str = "there blah blah blah blah blah blah blah"; - size_t i; - for (i = 0; i < num_entries; i++) { - grpc_credentials_md_store_add_cstrings(store, key_str, value_str); + for (size_t i = 0; i < num_entries; ++i) { + grpc_credentials_mdelem_array_add(&md_array, md); } - for (i = 0; i < num_entries; i++) { - GPR_ASSERT(grpc_slice_str_cmp(store->entries[i].key, key_str) == 0); - GPR_ASSERT(grpc_slice_str_cmp(store->entries[i].value, value_str) == 0); + for (size_t i = 0; i < num_entries; ++i) { + GPR_ASSERT(grpc_mdelem_eq(md_array.md[i], md)); } - grpc_credentials_md_store_unref(&exec_ctx, store); + GRPC_MDELEM_UNREF(&exec_ctx, md); + grpc_credentials_mdelem_array_destroy(&exec_ctx, &md_array); grpc_exec_ctx_finish(&exec_ctx); } static void test_oauth2_token_fetcher_creds_parsing_ok(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *token_md = NULL; + grpc_mdelem token_md = GRPC_MDNULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, valid_oauth2_json_response); @@ -241,20 +202,18 @@ static void test_oauth2_token_fetcher_creds_parsing_ok(void) { GRPC_CREDENTIALS_OK); GPR_ASSERT(token_lifetime.tv_sec == 3599); GPR_ASSERT(token_lifetime.tv_nsec == 0); - GPR_ASSERT(token_md->num_entries == 1); - GPR_ASSERT(grpc_slice_str_cmp(token_md->entries[0].key, "authorization") == - 0); - GPR_ASSERT(grpc_slice_str_cmp(token_md->entries[0].value, + GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDKEY(token_md), "authorization") == 0); + GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDVALUE(token_md), "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") == 0); - grpc_credentials_md_store_unref(&exec_ctx, token_md); + GRPC_MDELEM_UNREF(&exec_ctx, token_md); grpc_http_response_destroy(&response); grpc_exec_ctx_finish(&exec_ctx); } static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *token_md = NULL; + grpc_mdelem token_md = GRPC_MDNULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(401, valid_oauth2_json_response); @@ -267,7 +226,7 @@ static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) { static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *token_md = NULL; + grpc_mdelem token_md = GRPC_MDNULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, ""); GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( @@ -279,7 +238,7 @@ static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) { static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *token_md = NULL; + grpc_mdelem token_md = GRPC_MDNULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, @@ -295,7 +254,7 @@ static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) { static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *token_md = NULL; + grpc_mdelem token_md = GRPC_MDNULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, "{" @@ -310,7 +269,7 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) { static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *token_md = NULL; + grpc_mdelem token_md = GRPC_MDNULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, @@ -327,7 +286,7 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) { static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime( void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_credentials_md_store *token_md = NULL; + grpc_mdelem token_md = GRPC_MDNULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, @@ -340,75 +299,126 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime( grpc_exec_ctx_finish(&exec_ctx); } -static void check_metadata(expected_md *expected, grpc_credentials_md *md_elems, - size_t num_md) { - size_t i; - for (i = 0; i < num_md; i++) { +typedef struct { + const char *key; + const char *value; +} expected_md; + +typedef struct { + grpc_error *expected_error; + const expected_md *expected; + size_t expected_size; + grpc_credentials_mdelem_array md_array; + grpc_closure on_request_metadata; + grpc_call_credentials *creds; + grpc_polling_entity pollent; +} request_metadata_state; + +static void check_metadata(const expected_md *expected, + grpc_credentials_mdelem_array *md_array) { + for (size_t i = 0; i < md_array->size; ++i) { size_t j; - for (j = 0; j < num_md; j++) { - if (0 == grpc_slice_str_cmp(md_elems[j].key, expected[i].key)) { - GPR_ASSERT(grpc_slice_str_cmp(md_elems[j].value, expected[i].value) == - 0); + for (j = 0; j < md_array->size; ++j) { + if (0 == + grpc_slice_str_cmp(GRPC_MDKEY(md_array->md[j]), expected[i].key)) { + GPR_ASSERT(grpc_slice_str_cmp(GRPC_MDVALUE(md_array->md[j]), + expected[i].value) == 0); break; } } - if (j == num_md) { + if (j == md_array->size) { gpr_log(GPR_ERROR, "key %s not found", expected[i].key); GPR_ASSERT(0); } } } -static void check_google_iam_metadata(grpc_exec_ctx *exec_ctx, void *user_data, - grpc_credentials_md *md_elems, - size_t num_md, - grpc_credentials_status status, - const char *error_details) { - grpc_call_credentials *c = (grpc_call_credentials *)user_data; - expected_md emd[] = {{GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, - test_google_iam_authorization_token}, - {GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, - test_google_iam_authority_selector}}; - GPR_ASSERT(status == GRPC_CREDENTIALS_OK); - GPR_ASSERT(error_details == NULL); - GPR_ASSERT(num_md == 2); - check_metadata(emd, md_elems, num_md); - grpc_call_credentials_unref(exec_ctx, c); +static void check_request_metadata(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + request_metadata_state *state = (request_metadata_state *)arg; + gpr_log(GPR_INFO, "expected_error: %s", + grpc_error_string(state->expected_error)); + gpr_log(GPR_INFO, "actual_error: %s", grpc_error_string(error)); + if (state->expected_error == GRPC_ERROR_NONE) { + GPR_ASSERT(error == GRPC_ERROR_NONE); + } else { + grpc_slice expected_error; + GPR_ASSERT(grpc_error_get_str(state->expected_error, + GRPC_ERROR_STR_DESCRIPTION, &expected_error)); + grpc_slice actual_error; + GPR_ASSERT( + grpc_error_get_str(error, GRPC_ERROR_STR_DESCRIPTION, &actual_error)); + GPR_ASSERT(grpc_slice_cmp(expected_error, actual_error) == 0); + GRPC_ERROR_UNREF(state->expected_error); + } + gpr_log(GPR_INFO, "expected_size=%" PRIdPTR " actual_size=%" PRIdPTR, + state->expected_size, state->md_array.size); + GPR_ASSERT(state->md_array.size == state->expected_size); + check_metadata(state->expected, &state->md_array); + grpc_credentials_mdelem_array_destroy(exec_ctx, &state->md_array); + grpc_pollset_set_destroy(exec_ctx, + grpc_polling_entity_pollset_set(&state->pollent)); + gpr_free(state); +} + +static request_metadata_state *make_request_metadata_state( + grpc_error *expected_error, const expected_md *expected, + size_t expected_size) { + request_metadata_state *state = gpr_zalloc(sizeof(*state)); + state->expected_error = expected_error; + state->expected = expected; + state->expected_size = expected_size; + state->pollent = + grpc_polling_entity_create_from_pollset_set(grpc_pollset_set_create()); + GRPC_CLOSURE_INIT(&state->on_request_metadata, check_request_metadata, state, + grpc_schedule_on_exec_ctx); + return state; +} + +static void run_request_metadata_test(grpc_exec_ctx *exec_ctx, + grpc_call_credentials *creds, + grpc_auth_metadata_context auth_md_ctx, + request_metadata_state *state) { + grpc_error *error = GRPC_ERROR_NONE; + if (grpc_call_credentials_get_request_metadata( + exec_ctx, creds, &state->pollent, auth_md_ctx, &state->md_array, + &state->on_request_metadata, &error)) { + // Synchronous result. Invoke the callback directly. + check_request_metadata(exec_ctx, state, error); + GRPC_ERROR_UNREF(error); + } } static void test_google_iam_creds(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + expected_md emd[] = {{GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, + test_google_iam_authorization_token}, + {GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, + test_google_iam_authority_selector}}; + request_metadata_state *state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_call_credentials *creds = grpc_google_iam_credentials_create( test_google_iam_authorization_token, test_google_iam_authority_selector, NULL); grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; - grpc_call_credentials_get_request_metadata( - &exec_ctx, creds, NULL, auth_md_ctx, check_google_iam_metadata, creds); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); + grpc_call_credentials_unref(&exec_ctx, creds); grpc_exec_ctx_finish(&exec_ctx); } -static void check_access_token_metadata( - grpc_exec_ctx *exec_ctx, void *user_data, grpc_credentials_md *md_elems, - size_t num_md, grpc_credentials_status status, const char *error_details) { - grpc_call_credentials *c = (grpc_call_credentials *)user_data; - expected_md emd[] = {{GRPC_AUTHORIZATION_METADATA_KEY, "Bearer blah"}}; - GPR_ASSERT(status == GRPC_CREDENTIALS_OK); - GPR_ASSERT(error_details == NULL); - GPR_ASSERT(num_md == 1); - check_metadata(emd, md_elems, num_md); - grpc_call_credentials_unref(exec_ctx, c); -} - static void test_access_token_creds(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + expected_md emd[] = {{GRPC_AUTHORIZATION_METADATA_KEY, "Bearer blah"}}; + request_metadata_state *state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_call_credentials *creds = grpc_access_token_credentials_create("blah", NULL); grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; GPR_ASSERT(strcmp(creds->type, GRPC_CALL_CREDENTIALS_TYPE_OAUTH2) == 0); - grpc_call_credentials_get_request_metadata( - &exec_ctx, creds, NULL, auth_md_ctx, check_access_token_metadata, creds); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); + grpc_call_credentials_unref(&exec_ctx, creds); grpc_exec_ctx_finish(&exec_ctx); } @@ -444,30 +454,20 @@ static void test_channel_oauth2_composite_creds(void) { grpc_exec_ctx_finish(&exec_ctx); } -static void check_oauth2_google_iam_composite_metadata( - grpc_exec_ctx *exec_ctx, void *user_data, grpc_credentials_md *md_elems, - size_t num_md, grpc_credentials_status status, const char *error_details) { - grpc_call_credentials *c = (grpc_call_credentials *)user_data; +static void test_oauth2_google_iam_composite_creds(void) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; expected_md emd[] = { {GRPC_AUTHORIZATION_METADATA_KEY, test_oauth2_bearer_token}, {GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, test_google_iam_authorization_token}, {GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, test_google_iam_authority_selector}}; - GPR_ASSERT(status == GRPC_CREDENTIALS_OK); - GPR_ASSERT(error_details == NULL); - GPR_ASSERT(num_md == 3); - check_metadata(emd, md_elems, num_md); - grpc_call_credentials_unref(exec_ctx, c); -} - -static void test_oauth2_google_iam_composite_creds(void) { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - const grpc_call_credentials_array *creds_array; + request_metadata_state *state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; grpc_call_credentials *oauth2_creds = grpc_md_only_test_credentials_create( - "authorization", test_oauth2_bearer_token, 0); + &exec_ctx, "authorization", test_oauth2_bearer_token, 0); grpc_call_credentials *google_iam_creds = grpc_google_iam_credentials_create( test_google_iam_authorization_token, test_google_iam_authority_selector, NULL); @@ -478,16 +478,15 @@ static void test_oauth2_google_iam_composite_creds(void) { grpc_call_credentials_unref(&exec_ctx, google_iam_creds); GPR_ASSERT( strcmp(composite_creds->type, GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE) == 0); - creds_array = + const grpc_call_credentials_array *creds_array = grpc_composite_call_credentials_get_credentials(composite_creds); GPR_ASSERT(creds_array->num_creds == 2); GPR_ASSERT(strcmp(creds_array->creds_array[0]->type, GRPC_CALL_CREDENTIALS_TYPE_OAUTH2) == 0); GPR_ASSERT(strcmp(creds_array->creds_array[1]->type, GRPC_CALL_CREDENTIALS_TYPE_IAM) == 0); - grpc_call_credentials_get_request_metadata( - &exec_ctx, composite_creds, NULL, auth_md_ctx, - check_oauth2_google_iam_composite_metadata, composite_creds); + run_request_metadata_test(&exec_ctx, composite_creds, auth_md_ctx, state); + grpc_call_credentials_unref(&exec_ctx, composite_creds); grpc_exec_ctx_finish(&exec_ctx); } @@ -541,29 +540,6 @@ static void test_channel_oauth2_google_iam_composite_creds(void) { grpc_exec_ctx_finish(&exec_ctx); } -static void on_oauth2_creds_get_metadata_success( - grpc_exec_ctx *exec_ctx, void *user_data, grpc_credentials_md *md_elems, - size_t num_md, grpc_credentials_status status, const char *error_details) { - GPR_ASSERT(status == GRPC_CREDENTIALS_OK); - GPR_ASSERT(error_details == NULL); - GPR_ASSERT(num_md == 1); - GPR_ASSERT(grpc_slice_str_cmp(md_elems[0].key, "authorization") == 0); - GPR_ASSERT(grpc_slice_str_cmp(md_elems[0].value, - "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") == - 0); - GPR_ASSERT(user_data != NULL); - GPR_ASSERT(strcmp((const char *)user_data, test_user_data) == 0); -} - -static void on_oauth2_creds_get_metadata_failure( - grpc_exec_ctx *exec_ctx, void *user_data, grpc_credentials_md *md_elems, - size_t num_md, grpc_credentials_status status, const char *error_details) { - GPR_ASSERT(status == GRPC_CREDENTIALS_ERROR); - GPR_ASSERT(num_md == 0); - GPR_ASSERT(user_data != NULL); - GPR_ASSERT(strcmp((const char *)user_data, test_user_data) == 0); -} - static void validate_compute_engine_http_request( const grpc_httpcli_request *request) { GPR_ASSERT(request->handshaker != &grpc_httpcli_ssl); @@ -616,43 +592,48 @@ static int httpcli_get_should_not_be_called(grpc_exec_ctx *exec_ctx, static void test_compute_engine_creds_success(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_call_credentials *compute_engine_creds = + expected_md emd[] = { + {"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}}; + grpc_call_credentials *creds = grpc_google_compute_engine_credentials_create(NULL); grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; /* First request: http get should be called. */ + request_metadata_state *state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_httpcli_set_override(compute_engine_httpcli_get_success_override, httpcli_post_should_not_be_called); - grpc_call_credentials_get_request_metadata( - &exec_ctx, compute_engine_creds, NULL, auth_md_ctx, - on_oauth2_creds_get_metadata_success, (void *)test_user_data); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); grpc_exec_ctx_flush(&exec_ctx); /* Second request: the cached token should be served directly. */ + state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); - grpc_call_credentials_get_request_metadata( - &exec_ctx, compute_engine_creds, NULL, auth_md_ctx, - on_oauth2_creds_get_metadata_success, (void *)test_user_data); - grpc_exec_ctx_finish(&exec_ctx); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); + grpc_exec_ctx_flush(&exec_ctx); - grpc_call_credentials_unref(&exec_ctx, compute_engine_creds); + grpc_call_credentials_unref(&exec_ctx, creds); grpc_httpcli_set_override(NULL, NULL); + grpc_exec_ctx_finish(&exec_ctx); } static void test_compute_engine_creds_failure(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + request_metadata_state *state = make_request_metadata_state( + GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Error occured when fetching oauth2 token."), + NULL, 0); grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; - grpc_call_credentials *compute_engine_creds = + grpc_call_credentials *creds = grpc_google_compute_engine_credentials_create(NULL); grpc_httpcli_set_override(compute_engine_httpcli_get_failure_override, httpcli_post_should_not_be_called); - grpc_call_credentials_get_request_metadata( - &exec_ctx, compute_engine_creds, NULL, auth_md_ctx, - on_oauth2_creds_get_metadata_failure, (void *)test_user_data); - grpc_call_credentials_unref(&exec_ctx, compute_engine_creds); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); + grpc_call_credentials_unref(&exec_ctx, creds); grpc_httpcli_set_override(NULL, NULL); grpc_exec_ctx_finish(&exec_ctx); } @@ -702,46 +683,48 @@ static int refresh_token_httpcli_post_failure( static void test_refresh_token_creds_success(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + expected_md emd[] = { + {"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}}; grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; - grpc_call_credentials *refresh_token_creds = - grpc_google_refresh_token_credentials_create(test_refresh_token_str, - NULL); + grpc_call_credentials *creds = grpc_google_refresh_token_credentials_create( + test_refresh_token_str, NULL); /* First request: http get should be called. */ + request_metadata_state *state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_httpcli_set_override(httpcli_get_should_not_be_called, refresh_token_httpcli_post_success); - grpc_call_credentials_get_request_metadata( - &exec_ctx, refresh_token_creds, NULL, auth_md_ctx, - on_oauth2_creds_get_metadata_success, (void *)test_user_data); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); grpc_exec_ctx_flush(&exec_ctx); /* Second request: the cached token should be served directly. */ + state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); - grpc_call_credentials_get_request_metadata( - &exec_ctx, refresh_token_creds, NULL, auth_md_ctx, - on_oauth2_creds_get_metadata_success, (void *)test_user_data); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); grpc_exec_ctx_flush(&exec_ctx); - grpc_call_credentials_unref(&exec_ctx, refresh_token_creds); + grpc_call_credentials_unref(&exec_ctx, creds); grpc_httpcli_set_override(NULL, NULL); grpc_exec_ctx_finish(&exec_ctx); } static void test_refresh_token_creds_failure(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + request_metadata_state *state = make_request_metadata_state( + GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Error occured when fetching oauth2 token."), + NULL, 0); grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; - grpc_call_credentials *refresh_token_creds = - grpc_google_refresh_token_credentials_create(test_refresh_token_str, - NULL); + grpc_call_credentials *creds = grpc_google_refresh_token_credentials_create( + test_refresh_token_str, NULL); grpc_httpcli_set_override(httpcli_get_should_not_be_called, refresh_token_httpcli_post_failure); - grpc_call_credentials_get_request_metadata( - &exec_ctx, refresh_token_creds, NULL, auth_md_ctx, - on_oauth2_creds_get_metadata_failure, (void *)test_user_data); - grpc_call_credentials_unref(&exec_ctx, refresh_token_creds); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); + grpc_call_credentials_unref(&exec_ctx, creds); grpc_httpcli_set_override(NULL, NULL); grpc_exec_ctx_finish(&exec_ctx); } @@ -792,30 +775,6 @@ static char *encode_and_sign_jwt_should_not_be_called( return NULL; } -static void on_jwt_creds_get_metadata_success( - grpc_exec_ctx *exec_ctx, void *user_data, grpc_credentials_md *md_elems, - size_t num_md, grpc_credentials_status status, const char *error_details) { - char *expected_md_value; - gpr_asprintf(&expected_md_value, "Bearer %s", test_signed_jwt); - GPR_ASSERT(status == GRPC_CREDENTIALS_OK); - GPR_ASSERT(error_details == NULL); - GPR_ASSERT(num_md == 1); - GPR_ASSERT(grpc_slice_str_cmp(md_elems[0].key, "authorization") == 0); - GPR_ASSERT(grpc_slice_str_cmp(md_elems[0].value, expected_md_value) == 0); - GPR_ASSERT(user_data != NULL); - GPR_ASSERT(strcmp((const char *)user_data, test_user_data) == 0); - gpr_free(expected_md_value); -} - -static void on_jwt_creds_get_metadata_failure( - grpc_exec_ctx *exec_ctx, void *user_data, grpc_credentials_md *md_elems, - size_t num_md, grpc_credentials_status status, const char *error_details) { - GPR_ASSERT(status == GRPC_CREDENTIALS_ERROR); - GPR_ASSERT(num_md == 0); - GPR_ASSERT(user_data != NULL); - GPR_ASSERT(strcmp((const char *)user_data, test_user_data) == 0); -} - static grpc_service_account_jwt_access_credentials *creds_as_jwt( grpc_call_credentials *creds) { GPR_ASSERT(creds != NULL); @@ -860,37 +819,42 @@ static void test_jwt_creds_success(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; - grpc_call_credentials *jwt_creds = + char *expected_md_value; + gpr_asprintf(&expected_md_value, "Bearer %s", test_signed_jwt); + expected_md emd[] = {{"authorization", expected_md_value}}; + grpc_call_credentials *creds = grpc_service_account_jwt_access_credentials_create( json_key_string, grpc_max_auth_token_lifetime(), NULL); /* First request: jwt_encode_and_sign should be called. */ + request_metadata_state *state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_success); - grpc_call_credentials_get_request_metadata( - &exec_ctx, jwt_creds, NULL, auth_md_ctx, - on_jwt_creds_get_metadata_success, (void *)test_user_data); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); grpc_exec_ctx_flush(&exec_ctx); /* Second request: the cached token should be served directly. */ + state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_jwt_encode_and_sign_set_override( encode_and_sign_jwt_should_not_be_called); - grpc_call_credentials_get_request_metadata( - &exec_ctx, jwt_creds, NULL, auth_md_ctx, - on_jwt_creds_get_metadata_success, (void *)test_user_data); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); grpc_exec_ctx_flush(&exec_ctx); /* Third request: Different service url so jwt_encode_and_sign should be called again (no caching). */ + state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); auth_md_ctx.service_url = other_test_service_url; grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_success); - grpc_call_credentials_get_request_metadata( - &exec_ctx, jwt_creds, NULL, auth_md_ctx, - on_jwt_creds_get_metadata_success, (void *)test_user_data); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); grpc_exec_ctx_flush(&exec_ctx); + grpc_call_credentials_unref(&exec_ctx, creds); gpr_free(json_key_string); - grpc_call_credentials_unref(&exec_ctx, jwt_creds); + gpr_free(expected_md_value); grpc_jwt_encode_and_sign_set_override(NULL); + grpc_exec_ctx_finish(&exec_ctx); } static void test_jwt_creds_signing_failure(void) { @@ -898,17 +862,17 @@ static void test_jwt_creds_signing_failure(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; - grpc_call_credentials *jwt_creds = + request_metadata_state *state = make_request_metadata_state( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Could not generate JWT."), NULL, 0); + grpc_call_credentials *creds = grpc_service_account_jwt_access_credentials_create( json_key_string, grpc_max_auth_token_lifetime(), NULL); grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_failure); - grpc_call_credentials_get_request_metadata( - &exec_ctx, jwt_creds, NULL, auth_md_ctx, - on_jwt_creds_get_metadata_failure, (void *)test_user_data); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); gpr_free(json_key_string); - grpc_call_credentials_unref(&exec_ctx, jwt_creds); + grpc_call_credentials_unref(&exec_ctx, creds); grpc_jwt_encode_and_sign_set_override(NULL); grpc_exec_ctx_finish(&exec_ctx); } @@ -986,8 +950,10 @@ static char *null_well_known_creds_path_getter(void) { return NULL; } static void test_google_default_creds_gce(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_composite_channel_credentials *creds; - grpc_channel_credentials *cached_creds; + expected_md emd[] = { + {"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}}; + request_metadata_state *state = + make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; grpc_flush_cached_google_default_credentials(); @@ -999,33 +965,33 @@ static void test_google_default_creds_gce(void) { grpc_httpcli_set_override( default_creds_gce_detection_httpcli_get_success_override, httpcli_post_should_not_be_called); - creds = (grpc_composite_channel_credentials *) - grpc_google_default_credentials_create(); + grpc_composite_channel_credentials *creds = + (grpc_composite_channel_credentials *) + grpc_google_default_credentials_create(); /* Verify that the default creds actually embeds a GCE creds. */ GPR_ASSERT(creds != NULL); GPR_ASSERT(creds->call_creds != NULL); grpc_httpcli_set_override(compute_engine_httpcli_get_success_override, httpcli_post_should_not_be_called); - grpc_call_credentials_get_request_metadata( - &exec_ctx, creds->call_creds, NULL, auth_md_ctx, - on_oauth2_creds_get_metadata_success, (void *)test_user_data); + run_request_metadata_test(&exec_ctx, creds->call_creds, auth_md_ctx, state); grpc_exec_ctx_flush(&exec_ctx); - grpc_exec_ctx_finish(&exec_ctx); /* Check that we get a cached creds if we call grpc_google_default_credentials_create again. GCE detection should not occur anymore either. */ grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); - cached_creds = grpc_google_default_credentials_create(); + grpc_channel_credentials *cached_creds = + grpc_google_default_credentials_create(); GPR_ASSERT(cached_creds == &creds->base); /* Cleanup. */ - grpc_channel_credentials_release(cached_creds); - grpc_channel_credentials_release(&creds->base); + grpc_channel_credentials_unref(&exec_ctx, cached_creds); + grpc_channel_credentials_unref(&exec_ctx, &creds->base); grpc_httpcli_set_override(NULL, NULL); grpc_override_well_known_credentials_path_getter(NULL); + grpc_exec_ctx_finish(&exec_ctx); } static int default_creds_gce_detection_httpcli_get_failure_override( @@ -1068,12 +1034,7 @@ typedef enum { PLUGIN_DESTROY_CALLED_STATE } plugin_state; -typedef struct { - const char *key; - const char *value; -} plugin_metadata; - -static const plugin_metadata plugin_md[] = {{"foo", "bar"}, {"hi", "there"}}; +static const expected_md plugin_md[] = {{"foo", "bar"}, {"hi", "there"}}; static void plugin_get_metadata_success(void *state, grpc_auth_metadata_context context, @@ -1110,79 +1071,60 @@ static void plugin_get_metadata_failure(void *state, cb(user_data, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, plugin_error_details); } -static void on_plugin_metadata_received_success( - grpc_exec_ctx *exec_ctx, void *user_data, grpc_credentials_md *md_elems, - size_t num_md, grpc_credentials_status status, const char *error_details) { - size_t i = 0; - GPR_ASSERT(user_data == NULL); - GPR_ASSERT(md_elems != NULL); - GPR_ASSERT(num_md == GPR_ARRAY_SIZE(plugin_md)); - for (i = 0; i < num_md; i++) { - GPR_ASSERT(grpc_slice_str_cmp(md_elems[i].key, plugin_md[i].key) == 0); - GPR_ASSERT(grpc_slice_str_cmp(md_elems[i].value, plugin_md[i].value) == 0); - } -} - -static void on_plugin_metadata_received_failure( - grpc_exec_ctx *exec_ctx, void *user_data, grpc_credentials_md *md_elems, - size_t num_md, grpc_credentials_status status, const char *error_details) { - GPR_ASSERT(user_data == NULL); - GPR_ASSERT(md_elems == NULL); - GPR_ASSERT(num_md == 0); - GPR_ASSERT(status == GRPC_CREDENTIALS_ERROR); - GPR_ASSERT(error_details != NULL); - GPR_ASSERT(strcmp(error_details, plugin_error_details) == 0); -} - static void plugin_destroy(void *state) { plugin_state *s = (plugin_state *)state; *s = PLUGIN_DESTROY_CALLED_STATE; } static void test_metadata_plugin_success(void) { - grpc_call_credentials *creds; plugin_state state = PLUGIN_INITIAL_STATE; grpc_metadata_credentials_plugin plugin; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; + request_metadata_state *md_state = make_request_metadata_state( + GRPC_ERROR_NONE, plugin_md, GPR_ARRAY_SIZE(plugin_md)); plugin.state = &state; plugin.get_metadata = plugin_get_metadata_success; plugin.destroy = plugin_destroy; - creds = grpc_metadata_credentials_create_from_plugin(plugin, NULL); + grpc_call_credentials *creds = + grpc_metadata_credentials_create_from_plugin(plugin, NULL); GPR_ASSERT(state == PLUGIN_INITIAL_STATE); - grpc_call_credentials_get_request_metadata( - &exec_ctx, creds, NULL, auth_md_ctx, on_plugin_metadata_received_success, - NULL); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, md_state); GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE); - grpc_call_credentials_release(creds); - GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE); + grpc_call_credentials_unref(&exec_ctx, creds); grpc_exec_ctx_finish(&exec_ctx); + GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE); } static void test_metadata_plugin_failure(void) { - grpc_call_credentials *creds; plugin_state state = PLUGIN_INITIAL_STATE; grpc_metadata_credentials_plugin plugin; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; + char *expected_error; + gpr_asprintf(&expected_error, + "Getting metadata from plugin failed with error: %s", + plugin_error_details); + request_metadata_state *md_state = make_request_metadata_state( + GRPC_ERROR_CREATE_FROM_COPIED_STRING(expected_error), NULL, 0); + gpr_free(expected_error); plugin.state = &state; plugin.get_metadata = plugin_get_metadata_failure; plugin.destroy = plugin_destroy; - creds = grpc_metadata_credentials_create_from_plugin(plugin, NULL); + grpc_call_credentials *creds = + grpc_metadata_credentials_create_from_plugin(plugin, NULL); GPR_ASSERT(state == PLUGIN_INITIAL_STATE); - grpc_call_credentials_get_request_metadata( - &exec_ctx, creds, NULL, auth_md_ctx, on_plugin_metadata_received_failure, - NULL); + run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, md_state); GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE); - grpc_call_credentials_release(creds); - GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE); + grpc_call_credentials_unref(&exec_ctx, creds); grpc_exec_ctx_finish(&exec_ctx); + GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE); } static void test_get_well_known_google_credentials_file_path(void) { @@ -1233,12 +1175,9 @@ static void test_channel_creds_duplicate_without_call_creds(void) { int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); - test_empty_md_store(); - test_ref_unref_empty_md_store(); - test_add_to_empty_md_store(); - test_add_cstrings_to_empty_md_store(); - test_empty_preallocated_md_store(); - test_add_abunch_to_md_store(); + test_empty_md_array(); + test_add_to_empty_md_array(); + test_add_abunch_to_md_array(); test_oauth2_token_fetcher_creds_parsing_ok(); test_oauth2_token_fetcher_creds_parsing_bad_http_status(); test_oauth2_token_fetcher_creds_parsing_empty_http_body(); diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c index e2331fbd97..fdbc6ea741 100644 --- a/test/core/security/oauth2_utils.c +++ b/test/core/security/oauth2_utils.c @@ -32,29 +32,31 @@ typedef struct { gpr_mu *mu; grpc_polling_entity pops; - int is_done; + bool is_done; char *token; + + grpc_credentials_mdelem_array md_array; + grpc_closure closure; } oauth2_request; -static void on_oauth2_response(grpc_exec_ctx *exec_ctx, void *user_data, - grpc_credentials_md *md_elems, size_t num_md, - grpc_credentials_status status, - const char *error_details) { - oauth2_request *request = (oauth2_request *)user_data; +static void on_oauth2_response(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + oauth2_request *request = (oauth2_request *)arg; char *token = NULL; grpc_slice token_slice; - if (status == GRPC_CREDENTIALS_ERROR) { - gpr_log(GPR_ERROR, "Fetching token failed."); + if (error != GRPC_ERROR_NONE) { + gpr_log(GPR_ERROR, "Fetching token failed: %s", grpc_error_string(error)); } else { - GPR_ASSERT(num_md == 1); - token_slice = md_elems[0].value; + GPR_ASSERT(request->md_array.size == 1); + token_slice = GRPC_MDVALUE(request->md_array.md[0]); token = (char *)gpr_malloc(GRPC_SLICE_LENGTH(token_slice) + 1); memcpy(token, GRPC_SLICE_START_PTR(token_slice), GRPC_SLICE_LENGTH(token_slice)); token[GRPC_SLICE_LENGTH(token_slice)] = '\0'; } + grpc_credentials_mdelem_array_destroy(exec_ctx, &request->md_array); gpr_mu_lock(request->mu); - request->is_done = 1; + request->is_done = true; request->token = token; GRPC_LOG_IF_ERROR( "pollset_kick", @@ -68,6 +70,7 @@ static void do_nothing(grpc_exec_ctx *exec_ctx, void *unused, char *grpc_test_fetch_oauth2_token_with_credentials( grpc_call_credentials *creds) { oauth2_request request; + memset(&request, 0, sizeof(request)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_closure do_nothing_closure; grpc_auth_metadata_context null_ctx = {"", "", NULL, NULL}; @@ -75,15 +78,23 @@ char *grpc_test_fetch_oauth2_token_with_credentials( grpc_pollset *pollset = (grpc_pollset *)gpr_zalloc(grpc_pollset_size()); grpc_pollset_init(pollset, &request.mu); request.pops = grpc_polling_entity_create_from_pollset(pollset); - request.is_done = 0; + request.is_done = false; GRPC_CLOSURE_INIT(&do_nothing_closure, do_nothing, NULL, grpc_schedule_on_exec_ctx); - grpc_call_credentials_get_request_metadata( - &exec_ctx, creds, &request.pops, null_ctx, on_oauth2_response, &request); + GRPC_CLOSURE_INIT(&request.closure, on_oauth2_response, &request, + grpc_schedule_on_exec_ctx); - grpc_exec_ctx_finish(&exec_ctx); + grpc_error *error = GRPC_ERROR_NONE; + if (grpc_call_credentials_get_request_metadata( + &exec_ctx, creds, &request.pops, null_ctx, &request.md_array, + &request.closure, &error)) { + // Synchronous result; invoke callback directly. + on_oauth2_response(&exec_ctx, &request, error); + GRPC_ERROR_UNREF(error); + } + grpc_exec_ctx_flush(&exec_ctx); gpr_mu_lock(request.mu); while (!request.is_done) { @@ -94,7 +105,7 @@ char *grpc_test_fetch_oauth2_token_with_credentials( grpc_polling_entity_pollset(&request.pops), &worker, gpr_now(GPR_CLOCK_MONOTONIC), gpr_inf_future(GPR_CLOCK_MONOTONIC)))) { - request.is_done = 1; + request.is_done = true; } } gpr_mu_unlock(request.mu); diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.c index 3c3d3a7c10..e1385a80ca 100644 --- a/test/core/security/print_google_default_creds_token.c +++ b/test/core/security/print_google_default_creds_token.c @@ -35,25 +35,26 @@ typedef struct { gpr_mu *mu; grpc_polling_entity pops; - int is_done; + bool is_done; + + grpc_credentials_mdelem_array md_array; + grpc_closure on_request_metadata; } synchronizer; -static void on_metadata_response(grpc_exec_ctx *exec_ctx, void *user_data, - grpc_credentials_md *md_elems, size_t num_md, - grpc_credentials_status status, - const char *error_details) { - synchronizer *sync = user_data; - if (status == GRPC_CREDENTIALS_ERROR) { - fprintf(stderr, "Fetching token failed.\n"); +static void on_metadata_response(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + synchronizer *sync = arg; + if (error != GRPC_ERROR_NONE) { + fprintf(stderr, "Fetching token failed: %s\n", grpc_error_string(error)); } else { char *token; - GPR_ASSERT(num_md == 1); - token = grpc_slice_to_c_string(md_elems[0].value); + GPR_ASSERT(sync->md_array.size == 1); + token = grpc_slice_to_c_string(GRPC_MDVALUE(sync->md_array.md[0])); printf("\nGot token: %s\n\n", token); gpr_free(token); } gpr_mu_lock(sync->mu); - sync->is_done = 1; + sync->is_done = true; GRPC_LOG_IF_ERROR( "pollset_kick", grpc_pollset_kick(grpc_polling_entity_pollset(&sync->pops), NULL)); @@ -83,14 +84,23 @@ int main(int argc, char **argv) { goto end; } + memset(&sync, 0, sizeof(sync)); grpc_pollset *pollset = gpr_zalloc(grpc_pollset_size()); grpc_pollset_init(pollset, &sync.mu); sync.pops = grpc_polling_entity_create_from_pollset(pollset); - sync.is_done = 0; + sync.is_done = false; + GRPC_CLOSURE_INIT(&sync.on_request_metadata, on_metadata_response, &sync, + grpc_schedule_on_exec_ctx); - grpc_call_credentials_get_request_metadata( - &exec_ctx, ((grpc_composite_channel_credentials *)creds)->call_creds, - &sync.pops, context, on_metadata_response, &sync); + grpc_error *error = GRPC_ERROR_NONE; + if (grpc_call_credentials_get_request_metadata( + &exec_ctx, ((grpc_composite_channel_credentials *)creds)->call_creds, + &sync.pops, context, &sync.md_array, &sync.on_request_metadata, + &error)) { + // Synchronous response. Invoke callback directly. + on_metadata_response(&exec_ctx, &sync, error); + GRPC_ERROR_UNREF(error); + } gpr_mu_lock(sync.mu); while (!sync.is_done) { @@ -101,7 +111,7 @@ int main(int argc, char **argv) { grpc_polling_entity_pollset(&sync.pops), &worker, gpr_now(GPR_CLOCK_MONOTONIC), gpr_inf_future(GPR_CLOCK_MONOTONIC)))) - sync.is_done = 1; + sync.is_done = true; gpr_mu_unlock(sync.mu); grpc_exec_ctx_flush(&exec_ctx); gpr_mu_lock(sync.mu); diff --git a/test/core/slice/BUILD b/test/core/slice/BUILD index 9f2225adfb..f86a3a6082 100644 --- a/test/core/slice/BUILD +++ b/test/core/slice/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") -licenses(["notice"]) # Apache v2 +grpc_package(name = "test/core/slice") -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +licenses(["notice"]) # Apache v2 load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") diff --git a/test/core/support/BUILD b/test/core/support/BUILD index 7e142c1e3f..096576e13c 100644 --- a/test/core/support/BUILD +++ b/test/core/support/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") licenses(["notice"]) # Apache v2 -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/support") grpc_cc_test( name = "alloc_test", diff --git a/test/core/support/avl_test.c b/test/core/support/avl_test.c index cd352d3d1d..37424d6405 100644 --- a/test/core/support/avl_test.c +++ b/test/core/support/avl_test.c @@ -33,29 +33,31 @@ static int *box(int x) { return b; } -static long int_compare(void *int1, void *int2) { +static long int_compare(void *int1, void *int2, void *unused) { return (*(int *)int1) - (*(int *)int2); } -static void *int_copy(void *p) { return box(*(int *)p); } +static void *int_copy(void *p, void *unused) { return box(*(int *)p); } -static const gpr_avl_vtable int_int_vtable = {gpr_free, int_copy, int_compare, - gpr_free, int_copy}; +static void destroy(void *p, void *unused) { gpr_free(p); } + +static const gpr_avl_vtable int_int_vtable = {destroy, int_copy, int_compare, + destroy, int_copy}; static void check_get(gpr_avl avl, int key, int value) { int *k = box(key); - GPR_ASSERT(*(int *)gpr_avl_get(avl, k) == value); + GPR_ASSERT(*(int *)gpr_avl_get(avl, k, NULL) == value); gpr_free(k); } static void check_negget(gpr_avl avl, int key) { int *k = box(key); - GPR_ASSERT(gpr_avl_get(avl, k) == NULL); + GPR_ASSERT(gpr_avl_get(avl, k, NULL) == NULL); gpr_free(k); } static gpr_avl remove_int(gpr_avl avl, int key) { int *k = box(key); - avl = gpr_avl_remove(avl, k); + avl = gpr_avl_remove(avl, k, NULL); gpr_free(k); return avl; } @@ -64,94 +66,94 @@ static void test_get(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_get"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(1), box(11)); - avl = gpr_avl_add(avl, box(2), box(22)); - avl = gpr_avl_add(avl, box(3), box(33)); + avl = gpr_avl_add(avl, box(1), box(11), NULL); + avl = gpr_avl_add(avl, box(2), box(22), NULL); + avl = gpr_avl_add(avl, box(3), box(33), NULL); check_get(avl, 1, 11); check_get(avl, 2, 22); check_get(avl, 3, 33); check_negget(avl, 4); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } static void test_ll(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_ll"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(5), box(1)); - avl = gpr_avl_add(avl, box(4), box(2)); - avl = gpr_avl_add(avl, box(3), box(3)); + avl = gpr_avl_add(avl, box(5), box(1), NULL); + avl = gpr_avl_add(avl, box(4), box(2), NULL); + avl = gpr_avl_add(avl, box(3), box(3), NULL); GPR_ASSERT(*(int *)avl.root->key == 4); GPR_ASSERT(*(int *)avl.root->left->key == 3); GPR_ASSERT(*(int *)avl.root->right->key == 5); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } static void test_lr(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_lr"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(5), box(1)); - avl = gpr_avl_add(avl, box(3), box(2)); - avl = gpr_avl_add(avl, box(4), box(3)); + avl = gpr_avl_add(avl, box(5), box(1), NULL); + avl = gpr_avl_add(avl, box(3), box(2), NULL); + avl = gpr_avl_add(avl, box(4), box(3), NULL); GPR_ASSERT(*(int *)avl.root->key == 4); GPR_ASSERT(*(int *)avl.root->left->key == 3); GPR_ASSERT(*(int *)avl.root->right->key == 5); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } static void test_rr(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_rr"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(3), box(1)); - avl = gpr_avl_add(avl, box(4), box(2)); - avl = gpr_avl_add(avl, box(5), box(3)); + avl = gpr_avl_add(avl, box(3), box(1), NULL); + avl = gpr_avl_add(avl, box(4), box(2), NULL); + avl = gpr_avl_add(avl, box(5), box(3), NULL); GPR_ASSERT(*(int *)avl.root->key == 4); GPR_ASSERT(*(int *)avl.root->left->key == 3); GPR_ASSERT(*(int *)avl.root->right->key == 5); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } static void test_rl(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_rl"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(3), box(1)); - avl = gpr_avl_add(avl, box(5), box(2)); - avl = gpr_avl_add(avl, box(4), box(3)); + avl = gpr_avl_add(avl, box(3), box(1), NULL); + avl = gpr_avl_add(avl, box(5), box(2), NULL); + avl = gpr_avl_add(avl, box(4), box(3), NULL); GPR_ASSERT(*(int *)avl.root->key == 4); GPR_ASSERT(*(int *)avl.root->left->key == 3); GPR_ASSERT(*(int *)avl.root->right->key == 5); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } static void test_unbalanced(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_unbalanced"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(5), box(1)); - avl = gpr_avl_add(avl, box(4), box(2)); - avl = gpr_avl_add(avl, box(3), box(3)); - avl = gpr_avl_add(avl, box(2), box(4)); - avl = gpr_avl_add(avl, box(1), box(5)); + avl = gpr_avl_add(avl, box(5), box(1), NULL); + avl = gpr_avl_add(avl, box(4), box(2), NULL); + avl = gpr_avl_add(avl, box(3), box(3), NULL); + avl = gpr_avl_add(avl, box(2), box(4), NULL); + avl = gpr_avl_add(avl, box(1), box(5), NULL); GPR_ASSERT(*(int *)avl.root->key == 4); GPR_ASSERT(*(int *)avl.root->left->key == 2); GPR_ASSERT(*(int *)avl.root->left->left->key == 1); GPR_ASSERT(*(int *)avl.root->left->right->key == 3); GPR_ASSERT(*(int *)avl.root->right->key == 5); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } static void test_replace(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_replace"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(1), box(1)); - avl = gpr_avl_add(avl, box(1), box(2)); + avl = gpr_avl_add(avl, box(1), box(1), NULL); + avl = gpr_avl_add(avl, box(1), box(2), NULL); check_get(avl, 1, 2); check_negget(avl, 2); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } static void test_remove(void) { @@ -159,36 +161,36 @@ static void test_remove(void) { gpr_avl avl3, avl4, avl5, avln; gpr_log(GPR_DEBUG, "test_remove"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(3), box(1)); - avl = gpr_avl_add(avl, box(4), box(2)); - avl = gpr_avl_add(avl, box(5), box(3)); + avl = gpr_avl_add(avl, box(3), box(1), NULL); + avl = gpr_avl_add(avl, box(4), box(2), NULL); + avl = gpr_avl_add(avl, box(5), box(3), NULL); - avl3 = remove_int(gpr_avl_ref(avl), 3); - avl4 = remove_int(gpr_avl_ref(avl), 4); - avl5 = remove_int(gpr_avl_ref(avl), 5); - avln = remove_int(gpr_avl_ref(avl), 1); + avl3 = remove_int(gpr_avl_ref(avl, NULL), 3); + avl4 = remove_int(gpr_avl_ref(avl, NULL), 4); + avl5 = remove_int(gpr_avl_ref(avl, NULL), 5); + avln = remove_int(gpr_avl_ref(avl, NULL), 1); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); check_negget(avl3, 3); check_get(avl3, 4, 2); check_get(avl3, 5, 3); - gpr_avl_unref(avl3); + gpr_avl_unref(avl3, NULL); check_get(avl4, 3, 1); check_negget(avl4, 4); check_get(avl4, 5, 3); - gpr_avl_unref(avl4); + gpr_avl_unref(avl4, NULL); check_get(avl5, 3, 1); check_get(avl5, 4, 2); check_negget(avl5, 5); - gpr_avl_unref(avl5); + gpr_avl_unref(avl5, NULL); check_get(avln, 3, 1); check_get(avln, 4, 2); check_get(avln, 5, 3); - gpr_avl_unref(avln); + gpr_avl_unref(avln, NULL); } static void test_badcase1(void) { @@ -197,44 +199,44 @@ static void test_badcase1(void) { gpr_log(GPR_DEBUG, "test_badcase1"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(88), box(1)); + avl = gpr_avl_add(avl, box(88), box(1), NULL); avl = remove_int(avl, 643); avl = remove_int(avl, 983); - avl = gpr_avl_add(avl, box(985), box(4)); - avl = gpr_avl_add(avl, box(640), box(5)); - avl = gpr_avl_add(avl, box(41), box(6)); - avl = gpr_avl_add(avl, box(112), box(7)); - avl = gpr_avl_add(avl, box(342), box(8)); + avl = gpr_avl_add(avl, box(985), box(4), NULL); + avl = gpr_avl_add(avl, box(640), box(5), NULL); + avl = gpr_avl_add(avl, box(41), box(6), NULL); + avl = gpr_avl_add(avl, box(112), box(7), NULL); + avl = gpr_avl_add(avl, box(342), box(8), NULL); avl = remove_int(avl, 1013); - avl = gpr_avl_add(avl, box(434), box(10)); - avl = gpr_avl_add(avl, box(520), box(11)); - avl = gpr_avl_add(avl, box(231), box(12)); - avl = gpr_avl_add(avl, box(852), box(13)); + avl = gpr_avl_add(avl, box(434), box(10), NULL); + avl = gpr_avl_add(avl, box(520), box(11), NULL); + avl = gpr_avl_add(avl, box(231), box(12), NULL); + avl = gpr_avl_add(avl, box(852), box(13), NULL); avl = remove_int(avl, 461); - avl = gpr_avl_add(avl, box(108), box(15)); - avl = gpr_avl_add(avl, box(806), box(16)); - avl = gpr_avl_add(avl, box(827), box(17)); + avl = gpr_avl_add(avl, box(108), box(15), NULL); + avl = gpr_avl_add(avl, box(806), box(16), NULL); + avl = gpr_avl_add(avl, box(827), box(17), NULL); avl = remove_int(avl, 796); - avl = gpr_avl_add(avl, box(340), box(19)); - avl = gpr_avl_add(avl, box(498), box(20)); - avl = gpr_avl_add(avl, box(203), box(21)); - avl = gpr_avl_add(avl, box(751), box(22)); - avl = gpr_avl_add(avl, box(150), box(23)); + avl = gpr_avl_add(avl, box(340), box(19), NULL); + avl = gpr_avl_add(avl, box(498), box(20), NULL); + avl = gpr_avl_add(avl, box(203), box(21), NULL); + avl = gpr_avl_add(avl, box(751), box(22), NULL); + avl = gpr_avl_add(avl, box(150), box(23), NULL); avl = remove_int(avl, 237); - avl = gpr_avl_add(avl, box(830), box(25)); + avl = gpr_avl_add(avl, box(830), box(25), NULL); avl = remove_int(avl, 1007); avl = remove_int(avl, 394); - avl = gpr_avl_add(avl, box(65), box(28)); + avl = gpr_avl_add(avl, box(65), box(28), NULL); avl = remove_int(avl, 904); avl = remove_int(avl, 123); - avl = gpr_avl_add(avl, box(238), box(31)); - avl = gpr_avl_add(avl, box(184), box(32)); + avl = gpr_avl_add(avl, box(238), box(31), NULL); + avl = gpr_avl_add(avl, box(184), box(32), NULL); avl = remove_int(avl, 331); - avl = gpr_avl_add(avl, box(827), box(34)); + avl = gpr_avl_add(avl, box(827), box(34), NULL); check_get(avl, 830, 25); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } static void test_badcase2(void) { @@ -243,254 +245,254 @@ static void test_badcase2(void) { gpr_log(GPR_DEBUG, "test_badcase2"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(288), box(1)); + avl = gpr_avl_add(avl, box(288), box(1), NULL); avl = remove_int(avl, 415); - avl = gpr_avl_add(avl, box(953), box(3)); - avl = gpr_avl_add(avl, box(101), box(4)); - avl = gpr_avl_add(avl, box(516), box(5)); - avl = gpr_avl_add(avl, box(547), box(6)); - avl = gpr_avl_add(avl, box(467), box(7)); - avl = gpr_avl_add(avl, box(793), box(8)); + avl = gpr_avl_add(avl, box(953), box(3), NULL); + avl = gpr_avl_add(avl, box(101), box(4), NULL); + avl = gpr_avl_add(avl, box(516), box(5), NULL); + avl = gpr_avl_add(avl, box(547), box(6), NULL); + avl = gpr_avl_add(avl, box(467), box(7), NULL); + avl = gpr_avl_add(avl, box(793), box(8), NULL); avl = remove_int(avl, 190); - avl = gpr_avl_add(avl, box(687), box(10)); - avl = gpr_avl_add(avl, box(242), box(11)); - avl = gpr_avl_add(avl, box(142), box(12)); + avl = gpr_avl_add(avl, box(687), box(10), NULL); + avl = gpr_avl_add(avl, box(242), box(11), NULL); + avl = gpr_avl_add(avl, box(142), box(12), NULL); avl = remove_int(avl, 705); avl = remove_int(avl, 578); avl = remove_int(avl, 767); avl = remove_int(avl, 183); - avl = gpr_avl_add(avl, box(950), box(17)); - avl = gpr_avl_add(avl, box(622), box(18)); + avl = gpr_avl_add(avl, box(950), box(17), NULL); + avl = gpr_avl_add(avl, box(622), box(18), NULL); avl = remove_int(avl, 513); avl = remove_int(avl, 429); - avl = gpr_avl_add(avl, box(205), box(21)); + avl = gpr_avl_add(avl, box(205), box(21), NULL); avl = remove_int(avl, 663); avl = remove_int(avl, 953); avl = remove_int(avl, 892); - avl = gpr_avl_add(avl, box(236), box(25)); + avl = gpr_avl_add(avl, box(236), box(25), NULL); avl = remove_int(avl, 982); avl = remove_int(avl, 201); avl = remove_int(avl, 684); - avl = gpr_avl_add(avl, box(572), box(29)); + avl = gpr_avl_add(avl, box(572), box(29), NULL); avl = remove_int(avl, 817); - avl = gpr_avl_add(avl, box(970), box(31)); + avl = gpr_avl_add(avl, box(970), box(31), NULL); avl = remove_int(avl, 347); avl = remove_int(avl, 574); - avl = gpr_avl_add(avl, box(752), box(34)); - avl = gpr_avl_add(avl, box(670), box(35)); - avl = gpr_avl_add(avl, box(69), box(36)); + avl = gpr_avl_add(avl, box(752), box(34), NULL); + avl = gpr_avl_add(avl, box(670), box(35), NULL); + avl = gpr_avl_add(avl, box(69), box(36), NULL); avl = remove_int(avl, 111); avl = remove_int(avl, 523); - avl = gpr_avl_add(avl, box(141), box(39)); + avl = gpr_avl_add(avl, box(141), box(39), NULL); avl = remove_int(avl, 159); - avl = gpr_avl_add(avl, box(947), box(41)); - avl = gpr_avl_add(avl, box(855), box(42)); + avl = gpr_avl_add(avl, box(947), box(41), NULL); + avl = gpr_avl_add(avl, box(855), box(42), NULL); avl = remove_int(avl, 218); avl = remove_int(avl, 6); - avl = gpr_avl_add(avl, box(753), box(45)); + avl = gpr_avl_add(avl, box(753), box(45), NULL); avl = remove_int(avl, 82); avl = remove_int(avl, 799); - avl = gpr_avl_add(avl, box(572), box(48)); + avl = gpr_avl_add(avl, box(572), box(48), NULL); avl = remove_int(avl, 376); avl = remove_int(avl, 413); - avl = gpr_avl_add(avl, box(458), box(51)); + avl = gpr_avl_add(avl, box(458), box(51), NULL); avl = remove_int(avl, 897); - avl = gpr_avl_add(avl, box(191), box(53)); - avl = gpr_avl_add(avl, box(609), box(54)); + avl = gpr_avl_add(avl, box(191), box(53), NULL); + avl = gpr_avl_add(avl, box(609), box(54), NULL); avl = remove_int(avl, 787); avl = remove_int(avl, 710); avl = remove_int(avl, 886); avl = remove_int(avl, 835); avl = remove_int(avl, 33); - avl = gpr_avl_add(avl, box(871), box(60)); + avl = gpr_avl_add(avl, box(871), box(60), NULL); avl = remove_int(avl, 641); - avl = gpr_avl_add(avl, box(462), box(62)); + avl = gpr_avl_add(avl, box(462), box(62), NULL); avl = remove_int(avl, 359); avl = remove_int(avl, 767); - avl = gpr_avl_add(avl, box(310), box(65)); + avl = gpr_avl_add(avl, box(310), box(65), NULL); avl = remove_int(avl, 757); avl = remove_int(avl, 639); avl = remove_int(avl, 314); - avl = gpr_avl_add(avl, box(2), box(69)); + avl = gpr_avl_add(avl, box(2), box(69), NULL); avl = remove_int(avl, 138); - avl = gpr_avl_add(avl, box(669), box(71)); + avl = gpr_avl_add(avl, box(669), box(71), NULL); avl = remove_int(avl, 477); - avl = gpr_avl_add(avl, box(366), box(73)); - avl = gpr_avl_add(avl, box(612), box(74)); - avl = gpr_avl_add(avl, box(106), box(75)); + avl = gpr_avl_add(avl, box(366), box(73), NULL); + avl = gpr_avl_add(avl, box(612), box(74), NULL); + avl = gpr_avl_add(avl, box(106), box(75), NULL); avl = remove_int(avl, 161); - avl = gpr_avl_add(avl, box(388), box(77)); - avl = gpr_avl_add(avl, box(141), box(78)); + avl = gpr_avl_add(avl, box(388), box(77), NULL); + avl = gpr_avl_add(avl, box(141), box(78), NULL); avl = remove_int(avl, 633); avl = remove_int(avl, 459); - avl = gpr_avl_add(avl, box(40), box(81)); + avl = gpr_avl_add(avl, box(40), box(81), NULL); avl = remove_int(avl, 689); - avl = gpr_avl_add(avl, box(823), box(83)); + avl = gpr_avl_add(avl, box(823), box(83), NULL); avl = remove_int(avl, 485); - avl = gpr_avl_add(avl, box(903), box(85)); - avl = gpr_avl_add(avl, box(592), box(86)); + avl = gpr_avl_add(avl, box(903), box(85), NULL); + avl = gpr_avl_add(avl, box(592), box(86), NULL); avl = remove_int(avl, 448); - avl = gpr_avl_add(avl, box(56), box(88)); + avl = gpr_avl_add(avl, box(56), box(88), NULL); avl = remove_int(avl, 333); - avl = gpr_avl_add(avl, box(189), box(90)); - avl = gpr_avl_add(avl, box(103), box(91)); + avl = gpr_avl_add(avl, box(189), box(90), NULL); + avl = gpr_avl_add(avl, box(103), box(91), NULL); avl = remove_int(avl, 164); avl = remove_int(avl, 974); - avl = gpr_avl_add(avl, box(215), box(94)); + avl = gpr_avl_add(avl, box(215), box(94), NULL); avl = remove_int(avl, 189); avl = remove_int(avl, 504); - avl = gpr_avl_add(avl, box(868), box(97)); + avl = gpr_avl_add(avl, box(868), box(97), NULL); avl = remove_int(avl, 909); avl = remove_int(avl, 148); avl = remove_int(avl, 469); - avl = gpr_avl_add(avl, box(994), box(101)); - avl = gpr_avl_add(avl, box(576), box(102)); + avl = gpr_avl_add(avl, box(994), box(101), NULL); + avl = gpr_avl_add(avl, box(576), box(102), NULL); avl = remove_int(avl, 82); avl = remove_int(avl, 209); - avl = gpr_avl_add(avl, box(276), box(105)); + avl = gpr_avl_add(avl, box(276), box(105), NULL); avl = remove_int(avl, 856); - avl = gpr_avl_add(avl, box(750), box(107)); + avl = gpr_avl_add(avl, box(750), box(107), NULL); avl = remove_int(avl, 871); - avl = gpr_avl_add(avl, box(301), box(109)); + avl = gpr_avl_add(avl, box(301), box(109), NULL); avl = remove_int(avl, 260); avl = remove_int(avl, 737); avl = remove_int(avl, 719); - avl = gpr_avl_add(avl, box(933), box(113)); - avl = gpr_avl_add(avl, box(225), box(114)); - avl = gpr_avl_add(avl, box(975), box(115)); - avl = gpr_avl_add(avl, box(86), box(116)); + avl = gpr_avl_add(avl, box(933), box(113), NULL); + avl = gpr_avl_add(avl, box(225), box(114), NULL); + avl = gpr_avl_add(avl, box(975), box(115), NULL); + avl = gpr_avl_add(avl, box(86), box(116), NULL); avl = remove_int(avl, 732); - avl = gpr_avl_add(avl, box(340), box(118)); - avl = gpr_avl_add(avl, box(271), box(119)); + avl = gpr_avl_add(avl, box(340), box(118), NULL); + avl = gpr_avl_add(avl, box(271), box(119), NULL); avl = remove_int(avl, 206); - avl = gpr_avl_add(avl, box(949), box(121)); - avl = gpr_avl_add(avl, box(927), box(122)); - avl = gpr_avl_add(avl, box(34), box(123)); - avl = gpr_avl_add(avl, box(351), box(124)); + avl = gpr_avl_add(avl, box(949), box(121), NULL); + avl = gpr_avl_add(avl, box(927), box(122), NULL); + avl = gpr_avl_add(avl, box(34), box(123), NULL); + avl = gpr_avl_add(avl, box(351), box(124), NULL); avl = remove_int(avl, 836); - avl = gpr_avl_add(avl, box(825), box(126)); - avl = gpr_avl_add(avl, box(352), box(127)); + avl = gpr_avl_add(avl, box(825), box(126), NULL); + avl = gpr_avl_add(avl, box(352), box(127), NULL); avl = remove_int(avl, 107); avl = remove_int(avl, 101); - avl = gpr_avl_add(avl, box(320), box(130)); - avl = gpr_avl_add(avl, box(3), box(131)); + avl = gpr_avl_add(avl, box(320), box(130), NULL); + avl = gpr_avl_add(avl, box(3), box(131), NULL); avl = remove_int(avl, 998); avl = remove_int(avl, 44); - avl = gpr_avl_add(avl, box(525), box(134)); - avl = gpr_avl_add(avl, box(864), box(135)); - avl = gpr_avl_add(avl, box(863), box(136)); + avl = gpr_avl_add(avl, box(525), box(134), NULL); + avl = gpr_avl_add(avl, box(864), box(135), NULL); + avl = gpr_avl_add(avl, box(863), box(136), NULL); avl = remove_int(avl, 770); - avl = gpr_avl_add(avl, box(440), box(138)); + avl = gpr_avl_add(avl, box(440), box(138), NULL); avl = remove_int(avl, 516); - avl = gpr_avl_add(avl, box(116), box(140)); + avl = gpr_avl_add(avl, box(116), box(140), NULL); avl = remove_int(avl, 380); - avl = gpr_avl_add(avl, box(878), box(142)); + avl = gpr_avl_add(avl, box(878), box(142), NULL); avl = remove_int(avl, 439); - avl = gpr_avl_add(avl, box(994), box(144)); + avl = gpr_avl_add(avl, box(994), box(144), NULL); avl = remove_int(avl, 294); avl = remove_int(avl, 593); - avl = gpr_avl_add(avl, box(696), box(147)); + avl = gpr_avl_add(avl, box(696), box(147), NULL); avl = remove_int(avl, 8); - avl = gpr_avl_add(avl, box(881), box(149)); + avl = gpr_avl_add(avl, box(881), box(149), NULL); avl = remove_int(avl, 32); avl = remove_int(avl, 242); - avl = gpr_avl_add(avl, box(487), box(152)); - avl = gpr_avl_add(avl, box(637), box(153)); - avl = gpr_avl_add(avl, box(793), box(154)); - avl = gpr_avl_add(avl, box(696), box(155)); + avl = gpr_avl_add(avl, box(487), box(152), NULL); + avl = gpr_avl_add(avl, box(637), box(153), NULL); + avl = gpr_avl_add(avl, box(793), box(154), NULL); + avl = gpr_avl_add(avl, box(696), box(155), NULL); avl = remove_int(avl, 458); - avl = gpr_avl_add(avl, box(828), box(157)); + avl = gpr_avl_add(avl, box(828), box(157), NULL); avl = remove_int(avl, 784); avl = remove_int(avl, 274); - avl = gpr_avl_add(avl, box(783), box(160)); + avl = gpr_avl_add(avl, box(783), box(160), NULL); avl = remove_int(avl, 21); - avl = gpr_avl_add(avl, box(866), box(162)); + avl = gpr_avl_add(avl, box(866), box(162), NULL); avl = remove_int(avl, 919); - avl = gpr_avl_add(avl, box(435), box(164)); + avl = gpr_avl_add(avl, box(435), box(164), NULL); avl = remove_int(avl, 385); - avl = gpr_avl_add(avl, box(475), box(166)); + avl = gpr_avl_add(avl, box(475), box(166), NULL); avl = remove_int(avl, 339); - avl = gpr_avl_add(avl, box(615), box(168)); + avl = gpr_avl_add(avl, box(615), box(168), NULL); avl = remove_int(avl, 866); avl = remove_int(avl, 82); avl = remove_int(avl, 271); - avl = gpr_avl_add(avl, box(590), box(172)); - avl = gpr_avl_add(avl, box(852), box(173)); + avl = gpr_avl_add(avl, box(590), box(172), NULL); + avl = gpr_avl_add(avl, box(852), box(173), NULL); avl = remove_int(avl, 318); avl = remove_int(avl, 82); - avl = gpr_avl_add(avl, box(672), box(176)); + avl = gpr_avl_add(avl, box(672), box(176), NULL); avl = remove_int(avl, 430); - avl = gpr_avl_add(avl, box(821), box(178)); - avl = gpr_avl_add(avl, box(365), box(179)); + avl = gpr_avl_add(avl, box(821), box(178), NULL); + avl = gpr_avl_add(avl, box(365), box(179), NULL); avl = remove_int(avl, 78); - avl = gpr_avl_add(avl, box(700), box(181)); - avl = gpr_avl_add(avl, box(353), box(182)); + avl = gpr_avl_add(avl, box(700), box(181), NULL); + avl = gpr_avl_add(avl, box(353), box(182), NULL); avl = remove_int(avl, 492); - avl = gpr_avl_add(avl, box(991), box(184)); + avl = gpr_avl_add(avl, box(991), box(184), NULL); avl = remove_int(avl, 330); - avl = gpr_avl_add(avl, box(873), box(186)); + avl = gpr_avl_add(avl, box(873), box(186), NULL); avl = remove_int(avl, 589); - avl = gpr_avl_add(avl, box(676), box(188)); - avl = gpr_avl_add(avl, box(790), box(189)); + avl = gpr_avl_add(avl, box(676), box(188), NULL); + avl = gpr_avl_add(avl, box(790), box(189), NULL); avl = remove_int(avl, 521); avl = remove_int(avl, 47); - avl = gpr_avl_add(avl, box(976), box(192)); - avl = gpr_avl_add(avl, box(683), box(193)); + avl = gpr_avl_add(avl, box(976), box(192), NULL); + avl = gpr_avl_add(avl, box(683), box(193), NULL); avl = remove_int(avl, 803); avl = remove_int(avl, 1006); - avl = gpr_avl_add(avl, box(775), box(196)); - avl = gpr_avl_add(avl, box(411), box(197)); - avl = gpr_avl_add(avl, box(697), box(198)); + avl = gpr_avl_add(avl, box(775), box(196), NULL); + avl = gpr_avl_add(avl, box(411), box(197), NULL); + avl = gpr_avl_add(avl, box(697), box(198), NULL); avl = remove_int(avl, 50); - avl = gpr_avl_add(avl, box(213), box(200)); + avl = gpr_avl_add(avl, box(213), box(200), NULL); avl = remove_int(avl, 714); - avl = gpr_avl_add(avl, box(981), box(202)); - avl = gpr_avl_add(avl, box(502), box(203)); - avl = gpr_avl_add(avl, box(697), box(204)); - avl = gpr_avl_add(avl, box(603), box(205)); - avl = gpr_avl_add(avl, box(117), box(206)); + avl = gpr_avl_add(avl, box(981), box(202), NULL); + avl = gpr_avl_add(avl, box(502), box(203), NULL); + avl = gpr_avl_add(avl, box(697), box(204), NULL); + avl = gpr_avl_add(avl, box(603), box(205), NULL); + avl = gpr_avl_add(avl, box(117), box(206), NULL); avl = remove_int(avl, 363); - avl = gpr_avl_add(avl, box(104), box(208)); + avl = gpr_avl_add(avl, box(104), box(208), NULL); avl = remove_int(avl, 842); - avl = gpr_avl_add(avl, box(48), box(210)); + avl = gpr_avl_add(avl, box(48), box(210), NULL); avl = remove_int(avl, 764); - avl = gpr_avl_add(avl, box(482), box(212)); - avl = gpr_avl_add(avl, box(928), box(213)); - avl = gpr_avl_add(avl, box(30), box(214)); - avl = gpr_avl_add(avl, box(820), box(215)); - avl = gpr_avl_add(avl, box(334), box(216)); + avl = gpr_avl_add(avl, box(482), box(212), NULL); + avl = gpr_avl_add(avl, box(928), box(213), NULL); + avl = gpr_avl_add(avl, box(30), box(214), NULL); + avl = gpr_avl_add(avl, box(820), box(215), NULL); + avl = gpr_avl_add(avl, box(334), box(216), NULL); avl = remove_int(avl, 306); - avl = gpr_avl_add(avl, box(789), box(218)); + avl = gpr_avl_add(avl, box(789), box(218), NULL); avl = remove_int(avl, 924); - avl = gpr_avl_add(avl, box(53), box(220)); + avl = gpr_avl_add(avl, box(53), box(220), NULL); avl = remove_int(avl, 657); - avl = gpr_avl_add(avl, box(130), box(222)); - avl = gpr_avl_add(avl, box(239), box(223)); + avl = gpr_avl_add(avl, box(130), box(222), NULL); + avl = gpr_avl_add(avl, box(239), box(223), NULL); avl = remove_int(avl, 20); - avl = gpr_avl_add(avl, box(117), box(225)); + avl = gpr_avl_add(avl, box(117), box(225), NULL); avl = remove_int(avl, 882); avl = remove_int(avl, 891); - avl = gpr_avl_add(avl, box(9), box(228)); - avl = gpr_avl_add(avl, box(496), box(229)); - avl = gpr_avl_add(avl, box(750), box(230)); - avl = gpr_avl_add(avl, box(283), box(231)); - avl = gpr_avl_add(avl, box(802), box(232)); + avl = gpr_avl_add(avl, box(9), box(228), NULL); + avl = gpr_avl_add(avl, box(496), box(229), NULL); + avl = gpr_avl_add(avl, box(750), box(230), NULL); + avl = gpr_avl_add(avl, box(283), box(231), NULL); + avl = gpr_avl_add(avl, box(802), box(232), NULL); avl = remove_int(avl, 352); - avl = gpr_avl_add(avl, box(374), box(234)); - avl = gpr_avl_add(avl, box(6), box(235)); - avl = gpr_avl_add(avl, box(756), box(236)); - avl = gpr_avl_add(avl, box(597), box(237)); - avl = gpr_avl_add(avl, box(661), box(238)); + avl = gpr_avl_add(avl, box(374), box(234), NULL); + avl = gpr_avl_add(avl, box(6), box(235), NULL); + avl = gpr_avl_add(avl, box(756), box(236), NULL); + avl = gpr_avl_add(avl, box(597), box(237), NULL); + avl = gpr_avl_add(avl, box(661), box(238), NULL); avl = remove_int(avl, 96); - avl = gpr_avl_add(avl, box(894), box(240)); + avl = gpr_avl_add(avl, box(894), box(240), NULL); avl = remove_int(avl, 749); - avl = gpr_avl_add(avl, box(71), box(242)); + avl = gpr_avl_add(avl, box(71), box(242), NULL); avl = remove_int(avl, 68); - avl = gpr_avl_add(avl, box(388), box(244)); + avl = gpr_avl_add(avl, box(388), box(244), NULL); avl = remove_int(avl, 119); avl = remove_int(avl, 856); - avl = gpr_avl_add(avl, box(176), box(247)); - avl = gpr_avl_add(avl, box(993), box(248)); + avl = gpr_avl_add(avl, box(176), box(247), NULL); + avl = gpr_avl_add(avl, box(993), box(248), NULL); avl = remove_int(avl, 178); avl = remove_int(avl, 781); avl = remove_int(avl, 771); @@ -499,37 +501,37 @@ static void test_badcase2(void) { avl = remove_int(avl, 157); avl = remove_int(avl, 142); avl = remove_int(avl, 686); - avl = gpr_avl_add(avl, box(779), box(257)); - avl = gpr_avl_add(avl, box(484), box(258)); + avl = gpr_avl_add(avl, box(779), box(257), NULL); + avl = gpr_avl_add(avl, box(484), box(258), NULL); avl = remove_int(avl, 837); - avl = gpr_avl_add(avl, box(388), box(260)); + avl = gpr_avl_add(avl, box(388), box(260), NULL); avl = remove_int(avl, 987); - avl = gpr_avl_add(avl, box(336), box(262)); + avl = gpr_avl_add(avl, box(336), box(262), NULL); avl = remove_int(avl, 855); - avl = gpr_avl_add(avl, box(668), box(264)); + avl = gpr_avl_add(avl, box(668), box(264), NULL); avl = remove_int(avl, 648); - avl = gpr_avl_add(avl, box(193), box(266)); + avl = gpr_avl_add(avl, box(193), box(266), NULL); avl = remove_int(avl, 939); - avl = gpr_avl_add(avl, box(740), box(268)); - avl = gpr_avl_add(avl, box(503), box(269)); - avl = gpr_avl_add(avl, box(765), box(270)); + avl = gpr_avl_add(avl, box(740), box(268), NULL); + avl = gpr_avl_add(avl, box(503), box(269), NULL); + avl = gpr_avl_add(avl, box(765), box(270), NULL); avl = remove_int(avl, 924); avl = remove_int(avl, 513); - avl = gpr_avl_add(avl, box(161), box(273)); - avl = gpr_avl_add(avl, box(502), box(274)); - avl = gpr_avl_add(avl, box(846), box(275)); + avl = gpr_avl_add(avl, box(161), box(273), NULL); + avl = gpr_avl_add(avl, box(502), box(274), NULL); + avl = gpr_avl_add(avl, box(846), box(275), NULL); avl = remove_int(avl, 931); - avl = gpr_avl_add(avl, box(87), box(277)); - avl = gpr_avl_add(avl, box(949), box(278)); - avl = gpr_avl_add(avl, box(548), box(279)); - avl = gpr_avl_add(avl, box(951), box(280)); + avl = gpr_avl_add(avl, box(87), box(277), NULL); + avl = gpr_avl_add(avl, box(949), box(278), NULL); + avl = gpr_avl_add(avl, box(548), box(279), NULL); + avl = gpr_avl_add(avl, box(951), box(280), NULL); avl = remove_int(avl, 1018); avl = remove_int(avl, 568); - avl = gpr_avl_add(avl, box(138), box(283)); - avl = gpr_avl_add(avl, box(202), box(284)); - avl = gpr_avl_add(avl, box(157), box(285)); - avl = gpr_avl_add(avl, box(264), box(286)); - avl = gpr_avl_add(avl, box(370), box(287)); + avl = gpr_avl_add(avl, box(138), box(283), NULL); + avl = gpr_avl_add(avl, box(202), box(284), NULL); + avl = gpr_avl_add(avl, box(157), box(285), NULL); + avl = gpr_avl_add(avl, box(264), box(286), NULL); + avl = gpr_avl_add(avl, box(370), box(287), NULL); avl = remove_int(avl, 736); avl = remove_int(avl, 751); avl = remove_int(avl, 506); @@ -537,524 +539,524 @@ static void test_badcase2(void) { avl = remove_int(avl, 358); avl = remove_int(avl, 657); avl = remove_int(avl, 86); - avl = gpr_avl_add(avl, box(876), box(295)); + avl = gpr_avl_add(avl, box(876), box(295), NULL); avl = remove_int(avl, 354); - avl = gpr_avl_add(avl, box(134), box(297)); + avl = gpr_avl_add(avl, box(134), box(297), NULL); avl = remove_int(avl, 781); avl = remove_int(avl, 183); - avl = gpr_avl_add(avl, box(914), box(300)); + avl = gpr_avl_add(avl, box(914), box(300), NULL); avl = remove_int(avl, 926); avl = remove_int(avl, 398); avl = remove_int(avl, 932); avl = remove_int(avl, 804); avl = remove_int(avl, 326); - avl = gpr_avl_add(avl, box(208), box(306)); - avl = gpr_avl_add(avl, box(699), box(307)); + avl = gpr_avl_add(avl, box(208), box(306), NULL); + avl = gpr_avl_add(avl, box(699), box(307), NULL); avl = remove_int(avl, 576); avl = remove_int(avl, 850); avl = remove_int(avl, 514); avl = remove_int(avl, 676); avl = remove_int(avl, 549); avl = remove_int(avl, 767); - avl = gpr_avl_add(avl, box(58), box(314)); - avl = gpr_avl_add(avl, box(265), box(315)); - avl = gpr_avl_add(avl, box(268), box(316)); - avl = gpr_avl_add(avl, box(103), box(317)); - avl = gpr_avl_add(avl, box(440), box(318)); + avl = gpr_avl_add(avl, box(58), box(314), NULL); + avl = gpr_avl_add(avl, box(265), box(315), NULL); + avl = gpr_avl_add(avl, box(268), box(316), NULL); + avl = gpr_avl_add(avl, box(103), box(317), NULL); + avl = gpr_avl_add(avl, box(440), box(318), NULL); avl = remove_int(avl, 777); - avl = gpr_avl_add(avl, box(670), box(320)); + avl = gpr_avl_add(avl, box(670), box(320), NULL); avl = remove_int(avl, 506); avl = remove_int(avl, 487); - avl = gpr_avl_add(avl, box(421), box(323)); + avl = gpr_avl_add(avl, box(421), box(323), NULL); avl = remove_int(avl, 514); - avl = gpr_avl_add(avl, box(701), box(325)); + avl = gpr_avl_add(avl, box(701), box(325), NULL); avl = remove_int(avl, 949); avl = remove_int(avl, 872); avl = remove_int(avl, 139); - avl = gpr_avl_add(avl, box(781), box(329)); - avl = gpr_avl_add(avl, box(543), box(330)); - avl = gpr_avl_add(avl, box(147), box(331)); + avl = gpr_avl_add(avl, box(781), box(329), NULL); + avl = gpr_avl_add(avl, box(543), box(330), NULL); + avl = gpr_avl_add(avl, box(147), box(331), NULL); avl = remove_int(avl, 190); - avl = gpr_avl_add(avl, box(453), box(333)); + avl = gpr_avl_add(avl, box(453), box(333), NULL); avl = remove_int(avl, 262); avl = remove_int(avl, 850); avl = remove_int(avl, 286); avl = remove_int(avl, 787); - avl = gpr_avl_add(avl, box(514), box(338)); + avl = gpr_avl_add(avl, box(514), box(338), NULL); avl = remove_int(avl, 812); - avl = gpr_avl_add(avl, box(431), box(340)); - avl = gpr_avl_add(avl, box(8), box(341)); + avl = gpr_avl_add(avl, box(431), box(340), NULL); + avl = gpr_avl_add(avl, box(8), box(341), NULL); avl = remove_int(avl, 843); - avl = gpr_avl_add(avl, box(831), box(343)); + avl = gpr_avl_add(avl, box(831), box(343), NULL); avl = remove_int(avl, 472); avl = remove_int(avl, 157); - avl = gpr_avl_add(avl, box(612), box(346)); - avl = gpr_avl_add(avl, box(802), box(347)); + avl = gpr_avl_add(avl, box(612), box(346), NULL); + avl = gpr_avl_add(avl, box(802), box(347), NULL); avl = remove_int(avl, 554); - avl = gpr_avl_add(avl, box(409), box(349)); - avl = gpr_avl_add(avl, box(439), box(350)); - avl = gpr_avl_add(avl, box(725), box(351)); - avl = gpr_avl_add(avl, box(568), box(352)); + avl = gpr_avl_add(avl, box(409), box(349), NULL); + avl = gpr_avl_add(avl, box(439), box(350), NULL); + avl = gpr_avl_add(avl, box(725), box(351), NULL); + avl = gpr_avl_add(avl, box(568), box(352), NULL); avl = remove_int(avl, 475); avl = remove_int(avl, 672); avl = remove_int(avl, 62); avl = remove_int(avl, 753); - avl = gpr_avl_add(avl, box(435), box(357)); - avl = gpr_avl_add(avl, box(950), box(358)); - avl = gpr_avl_add(avl, box(532), box(359)); - avl = gpr_avl_add(avl, box(832), box(360)); + avl = gpr_avl_add(avl, box(435), box(357), NULL); + avl = gpr_avl_add(avl, box(950), box(358), NULL); + avl = gpr_avl_add(avl, box(532), box(359), NULL); + avl = gpr_avl_add(avl, box(832), box(360), NULL); avl = remove_int(avl, 390); - avl = gpr_avl_add(avl, box(993), box(362)); + avl = gpr_avl_add(avl, box(993), box(362), NULL); avl = remove_int(avl, 198); avl = remove_int(avl, 401); - avl = gpr_avl_add(avl, box(316), box(365)); + avl = gpr_avl_add(avl, box(316), box(365), NULL); avl = remove_int(avl, 843); - avl = gpr_avl_add(avl, box(541), box(367)); - avl = gpr_avl_add(avl, box(505), box(368)); + avl = gpr_avl_add(avl, box(541), box(367), NULL); + avl = gpr_avl_add(avl, box(505), box(368), NULL); avl = remove_int(avl, 445); avl = remove_int(avl, 256); - avl = gpr_avl_add(avl, box(232), box(371)); + avl = gpr_avl_add(avl, box(232), box(371), NULL); avl = remove_int(avl, 577); avl = remove_int(avl, 558); - avl = gpr_avl_add(avl, box(910), box(374)); + avl = gpr_avl_add(avl, box(910), box(374), NULL); avl = remove_int(avl, 902); avl = remove_int(avl, 755); avl = remove_int(avl, 114); avl = remove_int(avl, 438); avl = remove_int(avl, 224); - avl = gpr_avl_add(avl, box(920), box(380)); - avl = gpr_avl_add(avl, box(655), box(381)); + avl = gpr_avl_add(avl, box(920), box(380), NULL); + avl = gpr_avl_add(avl, box(655), box(381), NULL); avl = remove_int(avl, 557); avl = remove_int(avl, 102); avl = remove_int(avl, 165); - avl = gpr_avl_add(avl, box(191), box(385)); + avl = gpr_avl_add(avl, box(191), box(385), NULL); avl = remove_int(avl, 30); - avl = gpr_avl_add(avl, box(406), box(387)); - avl = gpr_avl_add(avl, box(66), box(388)); - avl = gpr_avl_add(avl, box(87), box(389)); + avl = gpr_avl_add(avl, box(406), box(387), NULL); + avl = gpr_avl_add(avl, box(66), box(388), NULL); + avl = gpr_avl_add(avl, box(87), box(389), NULL); avl = remove_int(avl, 7); avl = remove_int(avl, 671); - avl = gpr_avl_add(avl, box(234), box(392)); + avl = gpr_avl_add(avl, box(234), box(392), NULL); avl = remove_int(avl, 463); - avl = gpr_avl_add(avl, box(75), box(394)); - avl = gpr_avl_add(avl, box(487), box(395)); + avl = gpr_avl_add(avl, box(75), box(394), NULL); + avl = gpr_avl_add(avl, box(487), box(395), NULL); avl = remove_int(avl, 203); - avl = gpr_avl_add(avl, box(711), box(397)); + avl = gpr_avl_add(avl, box(711), box(397), NULL); avl = remove_int(avl, 291); avl = remove_int(avl, 798); avl = remove_int(avl, 337); - avl = gpr_avl_add(avl, box(877), box(401)); - avl = gpr_avl_add(avl, box(388), box(402)); + avl = gpr_avl_add(avl, box(877), box(401), NULL); + avl = gpr_avl_add(avl, box(388), box(402), NULL); avl = remove_int(avl, 975); - avl = gpr_avl_add(avl, box(200), box(404)); - avl = gpr_avl_add(avl, box(408), box(405)); - avl = gpr_avl_add(avl, box(3), box(406)); - avl = gpr_avl_add(avl, box(971), box(407)); + avl = gpr_avl_add(avl, box(200), box(404), NULL); + avl = gpr_avl_add(avl, box(408), box(405), NULL); + avl = gpr_avl_add(avl, box(3), box(406), NULL); + avl = gpr_avl_add(avl, box(971), box(407), NULL); avl = remove_int(avl, 841); avl = remove_int(avl, 910); avl = remove_int(avl, 74); avl = remove_int(avl, 888); - avl = gpr_avl_add(avl, box(492), box(412)); + avl = gpr_avl_add(avl, box(492), box(412), NULL); avl = remove_int(avl, 14); avl = remove_int(avl, 364); - avl = gpr_avl_add(avl, box(215), box(415)); + avl = gpr_avl_add(avl, box(215), box(415), NULL); avl = remove_int(avl, 778); avl = remove_int(avl, 45); - avl = gpr_avl_add(avl, box(328), box(418)); - avl = gpr_avl_add(avl, box(597), box(419)); + avl = gpr_avl_add(avl, box(328), box(418), NULL); + avl = gpr_avl_add(avl, box(597), box(419), NULL); avl = remove_int(avl, 34); - avl = gpr_avl_add(avl, box(736), box(421)); + avl = gpr_avl_add(avl, box(736), box(421), NULL); avl = remove_int(avl, 37); - avl = gpr_avl_add(avl, box(275), box(423)); - avl = gpr_avl_add(avl, box(70), box(424)); - avl = gpr_avl_add(avl, box(771), box(425)); + avl = gpr_avl_add(avl, box(275), box(423), NULL); + avl = gpr_avl_add(avl, box(70), box(424), NULL); + avl = gpr_avl_add(avl, box(771), box(425), NULL); avl = remove_int(avl, 536); avl = remove_int(avl, 421); - avl = gpr_avl_add(avl, box(186), box(428)); - avl = gpr_avl_add(avl, box(788), box(429)); - avl = gpr_avl_add(avl, box(224), box(430)); + avl = gpr_avl_add(avl, box(186), box(428), NULL); + avl = gpr_avl_add(avl, box(788), box(429), NULL); + avl = gpr_avl_add(avl, box(224), box(430), NULL); avl = remove_int(avl, 228); - avl = gpr_avl_add(avl, box(48), box(432)); - avl = gpr_avl_add(avl, box(120), box(433)); - avl = gpr_avl_add(avl, box(269), box(434)); - avl = gpr_avl_add(avl, box(904), box(435)); + avl = gpr_avl_add(avl, box(48), box(432), NULL); + avl = gpr_avl_add(avl, box(120), box(433), NULL); + avl = gpr_avl_add(avl, box(269), box(434), NULL); + avl = gpr_avl_add(avl, box(904), box(435), NULL); avl = remove_int(avl, 699); - avl = gpr_avl_add(avl, box(340), box(437)); + avl = gpr_avl_add(avl, box(340), box(437), NULL); avl = remove_int(avl, 276); - avl = gpr_avl_add(avl, box(591), box(439)); - avl = gpr_avl_add(avl, box(778), box(440)); + avl = gpr_avl_add(avl, box(591), box(439), NULL); + avl = gpr_avl_add(avl, box(778), box(440), NULL); avl = remove_int(avl, 490); avl = remove_int(avl, 973); - avl = gpr_avl_add(avl, box(294), box(443)); - avl = gpr_avl_add(avl, box(323), box(444)); + avl = gpr_avl_add(avl, box(294), box(443), NULL); + avl = gpr_avl_add(avl, box(323), box(444), NULL); avl = remove_int(avl, 685); - avl = gpr_avl_add(avl, box(38), box(446)); - avl = gpr_avl_add(avl, box(525), box(447)); + avl = gpr_avl_add(avl, box(38), box(446), NULL); + avl = gpr_avl_add(avl, box(525), box(447), NULL); avl = remove_int(avl, 162); - avl = gpr_avl_add(avl, box(462), box(449)); - avl = gpr_avl_add(avl, box(340), box(450)); + avl = gpr_avl_add(avl, box(462), box(449), NULL); + avl = gpr_avl_add(avl, box(340), box(450), NULL); avl = remove_int(avl, 734); avl = remove_int(avl, 959); - avl = gpr_avl_add(avl, box(752), box(453)); - avl = gpr_avl_add(avl, box(667), box(454)); + avl = gpr_avl_add(avl, box(752), box(453), NULL); + avl = gpr_avl_add(avl, box(667), box(454), NULL); avl = remove_int(avl, 558); avl = remove_int(avl, 657); - avl = gpr_avl_add(avl, box(711), box(457)); + avl = gpr_avl_add(avl, box(711), box(457), NULL); avl = remove_int(avl, 937); - avl = gpr_avl_add(avl, box(741), box(459)); - avl = gpr_avl_add(avl, box(40), box(460)); + avl = gpr_avl_add(avl, box(741), box(459), NULL); + avl = gpr_avl_add(avl, box(40), box(460), NULL); avl = remove_int(avl, 784); - avl = gpr_avl_add(avl, box(292), box(462)); + avl = gpr_avl_add(avl, box(292), box(462), NULL); avl = remove_int(avl, 164); avl = remove_int(avl, 931); avl = remove_int(avl, 886); - avl = gpr_avl_add(avl, box(968), box(466)); + avl = gpr_avl_add(avl, box(968), box(466), NULL); avl = remove_int(avl, 263); - avl = gpr_avl_add(avl, box(647), box(468)); - avl = gpr_avl_add(avl, box(92), box(469)); + avl = gpr_avl_add(avl, box(647), box(468), NULL); + avl = gpr_avl_add(avl, box(92), box(469), NULL); avl = remove_int(avl, 310); - avl = gpr_avl_add(avl, box(711), box(471)); - avl = gpr_avl_add(avl, box(675), box(472)); + avl = gpr_avl_add(avl, box(711), box(471), NULL); + avl = gpr_avl_add(avl, box(675), box(472), NULL); avl = remove_int(avl, 549); - avl = gpr_avl_add(avl, box(380), box(474)); + avl = gpr_avl_add(avl, box(380), box(474), NULL); avl = remove_int(avl, 825); - avl = gpr_avl_add(avl, box(668), box(476)); + avl = gpr_avl_add(avl, box(668), box(476), NULL); avl = remove_int(avl, 498); - avl = gpr_avl_add(avl, box(870), box(478)); - avl = gpr_avl_add(avl, box(391), box(479)); - avl = gpr_avl_add(avl, box(264), box(480)); + avl = gpr_avl_add(avl, box(870), box(478), NULL); + avl = gpr_avl_add(avl, box(391), box(479), NULL); + avl = gpr_avl_add(avl, box(264), box(480), NULL); avl = remove_int(avl, 1); avl = remove_int(avl, 849); avl = remove_int(avl, 88); avl = remove_int(avl, 255); avl = remove_int(avl, 763); avl = remove_int(avl, 831); - avl = gpr_avl_add(avl, box(508), box(487)); + avl = gpr_avl_add(avl, box(508), box(487), NULL); avl = remove_int(avl, 849); avl = remove_int(avl, 47); - avl = gpr_avl_add(avl, box(299), box(490)); + avl = gpr_avl_add(avl, box(299), box(490), NULL); avl = remove_int(avl, 625); avl = remove_int(avl, 433); avl = remove_int(avl, 904); avl = remove_int(avl, 761); - avl = gpr_avl_add(avl, box(33), box(495)); - avl = gpr_avl_add(avl, box(524), box(496)); + avl = gpr_avl_add(avl, box(33), box(495), NULL); + avl = gpr_avl_add(avl, box(524), box(496), NULL); avl = remove_int(avl, 210); avl = remove_int(avl, 299); - avl = gpr_avl_add(avl, box(823), box(499)); + avl = gpr_avl_add(avl, box(823), box(499), NULL); avl = remove_int(avl, 479); avl = remove_int(avl, 96); avl = remove_int(avl, 1013); - avl = gpr_avl_add(avl, box(768), box(503)); + avl = gpr_avl_add(avl, box(768), box(503), NULL); avl = remove_int(avl, 638); avl = remove_int(avl, 20); - avl = gpr_avl_add(avl, box(663), box(506)); + avl = gpr_avl_add(avl, box(663), box(506), NULL); avl = remove_int(avl, 882); - avl = gpr_avl_add(avl, box(745), box(508)); + avl = gpr_avl_add(avl, box(745), box(508), NULL); avl = remove_int(avl, 352); - avl = gpr_avl_add(avl, box(10), box(510)); + avl = gpr_avl_add(avl, box(10), box(510), NULL); avl = remove_int(avl, 484); - avl = gpr_avl_add(avl, box(420), box(512)); - avl = gpr_avl_add(avl, box(884), box(513)); - avl = gpr_avl_add(avl, box(993), box(514)); - avl = gpr_avl_add(avl, box(251), box(515)); + avl = gpr_avl_add(avl, box(420), box(512), NULL); + avl = gpr_avl_add(avl, box(884), box(513), NULL); + avl = gpr_avl_add(avl, box(993), box(514), NULL); + avl = gpr_avl_add(avl, box(251), box(515), NULL); avl = remove_int(avl, 222); - avl = gpr_avl_add(avl, box(734), box(517)); - avl = gpr_avl_add(avl, box(952), box(518)); + avl = gpr_avl_add(avl, box(734), box(517), NULL); + avl = gpr_avl_add(avl, box(952), box(518), NULL); avl = remove_int(avl, 26); avl = remove_int(avl, 270); avl = remove_int(avl, 481); avl = remove_int(avl, 693); avl = remove_int(avl, 1006); - avl = gpr_avl_add(avl, box(77), box(524)); + avl = gpr_avl_add(avl, box(77), box(524), NULL); avl = remove_int(avl, 897); - avl = gpr_avl_add(avl, box(719), box(526)); - avl = gpr_avl_add(avl, box(622), box(527)); + avl = gpr_avl_add(avl, box(719), box(526), NULL); + avl = gpr_avl_add(avl, box(622), box(527), NULL); avl = remove_int(avl, 28); avl = remove_int(avl, 836); avl = remove_int(avl, 142); - avl = gpr_avl_add(avl, box(445), box(531)); - avl = gpr_avl_add(avl, box(410), box(532)); + avl = gpr_avl_add(avl, box(445), box(531), NULL); + avl = gpr_avl_add(avl, box(410), box(532), NULL); avl = remove_int(avl, 575); - avl = gpr_avl_add(avl, box(634), box(534)); - avl = gpr_avl_add(avl, box(906), box(535)); + avl = gpr_avl_add(avl, box(634), box(534), NULL); + avl = gpr_avl_add(avl, box(906), box(535), NULL); avl = remove_int(avl, 649); - avl = gpr_avl_add(avl, box(813), box(537)); + avl = gpr_avl_add(avl, box(813), box(537), NULL); avl = remove_int(avl, 702); avl = remove_int(avl, 732); - avl = gpr_avl_add(avl, box(105), box(540)); - avl = gpr_avl_add(avl, box(867), box(541)); + avl = gpr_avl_add(avl, box(105), box(540), NULL); + avl = gpr_avl_add(avl, box(867), box(541), NULL); avl = remove_int(avl, 964); avl = remove_int(avl, 941); - avl = gpr_avl_add(avl, box(947), box(544)); + avl = gpr_avl_add(avl, box(947), box(544), NULL); avl = remove_int(avl, 990); - avl = gpr_avl_add(avl, box(816), box(546)); + avl = gpr_avl_add(avl, box(816), box(546), NULL); avl = remove_int(avl, 429); avl = remove_int(avl, 567); avl = remove_int(avl, 541); avl = remove_int(avl, 583); - avl = gpr_avl_add(avl, box(57), box(551)); - avl = gpr_avl_add(avl, box(786), box(552)); - avl = gpr_avl_add(avl, box(526), box(553)); + avl = gpr_avl_add(avl, box(57), box(551), NULL); + avl = gpr_avl_add(avl, box(786), box(552), NULL); + avl = gpr_avl_add(avl, box(526), box(553), NULL); avl = remove_int(avl, 642); avl = remove_int(avl, 220); avl = remove_int(avl, 840); avl = remove_int(avl, 548); - avl = gpr_avl_add(avl, box(528), box(558)); - avl = gpr_avl_add(avl, box(749), box(559)); - avl = gpr_avl_add(avl, box(194), box(560)); + avl = gpr_avl_add(avl, box(528), box(558), NULL); + avl = gpr_avl_add(avl, box(749), box(559), NULL); + avl = gpr_avl_add(avl, box(194), box(560), NULL); avl = remove_int(avl, 517); - avl = gpr_avl_add(avl, box(102), box(562)); + avl = gpr_avl_add(avl, box(102), box(562), NULL); avl = remove_int(avl, 189); - avl = gpr_avl_add(avl, box(927), box(564)); + avl = gpr_avl_add(avl, box(927), box(564), NULL); avl = remove_int(avl, 846); avl = remove_int(avl, 130); - avl = gpr_avl_add(avl, box(694), box(567)); + avl = gpr_avl_add(avl, box(694), box(567), NULL); avl = remove_int(avl, 750); - avl = gpr_avl_add(avl, box(357), box(569)); + avl = gpr_avl_add(avl, box(357), box(569), NULL); avl = remove_int(avl, 431); avl = remove_int(avl, 91); - avl = gpr_avl_add(avl, box(640), box(572)); + avl = gpr_avl_add(avl, box(640), box(572), NULL); avl = remove_int(avl, 4); - avl = gpr_avl_add(avl, box(81), box(574)); - avl = gpr_avl_add(avl, box(595), box(575)); + avl = gpr_avl_add(avl, box(81), box(574), NULL); + avl = gpr_avl_add(avl, box(595), box(575), NULL); avl = remove_int(avl, 444); avl = remove_int(avl, 262); avl = remove_int(avl, 11); - avl = gpr_avl_add(avl, box(192), box(579)); - avl = gpr_avl_add(avl, box(158), box(580)); + avl = gpr_avl_add(avl, box(192), box(579), NULL); + avl = gpr_avl_add(avl, box(158), box(580), NULL); avl = remove_int(avl, 401); avl = remove_int(avl, 918); - avl = gpr_avl_add(avl, box(180), box(583)); + avl = gpr_avl_add(avl, box(180), box(583), NULL); avl = remove_int(avl, 268); - avl = gpr_avl_add(avl, box(1012), box(585)); - avl = gpr_avl_add(avl, box(90), box(586)); - avl = gpr_avl_add(avl, box(946), box(587)); + avl = gpr_avl_add(avl, box(1012), box(585), NULL); + avl = gpr_avl_add(avl, box(90), box(586), NULL); + avl = gpr_avl_add(avl, box(946), box(587), NULL); avl = remove_int(avl, 719); - avl = gpr_avl_add(avl, box(874), box(589)); - avl = gpr_avl_add(avl, box(679), box(590)); + avl = gpr_avl_add(avl, box(874), box(589), NULL); + avl = gpr_avl_add(avl, box(679), box(590), NULL); avl = remove_int(avl, 53); avl = remove_int(avl, 534); - avl = gpr_avl_add(avl, box(646), box(593)); - avl = gpr_avl_add(avl, box(767), box(594)); - avl = gpr_avl_add(avl, box(460), box(595)); - avl = gpr_avl_add(avl, box(852), box(596)); - avl = gpr_avl_add(avl, box(189), box(597)); + avl = gpr_avl_add(avl, box(646), box(593), NULL); + avl = gpr_avl_add(avl, box(767), box(594), NULL); + avl = gpr_avl_add(avl, box(460), box(595), NULL); + avl = gpr_avl_add(avl, box(852), box(596), NULL); + avl = gpr_avl_add(avl, box(189), box(597), NULL); avl = remove_int(avl, 932); avl = remove_int(avl, 366); avl = remove_int(avl, 907); - avl = gpr_avl_add(avl, box(875), box(601)); - avl = gpr_avl_add(avl, box(434), box(602)); - avl = gpr_avl_add(avl, box(704), box(603)); - avl = gpr_avl_add(avl, box(724), box(604)); - avl = gpr_avl_add(avl, box(930), box(605)); - avl = gpr_avl_add(avl, box(1000), box(606)); + avl = gpr_avl_add(avl, box(875), box(601), NULL); + avl = gpr_avl_add(avl, box(434), box(602), NULL); + avl = gpr_avl_add(avl, box(704), box(603), NULL); + avl = gpr_avl_add(avl, box(724), box(604), NULL); + avl = gpr_avl_add(avl, box(930), box(605), NULL); + avl = gpr_avl_add(avl, box(1000), box(606), NULL); avl = remove_int(avl, 479); - avl = gpr_avl_add(avl, box(275), box(608)); + avl = gpr_avl_add(avl, box(275), box(608), NULL); avl = remove_int(avl, 32); - avl = gpr_avl_add(avl, box(939), box(610)); + avl = gpr_avl_add(avl, box(939), box(610), NULL); avl = remove_int(avl, 943); avl = remove_int(avl, 329); - avl = gpr_avl_add(avl, box(490), box(613)); + avl = gpr_avl_add(avl, box(490), box(613), NULL); avl = remove_int(avl, 477); avl = remove_int(avl, 414); avl = remove_int(avl, 187); avl = remove_int(avl, 334); - avl = gpr_avl_add(avl, box(40), box(618)); + avl = gpr_avl_add(avl, box(40), box(618), NULL); avl = remove_int(avl, 751); - avl = gpr_avl_add(avl, box(568), box(620)); - avl = gpr_avl_add(avl, box(120), box(621)); - avl = gpr_avl_add(avl, box(617), box(622)); - avl = gpr_avl_add(avl, box(32), box(623)); + avl = gpr_avl_add(avl, box(568), box(620), NULL); + avl = gpr_avl_add(avl, box(120), box(621), NULL); + avl = gpr_avl_add(avl, box(617), box(622), NULL); + avl = gpr_avl_add(avl, box(32), box(623), NULL); avl = remove_int(avl, 701); - avl = gpr_avl_add(avl, box(910), box(625)); + avl = gpr_avl_add(avl, box(910), box(625), NULL); avl = remove_int(avl, 557); avl = remove_int(avl, 361); avl = remove_int(avl, 937); avl = remove_int(avl, 100); avl = remove_int(avl, 684); - avl = gpr_avl_add(avl, box(751), box(631)); + avl = gpr_avl_add(avl, box(751), box(631), NULL); avl = remove_int(avl, 781); avl = remove_int(avl, 469); avl = remove_int(avl, 75); avl = remove_int(avl, 561); - avl = gpr_avl_add(avl, box(854), box(636)); + avl = gpr_avl_add(avl, box(854), box(636), NULL); avl = remove_int(avl, 164); avl = remove_int(avl, 258); avl = remove_int(avl, 315); avl = remove_int(avl, 261); - avl = gpr_avl_add(avl, box(552), box(641)); - avl = gpr_avl_add(avl, box(6), box(642)); - avl = gpr_avl_add(avl, box(680), box(643)); + avl = gpr_avl_add(avl, box(552), box(641), NULL); + avl = gpr_avl_add(avl, box(6), box(642), NULL); + avl = gpr_avl_add(avl, box(680), box(643), NULL); avl = remove_int(avl, 741); avl = remove_int(avl, 309); avl = remove_int(avl, 272); - avl = gpr_avl_add(avl, box(249), box(647)); + avl = gpr_avl_add(avl, box(249), box(647), NULL); avl = remove_int(avl, 97); avl = remove_int(avl, 850); - avl = gpr_avl_add(avl, box(915), box(650)); - avl = gpr_avl_add(avl, box(816), box(651)); - avl = gpr_avl_add(avl, box(45), box(652)); - avl = gpr_avl_add(avl, box(168), box(653)); + avl = gpr_avl_add(avl, box(915), box(650), NULL); + avl = gpr_avl_add(avl, box(816), box(651), NULL); + avl = gpr_avl_add(avl, box(45), box(652), NULL); + avl = gpr_avl_add(avl, box(168), box(653), NULL); avl = remove_int(avl, 153); avl = remove_int(avl, 239); - avl = gpr_avl_add(avl, box(684), box(656)); - avl = gpr_avl_add(avl, box(208), box(657)); - avl = gpr_avl_add(avl, box(681), box(658)); - avl = gpr_avl_add(avl, box(609), box(659)); - avl = gpr_avl_add(avl, box(645), box(660)); + avl = gpr_avl_add(avl, box(684), box(656), NULL); + avl = gpr_avl_add(avl, box(208), box(657), NULL); + avl = gpr_avl_add(avl, box(681), box(658), NULL); + avl = gpr_avl_add(avl, box(609), box(659), NULL); + avl = gpr_avl_add(avl, box(645), box(660), NULL); avl = remove_int(avl, 799); - avl = gpr_avl_add(avl, box(955), box(662)); - avl = gpr_avl_add(avl, box(946), box(663)); - avl = gpr_avl_add(avl, box(744), box(664)); - avl = gpr_avl_add(avl, box(201), box(665)); - avl = gpr_avl_add(avl, box(136), box(666)); + avl = gpr_avl_add(avl, box(955), box(662), NULL); + avl = gpr_avl_add(avl, box(946), box(663), NULL); + avl = gpr_avl_add(avl, box(744), box(664), NULL); + avl = gpr_avl_add(avl, box(201), box(665), NULL); + avl = gpr_avl_add(avl, box(136), box(666), NULL); avl = remove_int(avl, 357); - avl = gpr_avl_add(avl, box(974), box(668)); + avl = gpr_avl_add(avl, box(974), box(668), NULL); avl = remove_int(avl, 485); - avl = gpr_avl_add(avl, box(1009), box(670)); - avl = gpr_avl_add(avl, box(517), box(671)); + avl = gpr_avl_add(avl, box(1009), box(670), NULL); + avl = gpr_avl_add(avl, box(517), box(671), NULL); avl = remove_int(avl, 491); - avl = gpr_avl_add(avl, box(336), box(673)); - avl = gpr_avl_add(avl, box(589), box(674)); + avl = gpr_avl_add(avl, box(336), box(673), NULL); + avl = gpr_avl_add(avl, box(589), box(674), NULL); avl = remove_int(avl, 546); avl = remove_int(avl, 840); avl = remove_int(avl, 104); avl = remove_int(avl, 347); - avl = gpr_avl_add(avl, box(801), box(679)); + avl = gpr_avl_add(avl, box(801), box(679), NULL); avl = remove_int(avl, 799); avl = remove_int(avl, 702); avl = remove_int(avl, 996); avl = remove_int(avl, 93); - avl = gpr_avl_add(avl, box(561), box(684)); - avl = gpr_avl_add(avl, box(25), box(685)); + avl = gpr_avl_add(avl, box(561), box(684), NULL); + avl = gpr_avl_add(avl, box(25), box(685), NULL); avl = remove_int(avl, 278); - avl = gpr_avl_add(avl, box(191), box(687)); + avl = gpr_avl_add(avl, box(191), box(687), NULL); avl = remove_int(avl, 243); avl = remove_int(avl, 918); avl = remove_int(avl, 449); - avl = gpr_avl_add(avl, box(19), box(691)); - avl = gpr_avl_add(avl, box(762), box(692)); - avl = gpr_avl_add(avl, box(13), box(693)); - avl = gpr_avl_add(avl, box(151), box(694)); - avl = gpr_avl_add(avl, box(152), box(695)); - avl = gpr_avl_add(avl, box(793), box(696)); + avl = gpr_avl_add(avl, box(19), box(691), NULL); + avl = gpr_avl_add(avl, box(762), box(692), NULL); + avl = gpr_avl_add(avl, box(13), box(693), NULL); + avl = gpr_avl_add(avl, box(151), box(694), NULL); + avl = gpr_avl_add(avl, box(152), box(695), NULL); + avl = gpr_avl_add(avl, box(793), box(696), NULL); avl = remove_int(avl, 862); avl = remove_int(avl, 890); - avl = gpr_avl_add(avl, box(687), box(699)); - avl = gpr_avl_add(avl, box(509), box(700)); - avl = gpr_avl_add(avl, box(973), box(701)); + avl = gpr_avl_add(avl, box(687), box(699), NULL); + avl = gpr_avl_add(avl, box(509), box(700), NULL); + avl = gpr_avl_add(avl, box(973), box(701), NULL); avl = remove_int(avl, 230); - avl = gpr_avl_add(avl, box(532), box(703)); + avl = gpr_avl_add(avl, box(532), box(703), NULL); avl = remove_int(avl, 668); - avl = gpr_avl_add(avl, box(281), box(705)); - avl = gpr_avl_add(avl, box(867), box(706)); - avl = gpr_avl_add(avl, box(359), box(707)); + avl = gpr_avl_add(avl, box(281), box(705), NULL); + avl = gpr_avl_add(avl, box(867), box(706), NULL); + avl = gpr_avl_add(avl, box(359), box(707), NULL); avl = remove_int(avl, 425); - avl = gpr_avl_add(avl, box(691), box(709)); - avl = gpr_avl_add(avl, box(163), box(710)); - avl = gpr_avl_add(avl, box(502), box(711)); + avl = gpr_avl_add(avl, box(691), box(709), NULL); + avl = gpr_avl_add(avl, box(163), box(710), NULL); + avl = gpr_avl_add(avl, box(502), box(711), NULL); avl = remove_int(avl, 674); - avl = gpr_avl_add(avl, box(697), box(713)); + avl = gpr_avl_add(avl, box(697), box(713), NULL); avl = remove_int(avl, 271); - avl = gpr_avl_add(avl, box(968), box(715)); - avl = gpr_avl_add(avl, box(48), box(716)); + avl = gpr_avl_add(avl, box(968), box(715), NULL); + avl = gpr_avl_add(avl, box(48), box(716), NULL); avl = remove_int(avl, 543); - avl = gpr_avl_add(avl, box(35), box(718)); - avl = gpr_avl_add(avl, box(751), box(719)); - avl = gpr_avl_add(avl, box(478), box(720)); + avl = gpr_avl_add(avl, box(35), box(718), NULL); + avl = gpr_avl_add(avl, box(751), box(719), NULL); + avl = gpr_avl_add(avl, box(478), box(720), NULL); avl = remove_int(avl, 797); avl = remove_int(avl, 309); - avl = gpr_avl_add(avl, box(927), box(723)); + avl = gpr_avl_add(avl, box(927), box(723), NULL); avl = remove_int(avl, 504); - avl = gpr_avl_add(avl, box(286), box(725)); - avl = gpr_avl_add(avl, box(413), box(726)); - avl = gpr_avl_add(avl, box(599), box(727)); + avl = gpr_avl_add(avl, box(286), box(725), NULL); + avl = gpr_avl_add(avl, box(413), box(726), NULL); + avl = gpr_avl_add(avl, box(599), box(727), NULL); avl = remove_int(avl, 105); avl = remove_int(avl, 605); - avl = gpr_avl_add(avl, box(632), box(730)); - avl = gpr_avl_add(avl, box(133), box(731)); + avl = gpr_avl_add(avl, box(632), box(730), NULL); + avl = gpr_avl_add(avl, box(133), box(731), NULL); avl = remove_int(avl, 443); - avl = gpr_avl_add(avl, box(958), box(733)); - avl = gpr_avl_add(avl, box(729), box(734)); + avl = gpr_avl_add(avl, box(958), box(733), NULL); + avl = gpr_avl_add(avl, box(729), box(734), NULL); avl = remove_int(avl, 158); - avl = gpr_avl_add(avl, box(694), box(736)); - avl = gpr_avl_add(avl, box(505), box(737)); + avl = gpr_avl_add(avl, box(694), box(736), NULL); + avl = gpr_avl_add(avl, box(505), box(737), NULL); avl = remove_int(avl, 63); avl = remove_int(avl, 714); - avl = gpr_avl_add(avl, box(1002), box(740)); + avl = gpr_avl_add(avl, box(1002), box(740), NULL); avl = remove_int(avl, 211); - avl = gpr_avl_add(avl, box(765), box(742)); - avl = gpr_avl_add(avl, box(455), box(743)); + avl = gpr_avl_add(avl, box(765), box(742), NULL); + avl = gpr_avl_add(avl, box(455), box(743), NULL); avl = remove_int(avl, 59); avl = remove_int(avl, 224); - avl = gpr_avl_add(avl, box(586), box(746)); - avl = gpr_avl_add(avl, box(348), box(747)); + avl = gpr_avl_add(avl, box(586), box(746), NULL); + avl = gpr_avl_add(avl, box(348), box(747), NULL); avl = remove_int(avl, 10); avl = remove_int(avl, 484); - avl = gpr_avl_add(avl, box(968), box(750)); - avl = gpr_avl_add(avl, box(923), box(751)); + avl = gpr_avl_add(avl, box(968), box(750), NULL); + avl = gpr_avl_add(avl, box(923), box(751), NULL); avl = remove_int(avl, 573); avl = remove_int(avl, 617); - avl = gpr_avl_add(avl, box(812), box(754)); - avl = gpr_avl_add(avl, box(179), box(755)); + avl = gpr_avl_add(avl, box(812), box(754), NULL); + avl = gpr_avl_add(avl, box(179), box(755), NULL); avl = remove_int(avl, 284); avl = remove_int(avl, 157); avl = remove_int(avl, 177); avl = remove_int(avl, 896); - avl = gpr_avl_add(avl, box(649), box(760)); - avl = gpr_avl_add(avl, box(927), box(761)); - avl = gpr_avl_add(avl, box(454), box(762)); - avl = gpr_avl_add(avl, box(217), box(763)); + avl = gpr_avl_add(avl, box(649), box(760), NULL); + avl = gpr_avl_add(avl, box(927), box(761), NULL); + avl = gpr_avl_add(avl, box(454), box(762), NULL); + avl = gpr_avl_add(avl, box(217), box(763), NULL); avl = remove_int(avl, 534); - avl = gpr_avl_add(avl, box(180), box(765)); - avl = gpr_avl_add(avl, box(319), box(766)); + avl = gpr_avl_add(avl, box(180), box(765), NULL); + avl = gpr_avl_add(avl, box(319), box(766), NULL); avl = remove_int(avl, 92); - avl = gpr_avl_add(avl, box(483), box(768)); + avl = gpr_avl_add(avl, box(483), box(768), NULL); avl = remove_int(avl, 504); avl = remove_int(avl, 1017); avl = remove_int(avl, 37); avl = remove_int(avl, 50); - avl = gpr_avl_add(avl, box(302), box(773)); + avl = gpr_avl_add(avl, box(302), box(773), NULL); avl = remove_int(avl, 807); - avl = gpr_avl_add(avl, box(463), box(775)); - avl = gpr_avl_add(avl, box(271), box(776)); - avl = gpr_avl_add(avl, box(644), box(777)); + avl = gpr_avl_add(avl, box(463), box(775), NULL); + avl = gpr_avl_add(avl, box(271), box(776), NULL); + avl = gpr_avl_add(avl, box(644), box(777), NULL); avl = remove_int(avl, 618); - avl = gpr_avl_add(avl, box(166), box(779)); - avl = gpr_avl_add(avl, box(538), box(780)); + avl = gpr_avl_add(avl, box(166), box(779), NULL); + avl = gpr_avl_add(avl, box(538), box(780), NULL); avl = remove_int(avl, 606); - avl = gpr_avl_add(avl, box(425), box(782)); + avl = gpr_avl_add(avl, box(425), box(782), NULL); avl = remove_int(avl, 725); avl = remove_int(avl, 383); - avl = gpr_avl_add(avl, box(155), box(785)); + avl = gpr_avl_add(avl, box(155), box(785), NULL); avl = remove_int(avl, 889); - avl = gpr_avl_add(avl, box(653), box(787)); + avl = gpr_avl_add(avl, box(653), box(787), NULL); avl = remove_int(avl, 386); - avl = gpr_avl_add(avl, box(142), box(789)); + avl = gpr_avl_add(avl, box(142), box(789), NULL); avl = remove_int(avl, 107); avl = remove_int(avl, 603); avl = remove_int(avl, 971); - avl = gpr_avl_add(avl, box(80), box(793)); - avl = gpr_avl_add(avl, box(61), box(794)); - avl = gpr_avl_add(avl, box(693), box(795)); - avl = gpr_avl_add(avl, box(592), box(796)); - avl = gpr_avl_add(avl, box(433), box(797)); - avl = gpr_avl_add(avl, box(973), box(798)); + avl = gpr_avl_add(avl, box(80), box(793), NULL); + avl = gpr_avl_add(avl, box(61), box(794), NULL); + avl = gpr_avl_add(avl, box(693), box(795), NULL); + avl = gpr_avl_add(avl, box(592), box(796), NULL); + avl = gpr_avl_add(avl, box(433), box(797), NULL); + avl = gpr_avl_add(avl, box(973), box(798), NULL); avl = remove_int(avl, 901); avl = remove_int(avl, 340); avl = remove_int(avl, 709); - avl = gpr_avl_add(avl, box(224), box(802)); + avl = gpr_avl_add(avl, box(224), box(802), NULL); avl = remove_int(avl, 120); avl = remove_int(avl, 271); - avl = gpr_avl_add(avl, box(780), box(805)); - avl = gpr_avl_add(avl, box(867), box(806)); - avl = gpr_avl_add(avl, box(756), box(807)); - avl = gpr_avl_add(avl, box(583), box(808)); - avl = gpr_avl_add(avl, box(356), box(809)); - avl = gpr_avl_add(avl, box(58), box(810)); + avl = gpr_avl_add(avl, box(780), box(805), NULL); + avl = gpr_avl_add(avl, box(867), box(806), NULL); + avl = gpr_avl_add(avl, box(756), box(807), NULL); + avl = gpr_avl_add(avl, box(583), box(808), NULL); + avl = gpr_avl_add(avl, box(356), box(809), NULL); + avl = gpr_avl_add(avl, box(58), box(810), NULL); avl = remove_int(avl, 219); - avl = gpr_avl_add(avl, box(301), box(812)); + avl = gpr_avl_add(avl, box(301), box(812), NULL); avl = remove_int(avl, 643); avl = remove_int(avl, 787); avl = remove_int(avl, 583); @@ -1063,72 +1065,72 @@ static void test_badcase2(void) { avl = remove_int(avl, 608); avl = remove_int(avl, 363); avl = remove_int(avl, 690); - avl = gpr_avl_add(avl, box(233), box(821)); - avl = gpr_avl_add(avl, box(479), box(822)); - avl = gpr_avl_add(avl, box(323), box(823)); - avl = gpr_avl_add(avl, box(802), box(824)); + avl = gpr_avl_add(avl, box(233), box(821), NULL); + avl = gpr_avl_add(avl, box(479), box(822), NULL); + avl = gpr_avl_add(avl, box(323), box(823), NULL); + avl = gpr_avl_add(avl, box(802), box(824), NULL); avl = remove_int(avl, 682); avl = remove_int(avl, 705); avl = remove_int(avl, 487); - avl = gpr_avl_add(avl, box(530), box(828)); - avl = gpr_avl_add(avl, box(232), box(829)); + avl = gpr_avl_add(avl, box(530), box(828), NULL); + avl = gpr_avl_add(avl, box(232), box(829), NULL); avl = remove_int(avl, 627); - avl = gpr_avl_add(avl, box(396), box(831)); - avl = gpr_avl_add(avl, box(61), box(832)); - avl = gpr_avl_add(avl, box(932), box(833)); - avl = gpr_avl_add(avl, box(108), box(834)); - avl = gpr_avl_add(avl, box(524), box(835)); + avl = gpr_avl_add(avl, box(396), box(831), NULL); + avl = gpr_avl_add(avl, box(61), box(832), NULL); + avl = gpr_avl_add(avl, box(932), box(833), NULL); + avl = gpr_avl_add(avl, box(108), box(834), NULL); + avl = gpr_avl_add(avl, box(524), box(835), NULL); avl = remove_int(avl, 390); avl = remove_int(avl, 307); - avl = gpr_avl_add(avl, box(722), box(838)); - avl = gpr_avl_add(avl, box(907), box(839)); + avl = gpr_avl_add(avl, box(722), box(838), NULL); + avl = gpr_avl_add(avl, box(907), box(839), NULL); avl = remove_int(avl, 286); avl = remove_int(avl, 337); avl = remove_int(avl, 443); - avl = gpr_avl_add(avl, box(973), box(843)); + avl = gpr_avl_add(avl, box(973), box(843), NULL); avl = remove_int(avl, 930); avl = remove_int(avl, 242); - avl = gpr_avl_add(avl, box(997), box(846)); - avl = gpr_avl_add(avl, box(689), box(847)); + avl = gpr_avl_add(avl, box(997), box(846), NULL); + avl = gpr_avl_add(avl, box(689), box(847), NULL); avl = remove_int(avl, 318); - avl = gpr_avl_add(avl, box(703), box(849)); - avl = gpr_avl_add(avl, box(868), box(850)); - avl = gpr_avl_add(avl, box(200), box(851)); - avl = gpr_avl_add(avl, box(960), box(852)); - avl = gpr_avl_add(avl, box(80), box(853)); + avl = gpr_avl_add(avl, box(703), box(849), NULL); + avl = gpr_avl_add(avl, box(868), box(850), NULL); + avl = gpr_avl_add(avl, box(200), box(851), NULL); + avl = gpr_avl_add(avl, box(960), box(852), NULL); + avl = gpr_avl_add(avl, box(80), box(853), NULL); avl = remove_int(avl, 113); - avl = gpr_avl_add(avl, box(135), box(855)); + avl = gpr_avl_add(avl, box(135), box(855), NULL); avl = remove_int(avl, 529); - avl = gpr_avl_add(avl, box(366), box(857)); + avl = gpr_avl_add(avl, box(366), box(857), NULL); avl = remove_int(avl, 272); - avl = gpr_avl_add(avl, box(921), box(859)); + avl = gpr_avl_add(avl, box(921), box(859), NULL); avl = remove_int(avl, 497); - avl = gpr_avl_add(avl, box(712), box(861)); + avl = gpr_avl_add(avl, box(712), box(861), NULL); avl = remove_int(avl, 777); avl = remove_int(avl, 505); avl = remove_int(avl, 974); avl = remove_int(avl, 497); - avl = gpr_avl_add(avl, box(388), box(866)); - avl = gpr_avl_add(avl, box(29), box(867)); - avl = gpr_avl_add(avl, box(180), box(868)); - avl = gpr_avl_add(avl, box(983), box(869)); - avl = gpr_avl_add(avl, box(72), box(870)); - avl = gpr_avl_add(avl, box(693), box(871)); - avl = gpr_avl_add(avl, box(567), box(872)); + avl = gpr_avl_add(avl, box(388), box(866), NULL); + avl = gpr_avl_add(avl, box(29), box(867), NULL); + avl = gpr_avl_add(avl, box(180), box(868), NULL); + avl = gpr_avl_add(avl, box(983), box(869), NULL); + avl = gpr_avl_add(avl, box(72), box(870), NULL); + avl = gpr_avl_add(avl, box(693), box(871), NULL); + avl = gpr_avl_add(avl, box(567), box(872), NULL); avl = remove_int(avl, 549); avl = remove_int(avl, 351); - avl = gpr_avl_add(avl, box(1019), box(875)); + avl = gpr_avl_add(avl, box(1019), box(875), NULL); avl = remove_int(avl, 585); avl = remove_int(avl, 294); avl = remove_int(avl, 61); - avl = gpr_avl_add(avl, box(409), box(879)); - avl = gpr_avl_add(avl, box(984), box(880)); - avl = gpr_avl_add(avl, box(830), box(881)); + avl = gpr_avl_add(avl, box(409), box(879), NULL); + avl = gpr_avl_add(avl, box(984), box(880), NULL); + avl = gpr_avl_add(avl, box(830), box(881), NULL); avl = remove_int(avl, 579); - avl = gpr_avl_add(avl, box(672), box(883)); + avl = gpr_avl_add(avl, box(672), box(883), NULL); avl = remove_int(avl, 968); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } static void test_badcase3(void) { @@ -1138,191 +1140,191 @@ static void test_badcase3(void) { avl = gpr_avl_create(&int_int_vtable); avl = remove_int(avl, 624); - avl = gpr_avl_add(avl, box(59), box(2)); - avl = gpr_avl_add(avl, box(494), box(3)); - avl = gpr_avl_add(avl, box(226), box(4)); + avl = gpr_avl_add(avl, box(59), box(2), NULL); + avl = gpr_avl_add(avl, box(494), box(3), NULL); + avl = gpr_avl_add(avl, box(226), box(4), NULL); avl = remove_int(avl, 524); - avl = gpr_avl_add(avl, box(540), box(6)); + avl = gpr_avl_add(avl, box(540), box(6), NULL); avl = remove_int(avl, 1008); - avl = gpr_avl_add(avl, box(502), box(8)); + avl = gpr_avl_add(avl, box(502), box(8), NULL); avl = remove_int(avl, 267); avl = remove_int(avl, 764); avl = remove_int(avl, 443); - avl = gpr_avl_add(avl, box(8), box(12)); + avl = gpr_avl_add(avl, box(8), box(12), NULL); avl = remove_int(avl, 291); avl = remove_int(avl, 796); avl = remove_int(avl, 1002); - avl = gpr_avl_add(avl, box(778), box(16)); + avl = gpr_avl_add(avl, box(778), box(16), NULL); avl = remove_int(avl, 621); avl = remove_int(avl, 891); avl = remove_int(avl, 880); - avl = gpr_avl_add(avl, box(197), box(20)); - avl = gpr_avl_add(avl, box(441), box(21)); - avl = gpr_avl_add(avl, box(719), box(22)); + avl = gpr_avl_add(avl, box(197), box(20), NULL); + avl = gpr_avl_add(avl, box(441), box(21), NULL); + avl = gpr_avl_add(avl, box(719), box(22), NULL); avl = remove_int(avl, 109); - avl = gpr_avl_add(avl, box(458), box(24)); + avl = gpr_avl_add(avl, box(458), box(24), NULL); avl = remove_int(avl, 86); - avl = gpr_avl_add(avl, box(897), box(26)); - avl = gpr_avl_add(avl, box(997), box(27)); + avl = gpr_avl_add(avl, box(897), box(26), NULL); + avl = gpr_avl_add(avl, box(997), box(27), NULL); avl = remove_int(avl, 235); avl = remove_int(avl, 425); avl = remove_int(avl, 186); - avl = gpr_avl_add(avl, box(887), box(31)); - avl = gpr_avl_add(avl, box(1005), box(32)); - avl = gpr_avl_add(avl, box(778), box(33)); - avl = gpr_avl_add(avl, box(575), box(34)); + avl = gpr_avl_add(avl, box(887), box(31), NULL); + avl = gpr_avl_add(avl, box(1005), box(32), NULL); + avl = gpr_avl_add(avl, box(778), box(33), NULL); + avl = gpr_avl_add(avl, box(575), box(34), NULL); avl = remove_int(avl, 966); avl = remove_int(avl, 1015); - avl = gpr_avl_add(avl, box(486), box(37)); - avl = gpr_avl_add(avl, box(809), box(38)); - avl = gpr_avl_add(avl, box(907), box(39)); - avl = gpr_avl_add(avl, box(971), box(40)); + avl = gpr_avl_add(avl, box(486), box(37), NULL); + avl = gpr_avl_add(avl, box(809), box(38), NULL); + avl = gpr_avl_add(avl, box(907), box(39), NULL); + avl = gpr_avl_add(avl, box(971), box(40), NULL); avl = remove_int(avl, 441); avl = remove_int(avl, 498); - avl = gpr_avl_add(avl, box(727), box(43)); + avl = gpr_avl_add(avl, box(727), box(43), NULL); avl = remove_int(avl, 679); avl = remove_int(avl, 740); avl = remove_int(avl, 532); - avl = gpr_avl_add(avl, box(805), box(47)); + avl = gpr_avl_add(avl, box(805), box(47), NULL); avl = remove_int(avl, 64); - avl = gpr_avl_add(avl, box(362), box(49)); - avl = gpr_avl_add(avl, box(170), box(50)); - avl = gpr_avl_add(avl, box(389), box(51)); - avl = gpr_avl_add(avl, box(689), box(52)); + avl = gpr_avl_add(avl, box(362), box(49), NULL); + avl = gpr_avl_add(avl, box(170), box(50), NULL); + avl = gpr_avl_add(avl, box(389), box(51), NULL); + avl = gpr_avl_add(avl, box(689), box(52), NULL); avl = remove_int(avl, 871); - avl = gpr_avl_add(avl, box(447), box(54)); + avl = gpr_avl_add(avl, box(447), box(54), NULL); avl = remove_int(avl, 718); - avl = gpr_avl_add(avl, box(724), box(56)); + avl = gpr_avl_add(avl, box(724), box(56), NULL); avl = remove_int(avl, 215); - avl = gpr_avl_add(avl, box(550), box(58)); + avl = gpr_avl_add(avl, box(550), box(58), NULL); avl = remove_int(avl, 932); - avl = gpr_avl_add(avl, box(47), box(60)); + avl = gpr_avl_add(avl, box(47), box(60), NULL); avl = remove_int(avl, 46); avl = remove_int(avl, 229); - avl = gpr_avl_add(avl, box(68), box(63)); - avl = gpr_avl_add(avl, box(387), box(64)); + avl = gpr_avl_add(avl, box(68), box(63), NULL); + avl = gpr_avl_add(avl, box(387), box(64), NULL); avl = remove_int(avl, 933); avl = remove_int(avl, 736); avl = remove_int(avl, 719); - avl = gpr_avl_add(avl, box(150), box(68)); + avl = gpr_avl_add(avl, box(150), box(68), NULL); avl = remove_int(avl, 875); avl = remove_int(avl, 298); - avl = gpr_avl_add(avl, box(991), box(71)); + avl = gpr_avl_add(avl, box(991), box(71), NULL); avl = remove_int(avl, 705); - avl = gpr_avl_add(avl, box(197), box(73)); - avl = gpr_avl_add(avl, box(101), box(74)); + avl = gpr_avl_add(avl, box(197), box(73), NULL); + avl = gpr_avl_add(avl, box(101), box(74), NULL); avl = remove_int(avl, 436); - avl = gpr_avl_add(avl, box(755), box(76)); - avl = gpr_avl_add(avl, box(727), box(77)); + avl = gpr_avl_add(avl, box(755), box(76), NULL); + avl = gpr_avl_add(avl, box(727), box(77), NULL); avl = remove_int(avl, 309); avl = remove_int(avl, 253); - avl = gpr_avl_add(avl, box(203), box(80)); + avl = gpr_avl_add(avl, box(203), box(80), NULL); avl = remove_int(avl, 231); - avl = gpr_avl_add(avl, box(461), box(82)); + avl = gpr_avl_add(avl, box(461), box(82), NULL); avl = remove_int(avl, 316); avl = remove_int(avl, 493); - avl = gpr_avl_add(avl, box(184), box(85)); + avl = gpr_avl_add(avl, box(184), box(85), NULL); avl = remove_int(avl, 737); - avl = gpr_avl_add(avl, box(790), box(87)); - avl = gpr_avl_add(avl, box(335), box(88)); + avl = gpr_avl_add(avl, box(790), box(87), NULL); + avl = gpr_avl_add(avl, box(335), box(88), NULL); avl = remove_int(avl, 649); - avl = gpr_avl_add(avl, box(69), box(90)); + avl = gpr_avl_add(avl, box(69), box(90), NULL); avl = remove_int(avl, 585); avl = remove_int(avl, 543); - avl = gpr_avl_add(avl, box(784), box(93)); - avl = gpr_avl_add(avl, box(60), box(94)); - avl = gpr_avl_add(avl, box(525), box(95)); - avl = gpr_avl_add(avl, box(177), box(96)); - avl = gpr_avl_add(avl, box(178), box(97)); - avl = gpr_avl_add(avl, box(683), box(98)); - avl = gpr_avl_add(avl, box(226), box(99)); - avl = gpr_avl_add(avl, box(662), box(100)); + avl = gpr_avl_add(avl, box(784), box(93), NULL); + avl = gpr_avl_add(avl, box(60), box(94), NULL); + avl = gpr_avl_add(avl, box(525), box(95), NULL); + avl = gpr_avl_add(avl, box(177), box(96), NULL); + avl = gpr_avl_add(avl, box(178), box(97), NULL); + avl = gpr_avl_add(avl, box(683), box(98), NULL); + avl = gpr_avl_add(avl, box(226), box(99), NULL); + avl = gpr_avl_add(avl, box(662), box(100), NULL); avl = remove_int(avl, 944); - avl = gpr_avl_add(avl, box(562), box(102)); - avl = gpr_avl_add(avl, box(793), box(103)); + avl = gpr_avl_add(avl, box(562), box(102), NULL); + avl = gpr_avl_add(avl, box(793), box(103), NULL); avl = remove_int(avl, 673); - avl = gpr_avl_add(avl, box(310), box(105)); + avl = gpr_avl_add(avl, box(310), box(105), NULL); avl = remove_int(avl, 479); avl = remove_int(avl, 543); avl = remove_int(avl, 159); avl = remove_int(avl, 850); - avl = gpr_avl_add(avl, box(318), box(110)); - avl = gpr_avl_add(avl, box(483), box(111)); - avl = gpr_avl_add(avl, box(84), box(112)); + avl = gpr_avl_add(avl, box(318), box(110), NULL); + avl = gpr_avl_add(avl, box(483), box(111), NULL); + avl = gpr_avl_add(avl, box(84), box(112), NULL); avl = remove_int(avl, 109); - avl = gpr_avl_add(avl, box(132), box(114)); - avl = gpr_avl_add(avl, box(920), box(115)); + avl = gpr_avl_add(avl, box(132), box(114), NULL); + avl = gpr_avl_add(avl, box(920), box(115), NULL); avl = remove_int(avl, 746); - avl = gpr_avl_add(avl, box(145), box(117)); - avl = gpr_avl_add(avl, box(526), box(118)); + avl = gpr_avl_add(avl, box(145), box(117), NULL); + avl = gpr_avl_add(avl, box(526), box(118), NULL); avl = remove_int(avl, 158); - avl = gpr_avl_add(avl, box(332), box(120)); - avl = gpr_avl_add(avl, box(918), box(121)); + avl = gpr_avl_add(avl, box(332), box(120), NULL); + avl = gpr_avl_add(avl, box(918), box(121), NULL); avl = remove_int(avl, 339); - avl = gpr_avl_add(avl, box(809), box(123)); - avl = gpr_avl_add(avl, box(742), box(124)); - avl = gpr_avl_add(avl, box(718), box(125)); + avl = gpr_avl_add(avl, box(809), box(123), NULL); + avl = gpr_avl_add(avl, box(742), box(124), NULL); + avl = gpr_avl_add(avl, box(718), box(125), NULL); avl = remove_int(avl, 988); avl = remove_int(avl, 531); avl = remove_int(avl, 840); - avl = gpr_avl_add(avl, box(816), box(129)); - avl = gpr_avl_add(avl, box(976), box(130)); + avl = gpr_avl_add(avl, box(816), box(129), NULL); + avl = gpr_avl_add(avl, box(976), box(130), NULL); avl = remove_int(avl, 743); avl = remove_int(avl, 528); avl = remove_int(avl, 982); - avl = gpr_avl_add(avl, box(803), box(134)); - avl = gpr_avl_add(avl, box(205), box(135)); - avl = gpr_avl_add(avl, box(584), box(136)); + avl = gpr_avl_add(avl, box(803), box(134), NULL); + avl = gpr_avl_add(avl, box(205), box(135), NULL); + avl = gpr_avl_add(avl, box(584), box(136), NULL); avl = remove_int(avl, 923); avl = remove_int(avl, 538); avl = remove_int(avl, 398); avl = remove_int(avl, 320); avl = remove_int(avl, 292); - avl = gpr_avl_add(avl, box(270), box(142)); - avl = gpr_avl_add(avl, box(333), box(143)); + avl = gpr_avl_add(avl, box(270), box(142), NULL); + avl = gpr_avl_add(avl, box(333), box(143), NULL); avl = remove_int(avl, 439); - avl = gpr_avl_add(avl, box(35), box(145)); - avl = gpr_avl_add(avl, box(837), box(146)); + avl = gpr_avl_add(avl, box(35), box(145), NULL); + avl = gpr_avl_add(avl, box(837), box(146), NULL); avl = remove_int(avl, 65); avl = remove_int(avl, 642); avl = remove_int(avl, 371); avl = remove_int(avl, 140); avl = remove_int(avl, 533); avl = remove_int(avl, 676); - avl = gpr_avl_add(avl, box(624), box(153)); - avl = gpr_avl_add(avl, box(116), box(154)); - avl = gpr_avl_add(avl, box(446), box(155)); + avl = gpr_avl_add(avl, box(624), box(153), NULL); + avl = gpr_avl_add(avl, box(116), box(154), NULL); + avl = gpr_avl_add(avl, box(446), box(155), NULL); avl = remove_int(avl, 91); avl = remove_int(avl, 721); avl = remove_int(avl, 537); - avl = gpr_avl_add(avl, box(448), box(159)); + avl = gpr_avl_add(avl, box(448), box(159), NULL); avl = remove_int(avl, 155); avl = remove_int(avl, 344); avl = remove_int(avl, 237); - avl = gpr_avl_add(avl, box(309), box(163)); - avl = gpr_avl_add(avl, box(434), box(164)); - avl = gpr_avl_add(avl, box(277), box(165)); + avl = gpr_avl_add(avl, box(309), box(163), NULL); + avl = gpr_avl_add(avl, box(434), box(164), NULL); + avl = gpr_avl_add(avl, box(277), box(165), NULL); avl = remove_int(avl, 233); - avl = gpr_avl_add(avl, box(275), box(167)); - avl = gpr_avl_add(avl, box(218), box(168)); - avl = gpr_avl_add(avl, box(76), box(169)); - avl = gpr_avl_add(avl, box(898), box(170)); + avl = gpr_avl_add(avl, box(275), box(167), NULL); + avl = gpr_avl_add(avl, box(218), box(168), NULL); + avl = gpr_avl_add(avl, box(76), box(169), NULL); + avl = gpr_avl_add(avl, box(898), box(170), NULL); avl = remove_int(avl, 771); - avl = gpr_avl_add(avl, box(237), box(172)); + avl = gpr_avl_add(avl, box(237), box(172), NULL); avl = remove_int(avl, 327); - avl = gpr_avl_add(avl, box(499), box(174)); + avl = gpr_avl_add(avl, box(499), box(174), NULL); avl = remove_int(avl, 727); avl = remove_int(avl, 234); avl = remove_int(avl, 623); avl = remove_int(avl, 458); avl = remove_int(avl, 326); avl = remove_int(avl, 589); - avl = gpr_avl_add(avl, box(442), box(181)); + avl = gpr_avl_add(avl, box(442), box(181), NULL); avl = remove_int(avl, 389); - avl = gpr_avl_add(avl, box(708), box(183)); - avl = gpr_avl_add(avl, box(594), box(184)); - avl = gpr_avl_add(avl, box(942), box(185)); - avl = gpr_avl_add(avl, box(282), box(186)); + avl = gpr_avl_add(avl, box(708), box(183), NULL); + avl = gpr_avl_add(avl, box(594), box(184), NULL); + avl = gpr_avl_add(avl, box(942), box(185), NULL); + avl = gpr_avl_add(avl, box(282), box(186), NULL); avl = remove_int(avl, 434); avl = remove_int(avl, 134); avl = remove_int(avl, 270); @@ -1332,125 +1334,125 @@ static void test_badcase3(void) { avl = remove_int(avl, 193); avl = remove_int(avl, 797); avl = remove_int(avl, 347); - avl = gpr_avl_add(avl, box(99), box(196)); - avl = gpr_avl_add(avl, box(161), box(197)); + avl = gpr_avl_add(avl, box(99), box(196), NULL); + avl = gpr_avl_add(avl, box(161), box(197), NULL); avl = remove_int(avl, 484); - avl = gpr_avl_add(avl, box(72), box(199)); + avl = gpr_avl_add(avl, box(72), box(199), NULL); avl = remove_int(avl, 629); - avl = gpr_avl_add(avl, box(522), box(201)); + avl = gpr_avl_add(avl, box(522), box(201), NULL); avl = remove_int(avl, 679); - avl = gpr_avl_add(avl, box(407), box(203)); + avl = gpr_avl_add(avl, box(407), box(203), NULL); avl = remove_int(avl, 693); - avl = gpr_avl_add(avl, box(424), box(205)); - avl = gpr_avl_add(avl, box(651), box(206)); - avl = gpr_avl_add(avl, box(927), box(207)); + avl = gpr_avl_add(avl, box(424), box(205), NULL); + avl = gpr_avl_add(avl, box(651), box(206), NULL); + avl = gpr_avl_add(avl, box(927), box(207), NULL); avl = remove_int(avl, 553); - avl = gpr_avl_add(avl, box(128), box(209)); - avl = gpr_avl_add(avl, box(616), box(210)); - avl = gpr_avl_add(avl, box(690), box(211)); + avl = gpr_avl_add(avl, box(128), box(209), NULL); + avl = gpr_avl_add(avl, box(616), box(210), NULL); + avl = gpr_avl_add(avl, box(690), box(211), NULL); avl = remove_int(avl, 241); avl = remove_int(avl, 179); - avl = gpr_avl_add(avl, box(697), box(214)); + avl = gpr_avl_add(avl, box(697), box(214), NULL); avl = remove_int(avl, 779); - avl = gpr_avl_add(avl, box(241), box(216)); + avl = gpr_avl_add(avl, box(241), box(216), NULL); avl = remove_int(avl, 190); avl = remove_int(avl, 210); - avl = gpr_avl_add(avl, box(711), box(219)); + avl = gpr_avl_add(avl, box(711), box(219), NULL); avl = remove_int(avl, 251); avl = remove_int(avl, 61); - avl = gpr_avl_add(avl, box(800), box(222)); + avl = gpr_avl_add(avl, box(800), box(222), NULL); avl = remove_int(avl, 551); - avl = gpr_avl_add(avl, box(61), box(224)); - avl = gpr_avl_add(avl, box(656), box(225)); + avl = gpr_avl_add(avl, box(61), box(224), NULL); + avl = gpr_avl_add(avl, box(656), box(225), NULL); avl = remove_int(avl, 130); avl = remove_int(avl, 368); avl = remove_int(avl, 150); avl = remove_int(avl, 73); - avl = gpr_avl_add(avl, box(799), box(230)); - avl = gpr_avl_add(avl, box(125), box(231)); + avl = gpr_avl_add(avl, box(799), box(230), NULL); + avl = gpr_avl_add(avl, box(125), box(231), NULL); avl = remove_int(avl, 107); - avl = gpr_avl_add(avl, box(938), box(233)); - avl = gpr_avl_add(avl, box(914), box(234)); - avl = gpr_avl_add(avl, box(197), box(235)); + avl = gpr_avl_add(avl, box(938), box(233), NULL); + avl = gpr_avl_add(avl, box(914), box(234), NULL); + avl = gpr_avl_add(avl, box(197), box(235), NULL); avl = remove_int(avl, 736); - avl = gpr_avl_add(avl, box(20), box(237)); + avl = gpr_avl_add(avl, box(20), box(237), NULL); avl = remove_int(avl, 224); avl = remove_int(avl, 841); - avl = gpr_avl_add(avl, box(226), box(240)); + avl = gpr_avl_add(avl, box(226), box(240), NULL); avl = remove_int(avl, 963); avl = remove_int(avl, 796); avl = remove_int(avl, 728); - avl = gpr_avl_add(avl, box(855), box(244)); - avl = gpr_avl_add(avl, box(769), box(245)); - avl = gpr_avl_add(avl, box(631), box(246)); + avl = gpr_avl_add(avl, box(855), box(244), NULL); + avl = gpr_avl_add(avl, box(769), box(245), NULL); + avl = gpr_avl_add(avl, box(631), box(246), NULL); avl = remove_int(avl, 648); - avl = gpr_avl_add(avl, box(187), box(248)); - avl = gpr_avl_add(avl, box(31), box(249)); + avl = gpr_avl_add(avl, box(187), box(248), NULL); + avl = gpr_avl_add(avl, box(31), box(249), NULL); avl = remove_int(avl, 163); - avl = gpr_avl_add(avl, box(218), box(251)); - avl = gpr_avl_add(avl, box(488), box(252)); - avl = gpr_avl_add(avl, box(387), box(253)); - avl = gpr_avl_add(avl, box(809), box(254)); - avl = gpr_avl_add(avl, box(997), box(255)); + avl = gpr_avl_add(avl, box(218), box(251), NULL); + avl = gpr_avl_add(avl, box(488), box(252), NULL); + avl = gpr_avl_add(avl, box(387), box(253), NULL); + avl = gpr_avl_add(avl, box(809), box(254), NULL); + avl = gpr_avl_add(avl, box(997), box(255), NULL); avl = remove_int(avl, 678); - avl = gpr_avl_add(avl, box(368), box(257)); - avl = gpr_avl_add(avl, box(220), box(258)); - avl = gpr_avl_add(avl, box(373), box(259)); + avl = gpr_avl_add(avl, box(368), box(257), NULL); + avl = gpr_avl_add(avl, box(220), box(258), NULL); + avl = gpr_avl_add(avl, box(373), box(259), NULL); avl = remove_int(avl, 874); avl = remove_int(avl, 682); avl = remove_int(avl, 1014); avl = remove_int(avl, 195); - avl = gpr_avl_add(avl, box(868), box(264)); + avl = gpr_avl_add(avl, box(868), box(264), NULL); avl = remove_int(avl, 254); avl = remove_int(avl, 456); - avl = gpr_avl_add(avl, box(906), box(267)); + avl = gpr_avl_add(avl, box(906), box(267), NULL); avl = remove_int(avl, 711); - avl = gpr_avl_add(avl, box(632), box(269)); + avl = gpr_avl_add(avl, box(632), box(269), NULL); avl = remove_int(avl, 474); - avl = gpr_avl_add(avl, box(508), box(271)); - avl = gpr_avl_add(avl, box(518), box(272)); + avl = gpr_avl_add(avl, box(508), box(271), NULL); + avl = gpr_avl_add(avl, box(518), box(272), NULL); avl = remove_int(avl, 579); avl = remove_int(avl, 948); - avl = gpr_avl_add(avl, box(789), box(275)); - avl = gpr_avl_add(avl, box(48), box(276)); - avl = gpr_avl_add(avl, box(256), box(277)); - avl = gpr_avl_add(avl, box(754), box(278)); + avl = gpr_avl_add(avl, box(789), box(275), NULL); + avl = gpr_avl_add(avl, box(48), box(276), NULL); + avl = gpr_avl_add(avl, box(256), box(277), NULL); + avl = gpr_avl_add(avl, box(754), box(278), NULL); avl = remove_int(avl, 215); - avl = gpr_avl_add(avl, box(679), box(280)); - avl = gpr_avl_add(avl, box(606), box(281)); + avl = gpr_avl_add(avl, box(679), box(280), NULL); + avl = gpr_avl_add(avl, box(606), box(281), NULL); avl = remove_int(avl, 941); avl = remove_int(avl, 31); - avl = gpr_avl_add(avl, box(758), box(284)); + avl = gpr_avl_add(avl, box(758), box(284), NULL); avl = remove_int(avl, 101); - avl = gpr_avl_add(avl, box(244), box(286)); - avl = gpr_avl_add(avl, box(337), box(287)); - avl = gpr_avl_add(avl, box(461), box(288)); + avl = gpr_avl_add(avl, box(244), box(286), NULL); + avl = gpr_avl_add(avl, box(337), box(287), NULL); + avl = gpr_avl_add(avl, box(461), box(288), NULL); avl = remove_int(avl, 476); - avl = gpr_avl_add(avl, box(845), box(290)); + avl = gpr_avl_add(avl, box(845), box(290), NULL); avl = remove_int(avl, 160); - avl = gpr_avl_add(avl, box(690), box(292)); + avl = gpr_avl_add(avl, box(690), box(292), NULL); avl = remove_int(avl, 931); - avl = gpr_avl_add(avl, box(869), box(294)); - avl = gpr_avl_add(avl, box(1019), box(295)); + avl = gpr_avl_add(avl, box(869), box(294), NULL); + avl = gpr_avl_add(avl, box(1019), box(295), NULL); avl = remove_int(avl, 591); avl = remove_int(avl, 635); avl = remove_int(avl, 67); - avl = gpr_avl_add(avl, box(113), box(299)); + avl = gpr_avl_add(avl, box(113), box(299), NULL); avl = remove_int(avl, 305); - avl = gpr_avl_add(avl, box(10), box(301)); + avl = gpr_avl_add(avl, box(10), box(301), NULL); avl = remove_int(avl, 823); avl = remove_int(avl, 288); avl = remove_int(avl, 239); - avl = gpr_avl_add(avl, box(646), box(305)); - avl = gpr_avl_add(avl, box(1006), box(306)); - avl = gpr_avl_add(avl, box(954), box(307)); - avl = gpr_avl_add(avl, box(199), box(308)); - avl = gpr_avl_add(avl, box(69), box(309)); - avl = gpr_avl_add(avl, box(984), box(310)); + avl = gpr_avl_add(avl, box(646), box(305), NULL); + avl = gpr_avl_add(avl, box(1006), box(306), NULL); + avl = gpr_avl_add(avl, box(954), box(307), NULL); + avl = gpr_avl_add(avl, box(199), box(308), NULL); + avl = gpr_avl_add(avl, box(69), box(309), NULL); + avl = gpr_avl_add(avl, box(984), box(310), NULL); avl = remove_int(avl, 568); avl = remove_int(avl, 666); avl = remove_int(avl, 37); - avl = gpr_avl_add(avl, box(845), box(314)); + avl = gpr_avl_add(avl, box(845), box(314), NULL); avl = remove_int(avl, 535); avl = remove_int(avl, 365); avl = remove_int(avl, 676); @@ -1458,372 +1460,372 @@ static void test_badcase3(void) { avl = remove_int(avl, 425); avl = remove_int(avl, 704); avl = remove_int(avl, 168); - avl = gpr_avl_add(avl, box(853), box(322)); - avl = gpr_avl_add(avl, box(335), box(323)); - avl = gpr_avl_add(avl, box(961), box(324)); - avl = gpr_avl_add(avl, box(73), box(325)); + avl = gpr_avl_add(avl, box(853), box(322), NULL); + avl = gpr_avl_add(avl, box(335), box(323), NULL); + avl = gpr_avl_add(avl, box(961), box(324), NULL); + avl = gpr_avl_add(avl, box(73), box(325), NULL); avl = remove_int(avl, 469); - avl = gpr_avl_add(avl, box(449), box(327)); + avl = gpr_avl_add(avl, box(449), box(327), NULL); avl = remove_int(avl, 821); - avl = gpr_avl_add(avl, box(845), box(329)); + avl = gpr_avl_add(avl, box(845), box(329), NULL); avl = remove_int(avl, 637); - avl = gpr_avl_add(avl, box(769), box(331)); - avl = gpr_avl_add(avl, box(901), box(332)); + avl = gpr_avl_add(avl, box(769), box(331), NULL); + avl = gpr_avl_add(avl, box(901), box(332), NULL); avl = remove_int(avl, 142); avl = remove_int(avl, 361); avl = remove_int(avl, 876); - avl = gpr_avl_add(avl, box(614), box(336)); - avl = gpr_avl_add(avl, box(729), box(337)); + avl = gpr_avl_add(avl, box(614), box(336), NULL); + avl = gpr_avl_add(avl, box(729), box(337), NULL); avl = remove_int(avl, 120); avl = remove_int(avl, 473); avl = remove_int(avl, 445); - avl = gpr_avl_add(avl, box(978), box(341)); - avl = gpr_avl_add(avl, box(164), box(342)); - avl = gpr_avl_add(avl, box(1), box(343)); + avl = gpr_avl_add(avl, box(978), box(341), NULL); + avl = gpr_avl_add(avl, box(164), box(342), NULL); + avl = gpr_avl_add(avl, box(1), box(343), NULL); avl = remove_int(avl, 890); - avl = gpr_avl_add(avl, box(605), box(345)); - avl = gpr_avl_add(avl, box(178), box(346)); - avl = gpr_avl_add(avl, box(481), box(347)); - avl = gpr_avl_add(avl, box(772), box(348)); + avl = gpr_avl_add(avl, box(605), box(345), NULL); + avl = gpr_avl_add(avl, box(178), box(346), NULL); + avl = gpr_avl_add(avl, box(481), box(347), NULL); + avl = gpr_avl_add(avl, box(772), box(348), NULL); avl = remove_int(avl, 824); avl = remove_int(avl, 167); avl = remove_int(avl, 151); - avl = gpr_avl_add(avl, box(698), box(352)); - avl = gpr_avl_add(avl, box(202), box(353)); - avl = gpr_avl_add(avl, box(921), box(354)); - avl = gpr_avl_add(avl, box(875), box(355)); + avl = gpr_avl_add(avl, box(698), box(352), NULL); + avl = gpr_avl_add(avl, box(202), box(353), NULL); + avl = gpr_avl_add(avl, box(921), box(354), NULL); + avl = gpr_avl_add(avl, box(875), box(355), NULL); avl = remove_int(avl, 197); avl = remove_int(avl, 232); - avl = gpr_avl_add(avl, box(209), box(358)); + avl = gpr_avl_add(avl, box(209), box(358), NULL); avl = remove_int(avl, 324); avl = remove_int(avl, 56); avl = remove_int(avl, 579); avl = remove_int(avl, 255); avl = remove_int(avl, 290); - avl = gpr_avl_add(avl, box(661), box(364)); - avl = gpr_avl_add(avl, box(113), box(365)); + avl = gpr_avl_add(avl, box(661), box(364), NULL); + avl = gpr_avl_add(avl, box(113), box(365), NULL); avl = remove_int(avl, 767); - avl = gpr_avl_add(avl, box(586), box(367)); - avl = gpr_avl_add(avl, box(121), box(368)); + avl = gpr_avl_add(avl, box(586), box(367), NULL); + avl = gpr_avl_add(avl, box(121), box(368), NULL); avl = remove_int(avl, 235); avl = remove_int(avl, 439); avl = remove_int(avl, 360); - avl = gpr_avl_add(avl, box(916), box(372)); + avl = gpr_avl_add(avl, box(916), box(372), NULL); avl = remove_int(avl, 999); - avl = gpr_avl_add(avl, box(825), box(374)); - avl = gpr_avl_add(avl, box(177), box(375)); + avl = gpr_avl_add(avl, box(825), box(374), NULL); + avl = gpr_avl_add(avl, box(177), box(375), NULL); avl = remove_int(avl, 204); avl = remove_int(avl, 92); - avl = gpr_avl_add(avl, box(794), box(378)); - avl = gpr_avl_add(avl, box(463), box(379)); - avl = gpr_avl_add(avl, box(472), box(380)); + avl = gpr_avl_add(avl, box(794), box(378), NULL); + avl = gpr_avl_add(avl, box(463), box(379), NULL); + avl = gpr_avl_add(avl, box(472), box(380), NULL); avl = remove_int(avl, 235); - avl = gpr_avl_add(avl, box(840), box(382)); + avl = gpr_avl_add(avl, box(840), box(382), NULL); avl = remove_int(avl, 657); - avl = gpr_avl_add(avl, box(586), box(384)); - avl = gpr_avl_add(avl, box(979), box(385)); + avl = gpr_avl_add(avl, box(586), box(384), NULL); + avl = gpr_avl_add(avl, box(979), box(385), NULL); avl = remove_int(avl, 979); - avl = gpr_avl_add(avl, box(639), box(387)); + avl = gpr_avl_add(avl, box(639), box(387), NULL); avl = remove_int(avl, 907); avl = remove_int(avl, 973); - avl = gpr_avl_add(avl, box(913), box(390)); - avl = gpr_avl_add(avl, box(566), box(391)); - avl = gpr_avl_add(avl, box(883), box(392)); - avl = gpr_avl_add(avl, box(552), box(393)); - avl = gpr_avl_add(avl, box(16), box(394)); + avl = gpr_avl_add(avl, box(913), box(390), NULL); + avl = gpr_avl_add(avl, box(566), box(391), NULL); + avl = gpr_avl_add(avl, box(883), box(392), NULL); + avl = gpr_avl_add(avl, box(552), box(393), NULL); + avl = gpr_avl_add(avl, box(16), box(394), NULL); avl = remove_int(avl, 60); - avl = gpr_avl_add(avl, box(567), box(396)); - avl = gpr_avl_add(avl, box(705), box(397)); - avl = gpr_avl_add(avl, box(94), box(398)); + avl = gpr_avl_add(avl, box(567), box(396), NULL); + avl = gpr_avl_add(avl, box(705), box(397), NULL); + avl = gpr_avl_add(avl, box(94), box(398), NULL); avl = remove_int(avl, 321); - avl = gpr_avl_add(avl, box(207), box(400)); - avl = gpr_avl_add(avl, box(682), box(401)); - avl = gpr_avl_add(avl, box(592), box(402)); - avl = gpr_avl_add(avl, box(10), box(403)); + avl = gpr_avl_add(avl, box(207), box(400), NULL); + avl = gpr_avl_add(avl, box(682), box(401), NULL); + avl = gpr_avl_add(avl, box(592), box(402), NULL); + avl = gpr_avl_add(avl, box(10), box(403), NULL); avl = remove_int(avl, 911); avl = remove_int(avl, 161); - avl = gpr_avl_add(avl, box(86), box(406)); + avl = gpr_avl_add(avl, box(86), box(406), NULL); avl = remove_int(avl, 893); avl = remove_int(avl, 362); - avl = gpr_avl_add(avl, box(599), box(409)); + avl = gpr_avl_add(avl, box(599), box(409), NULL); avl = remove_int(avl, 413); - avl = gpr_avl_add(avl, box(867), box(411)); + avl = gpr_avl_add(avl, box(867), box(411), NULL); avl = remove_int(avl, 955); - avl = gpr_avl_add(avl, box(341), box(413)); - avl = gpr_avl_add(avl, box(887), box(414)); + avl = gpr_avl_add(avl, box(341), box(413), NULL); + avl = gpr_avl_add(avl, box(887), box(414), NULL); avl = remove_int(avl, 706); - avl = gpr_avl_add(avl, box(939), box(416)); + avl = gpr_avl_add(avl, box(939), box(416), NULL); avl = remove_int(avl, 233); avl = remove_int(avl, 662); avl = remove_int(avl, 984); avl = remove_int(avl, 203); - avl = gpr_avl_add(avl, box(326), box(421)); + avl = gpr_avl_add(avl, box(326), box(421), NULL); avl = remove_int(avl, 848); - avl = gpr_avl_add(avl, box(235), box(423)); + avl = gpr_avl_add(avl, box(235), box(423), NULL); avl = remove_int(avl, 617); - avl = gpr_avl_add(avl, box(565), box(425)); + avl = gpr_avl_add(avl, box(565), box(425), NULL); avl = remove_int(avl, 469); - avl = gpr_avl_add(avl, box(988), box(427)); + avl = gpr_avl_add(avl, box(988), box(427), NULL); avl = remove_int(avl, 957); - avl = gpr_avl_add(avl, box(426), box(429)); + avl = gpr_avl_add(avl, box(426), box(429), NULL); avl = remove_int(avl, 967); - avl = gpr_avl_add(avl, box(890), box(431)); - avl = gpr_avl_add(avl, box(473), box(432)); + avl = gpr_avl_add(avl, box(890), box(431), NULL); + avl = gpr_avl_add(avl, box(473), box(432), NULL); avl = remove_int(avl, 367); avl = remove_int(avl, 344); avl = remove_int(avl, 660); avl = remove_int(avl, 448); avl = remove_int(avl, 837); avl = remove_int(avl, 158); - avl = gpr_avl_add(avl, box(459), box(439)); + avl = gpr_avl_add(avl, box(459), box(439), NULL); avl = remove_int(avl, 882); avl = remove_int(avl, 782); - avl = gpr_avl_add(avl, box(408), box(442)); - avl = gpr_avl_add(avl, box(728), box(443)); + avl = gpr_avl_add(avl, box(408), box(442), NULL); + avl = gpr_avl_add(avl, box(728), box(443), NULL); avl = remove_int(avl, 27); - avl = gpr_avl_add(avl, box(137), box(445)); - avl = gpr_avl_add(avl, box(239), box(446)); + avl = gpr_avl_add(avl, box(137), box(445), NULL); + avl = gpr_avl_add(avl, box(239), box(446), NULL); avl = remove_int(avl, 854); - avl = gpr_avl_add(avl, box(104), box(448)); - avl = gpr_avl_add(avl, box(823), box(449)); - avl = gpr_avl_add(avl, box(524), box(450)); - avl = gpr_avl_add(avl, box(995), box(451)); + avl = gpr_avl_add(avl, box(104), box(448), NULL); + avl = gpr_avl_add(avl, box(823), box(449), NULL); + avl = gpr_avl_add(avl, box(524), box(450), NULL); + avl = gpr_avl_add(avl, box(995), box(451), NULL); avl = remove_int(avl, 422); avl = remove_int(avl, 220); - avl = gpr_avl_add(avl, box(856), box(454)); + avl = gpr_avl_add(avl, box(856), box(454), NULL); avl = remove_int(avl, 332); - avl = gpr_avl_add(avl, box(679), box(456)); + avl = gpr_avl_add(avl, box(679), box(456), NULL); avl = remove_int(avl, 18); - avl = gpr_avl_add(avl, box(837), box(458)); + avl = gpr_avl_add(avl, box(837), box(458), NULL); avl = remove_int(avl, 405); avl = remove_int(avl, 877); avl = remove_int(avl, 835); - avl = gpr_avl_add(avl, box(547), box(462)); + avl = gpr_avl_add(avl, box(547), box(462), NULL); avl = remove_int(avl, 805); avl = remove_int(avl, 862); - avl = gpr_avl_add(avl, box(75), box(465)); + avl = gpr_avl_add(avl, box(75), box(465), NULL); avl = remove_int(avl, 41); - avl = gpr_avl_add(avl, box(310), box(467)); + avl = gpr_avl_add(avl, box(310), box(467), NULL); avl = remove_int(avl, 855); - avl = gpr_avl_add(avl, box(20), box(469)); + avl = gpr_avl_add(avl, box(20), box(469), NULL); avl = remove_int(avl, 186); avl = remove_int(avl, 378); avl = remove_int(avl, 442); avl = remove_int(avl, 930); - avl = gpr_avl_add(avl, box(118), box(474)); - avl = gpr_avl_add(avl, box(96), box(475)); + avl = gpr_avl_add(avl, box(118), box(474), NULL); + avl = gpr_avl_add(avl, box(96), box(475), NULL); avl = remove_int(avl, 854); - avl = gpr_avl_add(avl, box(65), box(477)); - avl = gpr_avl_add(avl, box(573), box(478)); - avl = gpr_avl_add(avl, box(4), box(479)); - avl = gpr_avl_add(avl, box(451), box(480)); - avl = gpr_avl_add(avl, box(774), box(481)); - avl = gpr_avl_add(avl, box(126), box(482)); + avl = gpr_avl_add(avl, box(65), box(477), NULL); + avl = gpr_avl_add(avl, box(573), box(478), NULL); + avl = gpr_avl_add(avl, box(4), box(479), NULL); + avl = gpr_avl_add(avl, box(451), box(480), NULL); + avl = gpr_avl_add(avl, box(774), box(481), NULL); + avl = gpr_avl_add(avl, box(126), box(482), NULL); avl = remove_int(avl, 956); avl = remove_int(avl, 591); avl = remove_int(avl, 644); - avl = gpr_avl_add(avl, box(304), box(486)); + avl = gpr_avl_add(avl, box(304), box(486), NULL); avl = remove_int(avl, 620); avl = remove_int(avl, 394); - avl = gpr_avl_add(avl, box(1002), box(489)); - avl = gpr_avl_add(avl, box(837), box(490)); + avl = gpr_avl_add(avl, box(1002), box(489), NULL); + avl = gpr_avl_add(avl, box(837), box(490), NULL); avl = remove_int(avl, 485); - avl = gpr_avl_add(avl, box(1005), box(492)); + avl = gpr_avl_add(avl, box(1005), box(492), NULL); avl = remove_int(avl, 21); - avl = gpr_avl_add(avl, box(396), box(494)); + avl = gpr_avl_add(avl, box(396), box(494), NULL); avl = remove_int(avl, 966); - avl = gpr_avl_add(avl, box(105), box(496)); - avl = gpr_avl_add(avl, box(316), box(497)); + avl = gpr_avl_add(avl, box(105), box(496), NULL); + avl = gpr_avl_add(avl, box(316), box(497), NULL); avl = remove_int(avl, 776); - avl = gpr_avl_add(avl, box(188), box(499)); + avl = gpr_avl_add(avl, box(188), box(499), NULL); avl = remove_int(avl, 200); - avl = gpr_avl_add(avl, box(98), box(501)); - avl = gpr_avl_add(avl, box(831), box(502)); - avl = gpr_avl_add(avl, box(227), box(503)); - avl = gpr_avl_add(avl, box(220), box(504)); + avl = gpr_avl_add(avl, box(98), box(501), NULL); + avl = gpr_avl_add(avl, box(831), box(502), NULL); + avl = gpr_avl_add(avl, box(227), box(503), NULL); + avl = gpr_avl_add(avl, box(220), box(504), NULL); avl = remove_int(avl, 715); avl = remove_int(avl, 279); - avl = gpr_avl_add(avl, box(701), box(507)); - avl = gpr_avl_add(avl, box(726), box(508)); - avl = gpr_avl_add(avl, box(815), box(509)); - avl = gpr_avl_add(avl, box(749), box(510)); + avl = gpr_avl_add(avl, box(701), box(507), NULL); + avl = gpr_avl_add(avl, box(726), box(508), NULL); + avl = gpr_avl_add(avl, box(815), box(509), NULL); + avl = gpr_avl_add(avl, box(749), box(510), NULL); avl = remove_int(avl, 946); avl = remove_int(avl, 449); avl = remove_int(avl, 62); avl = remove_int(avl, 487); - avl = gpr_avl_add(avl, box(545), box(515)); + avl = gpr_avl_add(avl, box(545), box(515), NULL); avl = remove_int(avl, 59); - avl = gpr_avl_add(avl, box(168), box(517)); + avl = gpr_avl_add(avl, box(168), box(517), NULL); avl = remove_int(avl, 337); - avl = gpr_avl_add(avl, box(69), box(519)); + avl = gpr_avl_add(avl, box(69), box(519), NULL); avl = remove_int(avl, 600); - avl = gpr_avl_add(avl, box(591), box(521)); - avl = gpr_avl_add(avl, box(960), box(522)); - avl = gpr_avl_add(avl, box(116), box(523)); + avl = gpr_avl_add(avl, box(591), box(521), NULL); + avl = gpr_avl_add(avl, box(960), box(522), NULL); + avl = gpr_avl_add(avl, box(116), box(523), NULL); avl = remove_int(avl, 991); - avl = gpr_avl_add(avl, box(760), box(525)); - avl = gpr_avl_add(avl, box(664), box(526)); - avl = gpr_avl_add(avl, box(547), box(527)); + avl = gpr_avl_add(avl, box(760), box(525), NULL); + avl = gpr_avl_add(avl, box(664), box(526), NULL); + avl = gpr_avl_add(avl, box(547), box(527), NULL); avl = remove_int(avl, 922); - avl = gpr_avl_add(avl, box(290), box(529)); - avl = gpr_avl_add(avl, box(859), box(530)); - avl = gpr_avl_add(avl, box(49), box(531)); + avl = gpr_avl_add(avl, box(290), box(529), NULL); + avl = gpr_avl_add(avl, box(859), box(530), NULL); + avl = gpr_avl_add(avl, box(49), box(531), NULL); avl = remove_int(avl, 455); avl = remove_int(avl, 786); - avl = gpr_avl_add(avl, box(613), box(534)); - avl = gpr_avl_add(avl, box(326), box(535)); + avl = gpr_avl_add(avl, box(613), box(534), NULL); + avl = gpr_avl_add(avl, box(326), box(535), NULL); avl = remove_int(avl, 615); - avl = gpr_avl_add(avl, box(45), box(537)); - avl = gpr_avl_add(avl, box(162), box(538)); - avl = gpr_avl_add(avl, box(189), box(539)); + avl = gpr_avl_add(avl, box(45), box(537), NULL); + avl = gpr_avl_add(avl, box(162), box(538), NULL); + avl = gpr_avl_add(avl, box(189), box(539), NULL); avl = remove_int(avl, 68); avl = remove_int(avl, 846); - avl = gpr_avl_add(avl, box(608), box(542)); + avl = gpr_avl_add(avl, box(608), box(542), NULL); avl = remove_int(avl, 821); - avl = gpr_avl_add(avl, box(978), box(544)); - avl = gpr_avl_add(avl, box(892), box(545)); + avl = gpr_avl_add(avl, box(978), box(544), NULL); + avl = gpr_avl_add(avl, box(892), box(545), NULL); avl = remove_int(avl, 924); - avl = gpr_avl_add(avl, box(708), box(547)); + avl = gpr_avl_add(avl, box(708), box(547), NULL); avl = remove_int(avl, 135); avl = remove_int(avl, 124); - avl = gpr_avl_add(avl, box(301), box(550)); - avl = gpr_avl_add(avl, box(939), box(551)); - avl = gpr_avl_add(avl, box(344), box(552)); + avl = gpr_avl_add(avl, box(301), box(550), NULL); + avl = gpr_avl_add(avl, box(939), box(551), NULL); + avl = gpr_avl_add(avl, box(344), box(552), NULL); avl = remove_int(avl, 443); avl = remove_int(avl, 122); - avl = gpr_avl_add(avl, box(636), box(555)); + avl = gpr_avl_add(avl, box(636), box(555), NULL); avl = remove_int(avl, 558); - avl = gpr_avl_add(avl, box(923), box(557)); + avl = gpr_avl_add(avl, box(923), box(557), NULL); avl = remove_int(avl, 827); - avl = gpr_avl_add(avl, box(649), box(559)); - avl = gpr_avl_add(avl, box(808), box(560)); + avl = gpr_avl_add(avl, box(649), box(559), NULL); + avl = gpr_avl_add(avl, box(808), box(560), NULL); avl = remove_int(avl, 570); avl = remove_int(avl, 434); - avl = gpr_avl_add(avl, box(40), box(563)); - avl = gpr_avl_add(avl, box(725), box(564)); + avl = gpr_avl_add(avl, box(40), box(563), NULL); + avl = gpr_avl_add(avl, box(725), box(564), NULL); avl = remove_int(avl, 295); avl = remove_int(avl, 615); avl = remove_int(avl, 919); avl = remove_int(avl, 170); avl = remove_int(avl, 442); avl = remove_int(avl, 971); - avl = gpr_avl_add(avl, box(483), box(571)); - avl = gpr_avl_add(avl, box(512), box(572)); + avl = gpr_avl_add(avl, box(483), box(571), NULL); + avl = gpr_avl_add(avl, box(512), box(572), NULL); avl = remove_int(avl, 648); avl = remove_int(avl, 78); avl = remove_int(avl, 72); avl = remove_int(avl, 790); avl = remove_int(avl, 571); - avl = gpr_avl_add(avl, box(898), box(578)); + avl = gpr_avl_add(avl, box(898), box(578), NULL); avl = remove_int(avl, 770); avl = remove_int(avl, 776); - avl = gpr_avl_add(avl, box(602), box(581)); + avl = gpr_avl_add(avl, box(602), box(581), NULL); avl = remove_int(avl, 251); - avl = gpr_avl_add(avl, box(303), box(583)); + avl = gpr_avl_add(avl, box(303), box(583), NULL); avl = remove_int(avl, 837); - avl = gpr_avl_add(avl, box(714), box(585)); + avl = gpr_avl_add(avl, box(714), box(585), NULL); avl = remove_int(avl, 800); - avl = gpr_avl_add(avl, box(266), box(587)); - avl = gpr_avl_add(avl, box(555), box(588)); + avl = gpr_avl_add(avl, box(266), box(587), NULL); + avl = gpr_avl_add(avl, box(555), box(588), NULL); avl = remove_int(avl, 604); avl = remove_int(avl, 163); avl = remove_int(avl, 497); - avl = gpr_avl_add(avl, box(296), box(592)); + avl = gpr_avl_add(avl, box(296), box(592), NULL); avl = remove_int(avl, 129); - avl = gpr_avl_add(avl, box(656), box(594)); + avl = gpr_avl_add(avl, box(656), box(594), NULL); avl = remove_int(avl, 769); avl = remove_int(avl, 941); - avl = gpr_avl_add(avl, box(775), box(597)); - avl = gpr_avl_add(avl, box(846), box(598)); + avl = gpr_avl_add(avl, box(775), box(597), NULL); + avl = gpr_avl_add(avl, box(846), box(598), NULL); avl = remove_int(avl, 591); avl = remove_int(avl, 801); avl = remove_int(avl, 419); avl = remove_int(avl, 455); - avl = gpr_avl_add(avl, box(866), box(603)); - avl = gpr_avl_add(avl, box(575), box(604)); - avl = gpr_avl_add(avl, box(620), box(605)); + avl = gpr_avl_add(avl, box(866), box(603), NULL); + avl = gpr_avl_add(avl, box(575), box(604), NULL); + avl = gpr_avl_add(avl, box(620), box(605), NULL); avl = remove_int(avl, 100); avl = remove_int(avl, 667); - avl = gpr_avl_add(avl, box(138), box(608)); - avl = gpr_avl_add(avl, box(566), box(609)); - avl = gpr_avl_add(avl, box(673), box(610)); - avl = gpr_avl_add(avl, box(178), box(611)); + avl = gpr_avl_add(avl, box(138), box(608), NULL); + avl = gpr_avl_add(avl, box(566), box(609), NULL); + avl = gpr_avl_add(avl, box(673), box(610), NULL); + avl = gpr_avl_add(avl, box(178), box(611), NULL); avl = remove_int(avl, 659); - avl = gpr_avl_add(avl, box(759), box(613)); - avl = gpr_avl_add(avl, box(1008), box(614)); + avl = gpr_avl_add(avl, box(759), box(613), NULL); + avl = gpr_avl_add(avl, box(1008), box(614), NULL); avl = remove_int(avl, 116); - avl = gpr_avl_add(avl, box(608), box(616)); - avl = gpr_avl_add(avl, box(339), box(617)); - avl = gpr_avl_add(avl, box(197), box(618)); + avl = gpr_avl_add(avl, box(608), box(616), NULL); + avl = gpr_avl_add(avl, box(339), box(617), NULL); + avl = gpr_avl_add(avl, box(197), box(618), NULL); avl = remove_int(avl, 25); avl = remove_int(avl, 628); - avl = gpr_avl_add(avl, box(487), box(621)); + avl = gpr_avl_add(avl, box(487), box(621), NULL); avl = remove_int(avl, 739); avl = remove_int(avl, 100); avl = remove_int(avl, 928); - avl = gpr_avl_add(avl, box(647), box(625)); + avl = gpr_avl_add(avl, box(647), box(625), NULL); avl = remove_int(avl, 978); avl = remove_int(avl, 143); avl = remove_int(avl, 755); - avl = gpr_avl_add(avl, box(71), box(629)); + avl = gpr_avl_add(avl, box(71), box(629), NULL); avl = remove_int(avl, 205); - avl = gpr_avl_add(avl, box(501), box(631)); + avl = gpr_avl_add(avl, box(501), box(631), NULL); avl = remove_int(avl, 723); avl = remove_int(avl, 852); avl = remove_int(avl, 1021); avl = remove_int(avl, 670); avl = remove_int(avl, 500); - avl = gpr_avl_add(avl, box(330), box(637)); + avl = gpr_avl_add(avl, box(330), box(637), NULL); avl = remove_int(avl, 264); - avl = gpr_avl_add(avl, box(69), box(639)); + avl = gpr_avl_add(avl, box(69), box(639), NULL); avl = remove_int(avl, 73); - avl = gpr_avl_add(avl, box(745), box(641)); + avl = gpr_avl_add(avl, box(745), box(641), NULL); avl = remove_int(avl, 518); avl = remove_int(avl, 641); avl = remove_int(avl, 768); - avl = gpr_avl_add(avl, box(988), box(645)); - avl = gpr_avl_add(avl, box(899), box(646)); + avl = gpr_avl_add(avl, box(988), box(645), NULL); + avl = gpr_avl_add(avl, box(899), box(646), NULL); avl = remove_int(avl, 763); avl = remove_int(avl, 281); avl = remove_int(avl, 496); - avl = gpr_avl_add(avl, box(445), box(650)); + avl = gpr_avl_add(avl, box(445), box(650), NULL); avl = remove_int(avl, 905); - avl = gpr_avl_add(avl, box(275), box(652)); - avl = gpr_avl_add(avl, box(137), box(653)); + avl = gpr_avl_add(avl, box(275), box(652), NULL); + avl = gpr_avl_add(avl, box(137), box(653), NULL); avl = remove_int(avl, 642); - avl = gpr_avl_add(avl, box(708), box(655)); + avl = gpr_avl_add(avl, box(708), box(655), NULL); avl = remove_int(avl, 922); - avl = gpr_avl_add(avl, box(743), box(657)); + avl = gpr_avl_add(avl, box(743), box(657), NULL); avl = remove_int(avl, 295); avl = remove_int(avl, 665); avl = remove_int(avl, 48); - avl = gpr_avl_add(avl, box(1012), box(661)); + avl = gpr_avl_add(avl, box(1012), box(661), NULL); avl = remove_int(avl, 71); avl = remove_int(avl, 523); - avl = gpr_avl_add(avl, box(319), box(664)); + avl = gpr_avl_add(avl, box(319), box(664), NULL); avl = remove_int(avl, 632); - avl = gpr_avl_add(avl, box(137), box(666)); - avl = gpr_avl_add(avl, box(686), box(667)); - avl = gpr_avl_add(avl, box(724), box(668)); - avl = gpr_avl_add(avl, box(952), box(669)); - avl = gpr_avl_add(avl, box(5), box(670)); + avl = gpr_avl_add(avl, box(137), box(666), NULL); + avl = gpr_avl_add(avl, box(686), box(667), NULL); + avl = gpr_avl_add(avl, box(724), box(668), NULL); + avl = gpr_avl_add(avl, box(952), box(669), NULL); + avl = gpr_avl_add(avl, box(5), box(670), NULL); avl = remove_int(avl, 35); - avl = gpr_avl_add(avl, box(43), box(672)); - avl = gpr_avl_add(avl, box(320), box(673)); - avl = gpr_avl_add(avl, box(115), box(674)); + avl = gpr_avl_add(avl, box(43), box(672), NULL); + avl = gpr_avl_add(avl, box(320), box(673), NULL); + avl = gpr_avl_add(avl, box(115), box(674), NULL); avl = remove_int(avl, 377); avl = remove_int(avl, 591); avl = remove_int(avl, 87); avl = remove_int(avl, 93); - avl = gpr_avl_add(avl, box(1016), box(679)); - avl = gpr_avl_add(avl, box(605), box(680)); - avl = gpr_avl_add(avl, box(152), box(681)); - avl = gpr_avl_add(avl, box(113), box(682)); + avl = gpr_avl_add(avl, box(1016), box(679), NULL); + avl = gpr_avl_add(avl, box(605), box(680), NULL); + avl = gpr_avl_add(avl, box(152), box(681), NULL); + avl = gpr_avl_add(avl, box(113), box(682), NULL); avl = remove_int(avl, 131); avl = remove_int(avl, 637); - avl = gpr_avl_add(avl, box(156), box(685)); + avl = gpr_avl_add(avl, box(156), box(685), NULL); avl = remove_int(avl, 696); - avl = gpr_avl_add(avl, box(546), box(687)); + avl = gpr_avl_add(avl, box(546), box(687), NULL); avl = remove_int(avl, 970); avl = remove_int(avl, 53); avl = remove_int(avl, 827); @@ -1837,22 +1839,22 @@ static void test_badcase3(void) { avl = remove_int(avl, 244); avl = remove_int(avl, 576); avl = remove_int(avl, 413); - avl = gpr_avl_add(avl, box(500), box(701)); + avl = gpr_avl_add(avl, box(500), box(701), NULL); avl = remove_int(avl, 924); - avl = gpr_avl_add(avl, box(825), box(703)); + avl = gpr_avl_add(avl, box(825), box(703), NULL); avl = remove_int(avl, 888); avl = remove_int(avl, 931); - avl = gpr_avl_add(avl, box(285), box(706)); + avl = gpr_avl_add(avl, box(285), box(706), NULL); avl = remove_int(avl, 62); avl = remove_int(avl, 444); avl = remove_int(avl, 946); - avl = gpr_avl_add(avl, box(122), box(710)); - avl = gpr_avl_add(avl, box(846), box(711)); + avl = gpr_avl_add(avl, box(122), box(710), NULL); + avl = gpr_avl_add(avl, box(846), box(711), NULL); avl = remove_int(avl, 628); - avl = gpr_avl_add(avl, box(511), box(713)); - avl = gpr_avl_add(avl, box(398), box(714)); + avl = gpr_avl_add(avl, box(511), box(713), NULL); + avl = gpr_avl_add(avl, box(398), box(714), NULL); avl = remove_int(avl, 730); - avl = gpr_avl_add(avl, box(797), box(716)); + avl = gpr_avl_add(avl, box(797), box(716), NULL); avl = remove_int(avl, 897); avl = remove_int(avl, 228); avl = remove_int(avl, 544); @@ -1861,51 +1863,51 @@ static void test_badcase3(void) { avl = remove_int(avl, 583); avl = remove_int(avl, 894); avl = remove_int(avl, 942); - avl = gpr_avl_add(avl, box(346), box(725)); - avl = gpr_avl_add(avl, box(1015), box(726)); + avl = gpr_avl_add(avl, box(346), box(725), NULL); + avl = gpr_avl_add(avl, box(1015), box(726), NULL); avl = remove_int(avl, 813); - avl = gpr_avl_add(avl, box(213), box(728)); + avl = gpr_avl_add(avl, box(213), box(728), NULL); avl = remove_int(avl, 468); avl = remove_int(avl, 365); avl = remove_int(avl, 399); - avl = gpr_avl_add(avl, box(380), box(732)); + avl = gpr_avl_add(avl, box(380), box(732), NULL); avl = remove_int(avl, 835); avl = remove_int(avl, 970); - avl = gpr_avl_add(avl, box(700), box(735)); - avl = gpr_avl_add(avl, box(807), box(736)); + avl = gpr_avl_add(avl, box(700), box(735), NULL); + avl = gpr_avl_add(avl, box(807), box(736), NULL); avl = remove_int(avl, 312); avl = remove_int(avl, 282); avl = remove_int(avl, 370); avl = remove_int(avl, 999); avl = remove_int(avl, 241); avl = remove_int(avl, 884); - avl = gpr_avl_add(avl, box(587), box(743)); - avl = gpr_avl_add(avl, box(332), box(744)); + avl = gpr_avl_add(avl, box(587), box(743), NULL); + avl = gpr_avl_add(avl, box(332), box(744), NULL); avl = remove_int(avl, 686); avl = remove_int(avl, 206); avl = remove_int(avl, 835); - avl = gpr_avl_add(avl, box(334), box(748)); + avl = gpr_avl_add(avl, box(334), box(748), NULL); avl = remove_int(avl, 171); - avl = gpr_avl_add(avl, box(1002), box(750)); - avl = gpr_avl_add(avl, box(779), box(751)); - avl = gpr_avl_add(avl, box(307), box(752)); - avl = gpr_avl_add(avl, box(127), box(753)); - avl = gpr_avl_add(avl, box(251), box(754)); + avl = gpr_avl_add(avl, box(1002), box(750), NULL); + avl = gpr_avl_add(avl, box(779), box(751), NULL); + avl = gpr_avl_add(avl, box(307), box(752), NULL); + avl = gpr_avl_add(avl, box(127), box(753), NULL); + avl = gpr_avl_add(avl, box(251), box(754), NULL); avl = remove_int(avl, 790); avl = remove_int(avl, 189); avl = remove_int(avl, 193); avl = remove_int(avl, 38); avl = remove_int(avl, 124); - avl = gpr_avl_add(avl, box(812), box(760)); + avl = gpr_avl_add(avl, box(812), box(760), NULL); avl = remove_int(avl, 43); - avl = gpr_avl_add(avl, box(871), box(762)); - avl = gpr_avl_add(avl, box(580), box(763)); + avl = gpr_avl_add(avl, box(871), box(762), NULL); + avl = gpr_avl_add(avl, box(580), box(763), NULL); avl = remove_int(avl, 501); avl = remove_int(avl, 462); avl = remove_int(avl, 599); - avl = gpr_avl_add(avl, box(240), box(767)); - avl = gpr_avl_add(avl, box(285), box(768)); - avl = gpr_avl_add(avl, box(472), box(769)); + avl = gpr_avl_add(avl, box(240), box(767), NULL); + avl = gpr_avl_add(avl, box(285), box(768), NULL); + avl = gpr_avl_add(avl, box(472), box(769), NULL); avl = remove_int(avl, 865); avl = remove_int(avl, 763); avl = remove_int(avl, 245); @@ -1913,48 +1915,48 @@ static void test_badcase3(void) { avl = remove_int(avl, 713); avl = remove_int(avl, 654); avl = remove_int(avl, 1014); - avl = gpr_avl_add(avl, box(495), box(777)); - avl = gpr_avl_add(avl, box(552), box(778)); + avl = gpr_avl_add(avl, box(495), box(777), NULL); + avl = gpr_avl_add(avl, box(552), box(778), NULL); avl = remove_int(avl, 19); avl = remove_int(avl, 803); - avl = gpr_avl_add(avl, box(508), box(781)); + avl = gpr_avl_add(avl, box(508), box(781), NULL); avl = remove_int(avl, 699); avl = remove_int(avl, 260); avl = remove_int(avl, 92); avl = remove_int(avl, 497); - avl = gpr_avl_add(avl, box(970), box(786)); + avl = gpr_avl_add(avl, box(970), box(786), NULL); avl = remove_int(avl, 987); avl = remove_int(avl, 168); avl = remove_int(avl, 476); avl = remove_int(avl, 248); - avl = gpr_avl_add(avl, box(358), box(791)); + avl = gpr_avl_add(avl, box(358), box(791), NULL); avl = remove_int(avl, 804); avl = remove_int(avl, 77); avl = remove_int(avl, 905); avl = remove_int(avl, 362); - avl = gpr_avl_add(avl, box(578), box(796)); + avl = gpr_avl_add(avl, box(578), box(796), NULL); avl = remove_int(avl, 38); avl = remove_int(avl, 595); - avl = gpr_avl_add(avl, box(213), box(799)); + avl = gpr_avl_add(avl, box(213), box(799), NULL); avl = remove_int(avl, 7); avl = remove_int(avl, 620); - avl = gpr_avl_add(avl, box(946), box(802)); + avl = gpr_avl_add(avl, box(946), box(802), NULL); avl = remove_int(avl, 145); - avl = gpr_avl_add(avl, box(628), box(804)); + avl = gpr_avl_add(avl, box(628), box(804), NULL); avl = remove_int(avl, 972); - avl = gpr_avl_add(avl, box(728), box(806)); + avl = gpr_avl_add(avl, box(728), box(806), NULL); avl = remove_int(avl, 91); - avl = gpr_avl_add(avl, box(136), box(808)); - avl = gpr_avl_add(avl, box(841), box(809)); - avl = gpr_avl_add(avl, box(265), box(810)); - avl = gpr_avl_add(avl, box(701), box(811)); - avl = gpr_avl_add(avl, box(27), box(812)); + avl = gpr_avl_add(avl, box(136), box(808), NULL); + avl = gpr_avl_add(avl, box(841), box(809), NULL); + avl = gpr_avl_add(avl, box(265), box(810), NULL); + avl = gpr_avl_add(avl, box(701), box(811), NULL); + avl = gpr_avl_add(avl, box(27), box(812), NULL); avl = remove_int(avl, 72); avl = remove_int(avl, 14); - avl = gpr_avl_add(avl, box(286), box(815)); + avl = gpr_avl_add(avl, box(286), box(815), NULL); avl = remove_int(avl, 996); avl = remove_int(avl, 998); - avl = gpr_avl_add(avl, box(466), box(818)); + avl = gpr_avl_add(avl, box(466), box(818), NULL); avl = remove_int(avl, 1009); avl = remove_int(avl, 741); avl = remove_int(avl, 947); @@ -1963,138 +1965,138 @@ static void test_badcase3(void) { avl = remove_int(avl, 183); avl = remove_int(avl, 395); avl = remove_int(avl, 951); - avl = gpr_avl_add(avl, box(267), box(827)); + avl = gpr_avl_add(avl, box(267), box(827), NULL); avl = remove_int(avl, 812); - avl = gpr_avl_add(avl, box(577), box(829)); + avl = gpr_avl_add(avl, box(577), box(829), NULL); avl = remove_int(avl, 624); avl = remove_int(avl, 847); avl = remove_int(avl, 745); - avl = gpr_avl_add(avl, box(491), box(833)); - avl = gpr_avl_add(avl, box(941), box(834)); + avl = gpr_avl_add(avl, box(491), box(833), NULL); + avl = gpr_avl_add(avl, box(941), box(834), NULL); avl = remove_int(avl, 258); - avl = gpr_avl_add(avl, box(410), box(836)); - avl = gpr_avl_add(avl, box(80), box(837)); - avl = gpr_avl_add(avl, box(196), box(838)); - avl = gpr_avl_add(avl, box(5), box(839)); + avl = gpr_avl_add(avl, box(410), box(836), NULL); + avl = gpr_avl_add(avl, box(80), box(837), NULL); + avl = gpr_avl_add(avl, box(196), box(838), NULL); + avl = gpr_avl_add(avl, box(5), box(839), NULL); avl = remove_int(avl, 782); - avl = gpr_avl_add(avl, box(827), box(841)); + avl = gpr_avl_add(avl, box(827), box(841), NULL); avl = remove_int(avl, 472); avl = remove_int(avl, 664); - avl = gpr_avl_add(avl, box(409), box(844)); - avl = gpr_avl_add(avl, box(62), box(845)); + avl = gpr_avl_add(avl, box(409), box(844), NULL); + avl = gpr_avl_add(avl, box(62), box(845), NULL); avl = remove_int(avl, 56); avl = remove_int(avl, 606); avl = remove_int(avl, 707); avl = remove_int(avl, 989); avl = remove_int(avl, 549); avl = remove_int(avl, 259); - avl = gpr_avl_add(avl, box(405), box(852)); + avl = gpr_avl_add(avl, box(405), box(852), NULL); avl = remove_int(avl, 587); avl = remove_int(avl, 350); - avl = gpr_avl_add(avl, box(980), box(855)); - avl = gpr_avl_add(avl, box(992), box(856)); - avl = gpr_avl_add(avl, box(818), box(857)); + avl = gpr_avl_add(avl, box(980), box(855), NULL); + avl = gpr_avl_add(avl, box(992), box(856), NULL); + avl = gpr_avl_add(avl, box(818), box(857), NULL); avl = remove_int(avl, 853); avl = remove_int(avl, 701); - avl = gpr_avl_add(avl, box(675), box(860)); + avl = gpr_avl_add(avl, box(675), box(860), NULL); avl = remove_int(avl, 248); avl = remove_int(avl, 649); - avl = gpr_avl_add(avl, box(508), box(863)); + avl = gpr_avl_add(avl, box(508), box(863), NULL); avl = remove_int(avl, 927); - avl = gpr_avl_add(avl, box(957), box(865)); - avl = gpr_avl_add(avl, box(698), box(866)); - avl = gpr_avl_add(avl, box(388), box(867)); - avl = gpr_avl_add(avl, box(532), box(868)); - avl = gpr_avl_add(avl, box(681), box(869)); + avl = gpr_avl_add(avl, box(957), box(865), NULL); + avl = gpr_avl_add(avl, box(698), box(866), NULL); + avl = gpr_avl_add(avl, box(388), box(867), NULL); + avl = gpr_avl_add(avl, box(532), box(868), NULL); + avl = gpr_avl_add(avl, box(681), box(869), NULL); avl = remove_int(avl, 544); avl = remove_int(avl, 991); avl = remove_int(avl, 397); - avl = gpr_avl_add(avl, box(954), box(873)); - avl = gpr_avl_add(avl, box(219), box(874)); - avl = gpr_avl_add(avl, box(465), box(875)); + avl = gpr_avl_add(avl, box(954), box(873), NULL); + avl = gpr_avl_add(avl, box(219), box(874), NULL); + avl = gpr_avl_add(avl, box(465), box(875), NULL); avl = remove_int(avl, 371); - avl = gpr_avl_add(avl, box(601), box(877)); - avl = gpr_avl_add(avl, box(543), box(878)); + avl = gpr_avl_add(avl, box(601), box(877), NULL); + avl = gpr_avl_add(avl, box(543), box(878), NULL); avl = remove_int(avl, 329); - avl = gpr_avl_add(avl, box(560), box(880)); + avl = gpr_avl_add(avl, box(560), box(880), NULL); avl = remove_int(avl, 898); - avl = gpr_avl_add(avl, box(455), box(882)); + avl = gpr_avl_add(avl, box(455), box(882), NULL); avl = remove_int(avl, 313); - avl = gpr_avl_add(avl, box(215), box(884)); + avl = gpr_avl_add(avl, box(215), box(884), NULL); avl = remove_int(avl, 846); - avl = gpr_avl_add(avl, box(608), box(886)); + avl = gpr_avl_add(avl, box(608), box(886), NULL); avl = remove_int(avl, 248); - avl = gpr_avl_add(avl, box(575), box(888)); + avl = gpr_avl_add(avl, box(575), box(888), NULL); avl = remove_int(avl, 207); avl = remove_int(avl, 810); avl = remove_int(avl, 665); avl = remove_int(avl, 361); - avl = gpr_avl_add(avl, box(154), box(893)); - avl = gpr_avl_add(avl, box(329), box(894)); - avl = gpr_avl_add(avl, box(326), box(895)); + avl = gpr_avl_add(avl, box(154), box(893), NULL); + avl = gpr_avl_add(avl, box(329), box(894), NULL); + avl = gpr_avl_add(avl, box(326), box(895), NULL); avl = remove_int(avl, 746); avl = remove_int(avl, 99); - avl = gpr_avl_add(avl, box(464), box(898)); - avl = gpr_avl_add(avl, box(141), box(899)); + avl = gpr_avl_add(avl, box(464), box(898), NULL); + avl = gpr_avl_add(avl, box(141), box(899), NULL); avl = remove_int(avl, 383); - avl = gpr_avl_add(avl, box(414), box(901)); - avl = gpr_avl_add(avl, box(777), box(902)); + avl = gpr_avl_add(avl, box(414), box(901), NULL); + avl = gpr_avl_add(avl, box(777), box(902), NULL); avl = remove_int(avl, 972); avl = remove_int(avl, 841); avl = remove_int(avl, 100); - avl = gpr_avl_add(avl, box(828), box(906)); + avl = gpr_avl_add(avl, box(828), box(906), NULL); avl = remove_int(avl, 785); - avl = gpr_avl_add(avl, box(1008), box(908)); - avl = gpr_avl_add(avl, box(46), box(909)); + avl = gpr_avl_add(avl, box(1008), box(908), NULL); + avl = gpr_avl_add(avl, box(46), box(909), NULL); avl = remove_int(avl, 399); - avl = gpr_avl_add(avl, box(178), box(911)); - avl = gpr_avl_add(avl, box(573), box(912)); + avl = gpr_avl_add(avl, box(178), box(911), NULL); + avl = gpr_avl_add(avl, box(573), box(912), NULL); avl = remove_int(avl, 299); - avl = gpr_avl_add(avl, box(690), box(914)); - avl = gpr_avl_add(avl, box(692), box(915)); + avl = gpr_avl_add(avl, box(690), box(914), NULL); + avl = gpr_avl_add(avl, box(692), box(915), NULL); avl = remove_int(avl, 404); avl = remove_int(avl, 16); avl = remove_int(avl, 746); avl = remove_int(avl, 486); avl = remove_int(avl, 119); - avl = gpr_avl_add(avl, box(167), box(921)); + avl = gpr_avl_add(avl, box(167), box(921), NULL); avl = remove_int(avl, 328); - avl = gpr_avl_add(avl, box(89), box(923)); + avl = gpr_avl_add(avl, box(89), box(923), NULL); avl = remove_int(avl, 867); avl = remove_int(avl, 626); avl = remove_int(avl, 507); - avl = gpr_avl_add(avl, box(365), box(927)); - avl = gpr_avl_add(avl, box(58), box(928)); - avl = gpr_avl_add(avl, box(70), box(929)); + avl = gpr_avl_add(avl, box(365), box(927), NULL); + avl = gpr_avl_add(avl, box(58), box(928), NULL); + avl = gpr_avl_add(avl, box(70), box(929), NULL); avl = remove_int(avl, 81); avl = remove_int(avl, 797); - avl = gpr_avl_add(avl, box(846), box(932)); + avl = gpr_avl_add(avl, box(846), box(932), NULL); avl = remove_int(avl, 642); - avl = gpr_avl_add(avl, box(777), box(934)); + avl = gpr_avl_add(avl, box(777), box(934), NULL); avl = remove_int(avl, 107); - avl = gpr_avl_add(avl, box(691), box(936)); - avl = gpr_avl_add(avl, box(820), box(937)); - avl = gpr_avl_add(avl, box(202), box(938)); - avl = gpr_avl_add(avl, box(308), box(939)); - avl = gpr_avl_add(avl, box(20), box(940)); + avl = gpr_avl_add(avl, box(691), box(936), NULL); + avl = gpr_avl_add(avl, box(820), box(937), NULL); + avl = gpr_avl_add(avl, box(202), box(938), NULL); + avl = gpr_avl_add(avl, box(308), box(939), NULL); + avl = gpr_avl_add(avl, box(20), box(940), NULL); avl = remove_int(avl, 289); - avl = gpr_avl_add(avl, box(714), box(942)); - avl = gpr_avl_add(avl, box(584), box(943)); + avl = gpr_avl_add(avl, box(714), box(942), NULL); + avl = gpr_avl_add(avl, box(584), box(943), NULL); avl = remove_int(avl, 294); - avl = gpr_avl_add(avl, box(496), box(945)); - avl = gpr_avl_add(avl, box(394), box(946)); - avl = gpr_avl_add(avl, box(860), box(947)); - avl = gpr_avl_add(avl, box(58), box(948)); + avl = gpr_avl_add(avl, box(496), box(945), NULL); + avl = gpr_avl_add(avl, box(394), box(946), NULL); + avl = gpr_avl_add(avl, box(860), box(947), NULL); + avl = gpr_avl_add(avl, box(58), box(948), NULL); avl = remove_int(avl, 784); avl = remove_int(avl, 584); avl = remove_int(avl, 708); - avl = gpr_avl_add(avl, box(142), box(952)); - avl = gpr_avl_add(avl, box(247), box(953)); - avl = gpr_avl_add(avl, box(389), box(954)); + avl = gpr_avl_add(avl, box(142), box(952), NULL); + avl = gpr_avl_add(avl, box(247), box(953), NULL); + avl = gpr_avl_add(avl, box(389), box(954), NULL); avl = remove_int(avl, 390); - avl = gpr_avl_add(avl, box(465), box(956)); - avl = gpr_avl_add(avl, box(936), box(957)); - avl = gpr_avl_add(avl, box(309), box(958)); + avl = gpr_avl_add(avl, box(465), box(956), NULL); + avl = gpr_avl_add(avl, box(936), box(957), NULL); + avl = gpr_avl_add(avl, box(309), box(958), NULL); avl = remove_int(avl, 928); avl = remove_int(avl, 128); avl = remove_int(avl, 979); @@ -2102,15 +2104,15 @@ static void test_badcase3(void) { avl = remove_int(avl, 738); avl = remove_int(avl, 271); avl = remove_int(avl, 540); - avl = gpr_avl_add(avl, box(365), box(966)); + avl = gpr_avl_add(avl, box(365), box(966), NULL); avl = remove_int(avl, 82); - avl = gpr_avl_add(avl, box(728), box(968)); + avl = gpr_avl_add(avl, box(728), box(968), NULL); avl = remove_int(avl, 852); - avl = gpr_avl_add(avl, box(884), box(970)); - avl = gpr_avl_add(avl, box(502), box(971)); + avl = gpr_avl_add(avl, box(884), box(970), NULL); + avl = gpr_avl_add(avl, box(502), box(971), NULL); avl = remove_int(avl, 898); avl = remove_int(avl, 481); - avl = gpr_avl_add(avl, box(911), box(974)); + avl = gpr_avl_add(avl, box(911), box(974), NULL); avl = remove_int(avl, 787); avl = remove_int(avl, 785); avl = remove_int(avl, 537); @@ -2119,125 +2121,125 @@ static void test_badcase3(void) { avl = remove_int(avl, 749); avl = remove_int(avl, 637); avl = remove_int(avl, 900); - avl = gpr_avl_add(avl, box(598), box(983)); + avl = gpr_avl_add(avl, box(598), box(983), NULL); avl = remove_int(avl, 25); avl = remove_int(avl, 697); - avl = gpr_avl_add(avl, box(645), box(986)); - avl = gpr_avl_add(avl, box(211), box(987)); - avl = gpr_avl_add(avl, box(589), box(988)); + avl = gpr_avl_add(avl, box(645), box(986), NULL); + avl = gpr_avl_add(avl, box(211), box(987), NULL); + avl = gpr_avl_add(avl, box(589), box(988), NULL); avl = remove_int(avl, 702); - avl = gpr_avl_add(avl, box(53), box(990)); + avl = gpr_avl_add(avl, box(53), box(990), NULL); avl = remove_int(avl, 492); avl = remove_int(avl, 185); avl = remove_int(avl, 246); avl = remove_int(avl, 257); avl = remove_int(avl, 502); avl = remove_int(avl, 34); - avl = gpr_avl_add(avl, box(74), box(997)); - avl = gpr_avl_add(avl, box(834), box(998)); - avl = gpr_avl_add(avl, box(514), box(999)); - avl = gpr_avl_add(avl, box(75), box(1000)); + avl = gpr_avl_add(avl, box(74), box(997), NULL); + avl = gpr_avl_add(avl, box(834), box(998), NULL); + avl = gpr_avl_add(avl, box(514), box(999), NULL); + avl = gpr_avl_add(avl, box(75), box(1000), NULL); avl = remove_int(avl, 745); - avl = gpr_avl_add(avl, box(362), box(1002)); + avl = gpr_avl_add(avl, box(362), box(1002), NULL); avl = remove_int(avl, 215); - avl = gpr_avl_add(avl, box(624), box(1004)); + avl = gpr_avl_add(avl, box(624), box(1004), NULL); avl = remove_int(avl, 404); avl = remove_int(avl, 359); avl = remove_int(avl, 491); - avl = gpr_avl_add(avl, box(903), box(1008)); - avl = gpr_avl_add(avl, box(240), box(1009)); + avl = gpr_avl_add(avl, box(903), box(1008), NULL); + avl = gpr_avl_add(avl, box(240), box(1009), NULL); avl = remove_int(avl, 95); - avl = gpr_avl_add(avl, box(119), box(1011)); - avl = gpr_avl_add(avl, box(857), box(1012)); + avl = gpr_avl_add(avl, box(119), box(1011), NULL); + avl = gpr_avl_add(avl, box(857), box(1012), NULL); avl = remove_int(avl, 39); avl = remove_int(avl, 866); - avl = gpr_avl_add(avl, box(503), box(1015)); - avl = gpr_avl_add(avl, box(740), box(1016)); + avl = gpr_avl_add(avl, box(503), box(1015), NULL); + avl = gpr_avl_add(avl, box(740), box(1016), NULL); avl = remove_int(avl, 637); avl = remove_int(avl, 156); avl = remove_int(avl, 6); avl = remove_int(avl, 745); avl = remove_int(avl, 433); avl = remove_int(avl, 283); - avl = gpr_avl_add(avl, box(625), box(1023)); + avl = gpr_avl_add(avl, box(625), box(1023), NULL); avl = remove_int(avl, 638); - avl = gpr_avl_add(avl, box(299), box(1025)); - avl = gpr_avl_add(avl, box(584), box(1026)); + avl = gpr_avl_add(avl, box(299), box(1025), NULL); + avl = gpr_avl_add(avl, box(584), box(1026), NULL); avl = remove_int(avl, 863); - avl = gpr_avl_add(avl, box(612), box(1028)); - avl = gpr_avl_add(avl, box(62), box(1029)); - avl = gpr_avl_add(avl, box(432), box(1030)); + avl = gpr_avl_add(avl, box(612), box(1028), NULL); + avl = gpr_avl_add(avl, box(62), box(1029), NULL); + avl = gpr_avl_add(avl, box(432), box(1030), NULL); avl = remove_int(avl, 371); avl = remove_int(avl, 790); avl = remove_int(avl, 227); avl = remove_int(avl, 836); - avl = gpr_avl_add(avl, box(703), box(1035)); - avl = gpr_avl_add(avl, box(644), box(1036)); + avl = gpr_avl_add(avl, box(703), box(1035), NULL); + avl = gpr_avl_add(avl, box(644), box(1036), NULL); avl = remove_int(avl, 638); - avl = gpr_avl_add(avl, box(13), box(1038)); + avl = gpr_avl_add(avl, box(13), box(1038), NULL); avl = remove_int(avl, 66); avl = remove_int(avl, 82); - avl = gpr_avl_add(avl, box(362), box(1041)); - avl = gpr_avl_add(avl, box(783), box(1042)); + avl = gpr_avl_add(avl, box(362), box(1041), NULL); + avl = gpr_avl_add(avl, box(783), box(1042), NULL); avl = remove_int(avl, 60); - avl = gpr_avl_add(avl, box(80), box(1044)); - avl = gpr_avl_add(avl, box(825), box(1045)); - avl = gpr_avl_add(avl, box(688), box(1046)); - avl = gpr_avl_add(avl, box(662), box(1047)); + avl = gpr_avl_add(avl, box(80), box(1044), NULL); + avl = gpr_avl_add(avl, box(825), box(1045), NULL); + avl = gpr_avl_add(avl, box(688), box(1046), NULL); + avl = gpr_avl_add(avl, box(662), box(1047), NULL); avl = remove_int(avl, 156); avl = remove_int(avl, 376); avl = remove_int(avl, 99); - avl = gpr_avl_add(avl, box(526), box(1051)); - avl = gpr_avl_add(avl, box(168), box(1052)); + avl = gpr_avl_add(avl, box(526), box(1051), NULL); + avl = gpr_avl_add(avl, box(168), box(1052), NULL); avl = remove_int(avl, 646); avl = remove_int(avl, 380); avl = remove_int(avl, 833); - avl = gpr_avl_add(avl, box(53), box(1056)); + avl = gpr_avl_add(avl, box(53), box(1056), NULL); avl = remove_int(avl, 105); - avl = gpr_avl_add(avl, box(373), box(1058)); - avl = gpr_avl_add(avl, box(184), box(1059)); + avl = gpr_avl_add(avl, box(373), box(1058), NULL); + avl = gpr_avl_add(avl, box(184), box(1059), NULL); avl = remove_int(avl, 288); - avl = gpr_avl_add(avl, box(966), box(1061)); + avl = gpr_avl_add(avl, box(966), box(1061), NULL); avl = remove_int(avl, 158); - avl = gpr_avl_add(avl, box(406), box(1063)); + avl = gpr_avl_add(avl, box(406), box(1063), NULL); avl = remove_int(avl, 470); - avl = gpr_avl_add(avl, box(283), box(1065)); - avl = gpr_avl_add(avl, box(838), box(1066)); - avl = gpr_avl_add(avl, box(288), box(1067)); - avl = gpr_avl_add(avl, box(950), box(1068)); - avl = gpr_avl_add(avl, box(163), box(1069)); + avl = gpr_avl_add(avl, box(283), box(1065), NULL); + avl = gpr_avl_add(avl, box(838), box(1066), NULL); + avl = gpr_avl_add(avl, box(288), box(1067), NULL); + avl = gpr_avl_add(avl, box(950), box(1068), NULL); + avl = gpr_avl_add(avl, box(163), box(1069), NULL); avl = remove_int(avl, 623); avl = remove_int(avl, 769); - avl = gpr_avl_add(avl, box(144), box(1072)); - avl = gpr_avl_add(avl, box(489), box(1073)); + avl = gpr_avl_add(avl, box(144), box(1072), NULL); + avl = gpr_avl_add(avl, box(489), box(1073), NULL); avl = remove_int(avl, 15); - avl = gpr_avl_add(avl, box(971), box(1075)); + avl = gpr_avl_add(avl, box(971), box(1075), NULL); avl = remove_int(avl, 660); - avl = gpr_avl_add(avl, box(255), box(1077)); + avl = gpr_avl_add(avl, box(255), box(1077), NULL); avl = remove_int(avl, 494); - avl = gpr_avl_add(avl, box(109), box(1079)); - avl = gpr_avl_add(avl, box(420), box(1080)); - avl = gpr_avl_add(avl, box(509), box(1081)); + avl = gpr_avl_add(avl, box(109), box(1079), NULL); + avl = gpr_avl_add(avl, box(420), box(1080), NULL); + avl = gpr_avl_add(avl, box(509), box(1081), NULL); avl = remove_int(avl, 178); - avl = gpr_avl_add(avl, box(216), box(1083)); - avl = gpr_avl_add(avl, box(707), box(1084)); - avl = gpr_avl_add(avl, box(411), box(1085)); - avl = gpr_avl_add(avl, box(352), box(1086)); + avl = gpr_avl_add(avl, box(216), box(1083), NULL); + avl = gpr_avl_add(avl, box(707), box(1084), NULL); + avl = gpr_avl_add(avl, box(411), box(1085), NULL); + avl = gpr_avl_add(avl, box(352), box(1086), NULL); avl = remove_int(avl, 983); - avl = gpr_avl_add(avl, box(6), box(1088)); - avl = gpr_avl_add(avl, box(1014), box(1089)); + avl = gpr_avl_add(avl, box(6), box(1088), NULL); + avl = gpr_avl_add(avl, box(1014), box(1089), NULL); avl = remove_int(avl, 98); avl = remove_int(avl, 325); - avl = gpr_avl_add(avl, box(851), box(1092)); + avl = gpr_avl_add(avl, box(851), box(1092), NULL); avl = remove_int(avl, 553); - avl = gpr_avl_add(avl, box(218), box(1094)); - avl = gpr_avl_add(avl, box(261), box(1095)); + avl = gpr_avl_add(avl, box(218), box(1094), NULL); + avl = gpr_avl_add(avl, box(261), box(1095), NULL); avl = remove_int(avl, 31); - avl = gpr_avl_add(avl, box(872), box(1097)); + avl = gpr_avl_add(avl, box(872), box(1097), NULL); avl = remove_int(avl, 543); avl = remove_int(avl, 314); avl = remove_int(avl, 443); - avl = gpr_avl_add(avl, box(533), box(1101)); + avl = gpr_avl_add(avl, box(533), box(1101), NULL); avl = remove_int(avl, 881); avl = remove_int(avl, 269); avl = remove_int(avl, 940); @@ -2246,114 +2248,114 @@ static void test_badcase3(void) { avl = remove_int(avl, 773); avl = remove_int(avl, 790); avl = remove_int(avl, 345); - avl = gpr_avl_add(avl, box(965), box(1110)); + avl = gpr_avl_add(avl, box(965), box(1110), NULL); avl = remove_int(avl, 622); - avl = gpr_avl_add(avl, box(352), box(1112)); + avl = gpr_avl_add(avl, box(352), box(1112), NULL); avl = remove_int(avl, 182); - avl = gpr_avl_add(avl, box(534), box(1114)); - avl = gpr_avl_add(avl, box(97), box(1115)); - avl = gpr_avl_add(avl, box(198), box(1116)); + avl = gpr_avl_add(avl, box(534), box(1114), NULL); + avl = gpr_avl_add(avl, box(97), box(1115), NULL); + avl = gpr_avl_add(avl, box(198), box(1116), NULL); avl = remove_int(avl, 750); - avl = gpr_avl_add(avl, box(98), box(1118)); + avl = gpr_avl_add(avl, box(98), box(1118), NULL); avl = remove_int(avl, 943); - avl = gpr_avl_add(avl, box(254), box(1120)); - avl = gpr_avl_add(avl, box(30), box(1121)); + avl = gpr_avl_add(avl, box(254), box(1120), NULL); + avl = gpr_avl_add(avl, box(30), box(1121), NULL); avl = remove_int(avl, 14); avl = remove_int(avl, 475); avl = remove_int(avl, 82); - avl = gpr_avl_add(avl, box(789), box(1125)); - avl = gpr_avl_add(avl, box(402), box(1126)); + avl = gpr_avl_add(avl, box(789), box(1125), NULL); + avl = gpr_avl_add(avl, box(402), box(1126), NULL); avl = remove_int(avl, 1019); - avl = gpr_avl_add(avl, box(858), box(1128)); - avl = gpr_avl_add(avl, box(625), box(1129)); + avl = gpr_avl_add(avl, box(858), box(1128), NULL); + avl = gpr_avl_add(avl, box(625), box(1129), NULL); avl = remove_int(avl, 675); avl = remove_int(avl, 323); - avl = gpr_avl_add(avl, box(329), box(1132)); + avl = gpr_avl_add(avl, box(329), box(1132), NULL); avl = remove_int(avl, 929); avl = remove_int(avl, 44); - avl = gpr_avl_add(avl, box(443), box(1135)); - avl = gpr_avl_add(avl, box(653), box(1136)); - avl = gpr_avl_add(avl, box(750), box(1137)); - avl = gpr_avl_add(avl, box(252), box(1138)); - avl = gpr_avl_add(avl, box(449), box(1139)); + avl = gpr_avl_add(avl, box(443), box(1135), NULL); + avl = gpr_avl_add(avl, box(653), box(1136), NULL); + avl = gpr_avl_add(avl, box(750), box(1137), NULL); + avl = gpr_avl_add(avl, box(252), box(1138), NULL); + avl = gpr_avl_add(avl, box(449), box(1139), NULL); avl = remove_int(avl, 1022); avl = remove_int(avl, 357); avl = remove_int(avl, 602); avl = remove_int(avl, 131); - avl = gpr_avl_add(avl, box(531), box(1144)); + avl = gpr_avl_add(avl, box(531), box(1144), NULL); avl = remove_int(avl, 806); - avl = gpr_avl_add(avl, box(455), box(1146)); + avl = gpr_avl_add(avl, box(455), box(1146), NULL); avl = remove_int(avl, 31); - avl = gpr_avl_add(avl, box(154), box(1148)); - avl = gpr_avl_add(avl, box(189), box(1149)); + avl = gpr_avl_add(avl, box(154), box(1148), NULL); + avl = gpr_avl_add(avl, box(189), box(1149), NULL); avl = remove_int(avl, 786); - avl = gpr_avl_add(avl, box(496), box(1151)); - avl = gpr_avl_add(avl, box(81), box(1152)); - avl = gpr_avl_add(avl, box(59), box(1153)); + avl = gpr_avl_add(avl, box(496), box(1151), NULL); + avl = gpr_avl_add(avl, box(81), box(1152), NULL); + avl = gpr_avl_add(avl, box(59), box(1153), NULL); avl = remove_int(avl, 424); avl = remove_int(avl, 668); - avl = gpr_avl_add(avl, box(723), box(1156)); - avl = gpr_avl_add(avl, box(822), box(1157)); - avl = gpr_avl_add(avl, box(354), box(1158)); + avl = gpr_avl_add(avl, box(723), box(1156), NULL); + avl = gpr_avl_add(avl, box(822), box(1157), NULL); + avl = gpr_avl_add(avl, box(354), box(1158), NULL); avl = remove_int(avl, 738); - avl = gpr_avl_add(avl, box(686), box(1160)); - avl = gpr_avl_add(avl, box(43), box(1161)); - avl = gpr_avl_add(avl, box(625), box(1162)); - avl = gpr_avl_add(avl, box(902), box(1163)); - avl = gpr_avl_add(avl, box(12), box(1164)); - avl = gpr_avl_add(avl, box(977), box(1165)); - avl = gpr_avl_add(avl, box(699), box(1166)); - avl = gpr_avl_add(avl, box(189), box(1167)); + avl = gpr_avl_add(avl, box(686), box(1160), NULL); + avl = gpr_avl_add(avl, box(43), box(1161), NULL); + avl = gpr_avl_add(avl, box(625), box(1162), NULL); + avl = gpr_avl_add(avl, box(902), box(1163), NULL); + avl = gpr_avl_add(avl, box(12), box(1164), NULL); + avl = gpr_avl_add(avl, box(977), box(1165), NULL); + avl = gpr_avl_add(avl, box(699), box(1166), NULL); + avl = gpr_avl_add(avl, box(189), box(1167), NULL); avl = remove_int(avl, 672); avl = remove_int(avl, 90); avl = remove_int(avl, 757); avl = remove_int(avl, 494); - avl = gpr_avl_add(avl, box(759), box(1172)); + avl = gpr_avl_add(avl, box(759), box(1172), NULL); avl = remove_int(avl, 758); avl = remove_int(avl, 222); - avl = gpr_avl_add(avl, box(975), box(1175)); + avl = gpr_avl_add(avl, box(975), box(1175), NULL); avl = remove_int(avl, 993); - avl = gpr_avl_add(avl, box(2), box(1177)); - avl = gpr_avl_add(avl, box(70), box(1178)); + avl = gpr_avl_add(avl, box(2), box(1177), NULL); + avl = gpr_avl_add(avl, box(70), box(1178), NULL); avl = remove_int(avl, 350); avl = remove_int(avl, 972); avl = remove_int(avl, 880); - avl = gpr_avl_add(avl, box(753), box(1182)); + avl = gpr_avl_add(avl, box(753), box(1182), NULL); avl = remove_int(avl, 404); - avl = gpr_avl_add(avl, box(294), box(1184)); + avl = gpr_avl_add(avl, box(294), box(1184), NULL); avl = remove_int(avl, 474); - avl = gpr_avl_add(avl, box(228), box(1186)); - avl = gpr_avl_add(avl, box(484), box(1187)); + avl = gpr_avl_add(avl, box(228), box(1186), NULL); + avl = gpr_avl_add(avl, box(484), box(1187), NULL); avl = remove_int(avl, 238); avl = remove_int(avl, 53); avl = remove_int(avl, 691); - avl = gpr_avl_add(avl, box(345), box(1191)); + avl = gpr_avl_add(avl, box(345), box(1191), NULL); avl = remove_int(avl, 0); - avl = gpr_avl_add(avl, box(230), box(1193)); + avl = gpr_avl_add(avl, box(230), box(1193), NULL); avl = remove_int(avl, 227); avl = remove_int(avl, 152); - avl = gpr_avl_add(avl, box(884), box(1196)); + avl = gpr_avl_add(avl, box(884), box(1196), NULL); avl = remove_int(avl, 823); avl = remove_int(avl, 53); - avl = gpr_avl_add(avl, box(1015), box(1199)); - avl = gpr_avl_add(avl, box(697), box(1200)); - avl = gpr_avl_add(avl, box(376), box(1201)); + avl = gpr_avl_add(avl, box(1015), box(1199), NULL); + avl = gpr_avl_add(avl, box(697), box(1200), NULL); + avl = gpr_avl_add(avl, box(376), box(1201), NULL); avl = remove_int(avl, 411); - avl = gpr_avl_add(avl, box(888), box(1203)); + avl = gpr_avl_add(avl, box(888), box(1203), NULL); avl = remove_int(avl, 55); - avl = gpr_avl_add(avl, box(85), box(1205)); + avl = gpr_avl_add(avl, box(85), box(1205), NULL); avl = remove_int(avl, 947); avl = remove_int(avl, 382); avl = remove_int(avl, 777); - avl = gpr_avl_add(avl, box(1017), box(1209)); - avl = gpr_avl_add(avl, box(169), box(1210)); - avl = gpr_avl_add(avl, box(156), box(1211)); + avl = gpr_avl_add(avl, box(1017), box(1209), NULL); + avl = gpr_avl_add(avl, box(169), box(1210), NULL); + avl = gpr_avl_add(avl, box(156), box(1211), NULL); avl = remove_int(avl, 153); avl = remove_int(avl, 642); avl = remove_int(avl, 158); - avl = gpr_avl_add(avl, box(554), box(1215)); - avl = gpr_avl_add(avl, box(76), box(1216)); - avl = gpr_avl_add(avl, box(756), box(1217)); + avl = gpr_avl_add(avl, box(554), box(1215), NULL); + avl = gpr_avl_add(avl, box(76), box(1216), NULL); + avl = gpr_avl_add(avl, box(756), box(1217), NULL); avl = remove_int(avl, 767); avl = remove_int(avl, 112); avl = remove_int(avl, 539); @@ -2362,37 +2364,37 @@ static void test_badcase3(void) { avl = remove_int(avl, 385); avl = remove_int(avl, 514); avl = remove_int(avl, 362); - avl = gpr_avl_add(avl, box(523), box(1226)); - avl = gpr_avl_add(avl, box(712), box(1227)); - avl = gpr_avl_add(avl, box(474), box(1228)); - avl = gpr_avl_add(avl, box(882), box(1229)); - avl = gpr_avl_add(avl, box(965), box(1230)); + avl = gpr_avl_add(avl, box(523), box(1226), NULL); + avl = gpr_avl_add(avl, box(712), box(1227), NULL); + avl = gpr_avl_add(avl, box(474), box(1228), NULL); + avl = gpr_avl_add(avl, box(882), box(1229), NULL); + avl = gpr_avl_add(avl, box(965), box(1230), NULL); avl = remove_int(avl, 464); - avl = gpr_avl_add(avl, box(319), box(1232)); - avl = gpr_avl_add(avl, box(504), box(1233)); + avl = gpr_avl_add(avl, box(319), box(1232), NULL); + avl = gpr_avl_add(avl, box(504), box(1233), NULL); avl = remove_int(avl, 818); - avl = gpr_avl_add(avl, box(884), box(1235)); - avl = gpr_avl_add(avl, box(813), box(1236)); - avl = gpr_avl_add(avl, box(795), box(1237)); + avl = gpr_avl_add(avl, box(884), box(1235), NULL); + avl = gpr_avl_add(avl, box(813), box(1236), NULL); + avl = gpr_avl_add(avl, box(795), box(1237), NULL); avl = remove_int(avl, 306); - avl = gpr_avl_add(avl, box(799), box(1239)); + avl = gpr_avl_add(avl, box(799), box(1239), NULL); avl = remove_int(avl, 534); - avl = gpr_avl_add(avl, box(480), box(1241)); - avl = gpr_avl_add(avl, box(656), box(1242)); - avl = gpr_avl_add(avl, box(709), box(1243)); - avl = gpr_avl_add(avl, box(500), box(1244)); + avl = gpr_avl_add(avl, box(480), box(1241), NULL); + avl = gpr_avl_add(avl, box(656), box(1242), NULL); + avl = gpr_avl_add(avl, box(709), box(1243), NULL); + avl = gpr_avl_add(avl, box(500), box(1244), NULL); avl = remove_int(avl, 740); - avl = gpr_avl_add(avl, box(980), box(1246)); - avl = gpr_avl_add(avl, box(458), box(1247)); + avl = gpr_avl_add(avl, box(980), box(1246), NULL); + avl = gpr_avl_add(avl, box(458), box(1247), NULL); avl = remove_int(avl, 377); avl = remove_int(avl, 338); - avl = gpr_avl_add(avl, box(554), box(1250)); - avl = gpr_avl_add(avl, box(504), box(1251)); - avl = gpr_avl_add(avl, box(603), box(1252)); - avl = gpr_avl_add(avl, box(761), box(1253)); + avl = gpr_avl_add(avl, box(554), box(1250), NULL); + avl = gpr_avl_add(avl, box(504), box(1251), NULL); + avl = gpr_avl_add(avl, box(603), box(1252), NULL); + avl = gpr_avl_add(avl, box(761), box(1253), NULL); avl = remove_int(avl, 431); - avl = gpr_avl_add(avl, box(707), box(1255)); - avl = gpr_avl_add(avl, box(673), box(1256)); + avl = gpr_avl_add(avl, box(707), box(1255), NULL); + avl = gpr_avl_add(avl, box(673), box(1256), NULL); avl = remove_int(avl, 998); avl = remove_int(avl, 332); avl = remove_int(avl, 413); @@ -2400,448 +2402,448 @@ static void test_badcase3(void) { avl = remove_int(avl, 249); avl = remove_int(avl, 309); avl = remove_int(avl, 459); - avl = gpr_avl_add(avl, box(645), box(1264)); + avl = gpr_avl_add(avl, box(645), box(1264), NULL); avl = remove_int(avl, 858); avl = remove_int(avl, 997); - avl = gpr_avl_add(avl, box(519), box(1267)); + avl = gpr_avl_add(avl, box(519), box(1267), NULL); avl = remove_int(avl, 614); avl = remove_int(avl, 462); avl = remove_int(avl, 792); - avl = gpr_avl_add(avl, box(987), box(1271)); - avl = gpr_avl_add(avl, box(309), box(1272)); + avl = gpr_avl_add(avl, box(987), box(1271), NULL); + avl = gpr_avl_add(avl, box(309), box(1272), NULL); avl = remove_int(avl, 747); - avl = gpr_avl_add(avl, box(621), box(1274)); - avl = gpr_avl_add(avl, box(450), box(1275)); + avl = gpr_avl_add(avl, box(621), box(1274), NULL); + avl = gpr_avl_add(avl, box(450), box(1275), NULL); avl = remove_int(avl, 265); avl = remove_int(avl, 8); avl = remove_int(avl, 383); - avl = gpr_avl_add(avl, box(238), box(1279)); + avl = gpr_avl_add(avl, box(238), box(1279), NULL); avl = remove_int(avl, 241); - avl = gpr_avl_add(avl, box(180), box(1281)); - avl = gpr_avl_add(avl, box(411), box(1282)); - avl = gpr_avl_add(avl, box(791), box(1283)); - avl = gpr_avl_add(avl, box(955), box(1284)); + avl = gpr_avl_add(avl, box(180), box(1281), NULL); + avl = gpr_avl_add(avl, box(411), box(1282), NULL); + avl = gpr_avl_add(avl, box(791), box(1283), NULL); + avl = gpr_avl_add(avl, box(955), box(1284), NULL); avl = remove_int(avl, 24); avl = remove_int(avl, 375); - avl = gpr_avl_add(avl, box(140), box(1287)); + avl = gpr_avl_add(avl, box(140), box(1287), NULL); avl = remove_int(avl, 949); - avl = gpr_avl_add(avl, box(301), box(1289)); - avl = gpr_avl_add(avl, box(0), box(1290)); + avl = gpr_avl_add(avl, box(301), box(1289), NULL); + avl = gpr_avl_add(avl, box(0), box(1290), NULL); avl = remove_int(avl, 371); avl = remove_int(avl, 427); avl = remove_int(avl, 841); avl = remove_int(avl, 847); - avl = gpr_avl_add(avl, box(814), box(1295)); - avl = gpr_avl_add(avl, box(127), box(1296)); - avl = gpr_avl_add(avl, box(279), box(1297)); + avl = gpr_avl_add(avl, box(814), box(1295), NULL); + avl = gpr_avl_add(avl, box(127), box(1296), NULL); + avl = gpr_avl_add(avl, box(279), box(1297), NULL); avl = remove_int(avl, 669); avl = remove_int(avl, 541); avl = remove_int(avl, 275); avl = remove_int(avl, 299); avl = remove_int(avl, 552); - avl = gpr_avl_add(avl, box(310), box(1303)); - avl = gpr_avl_add(avl, box(304), box(1304)); - avl = gpr_avl_add(avl, box(1), box(1305)); - avl = gpr_avl_add(avl, box(339), box(1306)); + avl = gpr_avl_add(avl, box(310), box(1303), NULL); + avl = gpr_avl_add(avl, box(304), box(1304), NULL); + avl = gpr_avl_add(avl, box(1), box(1305), NULL); + avl = gpr_avl_add(avl, box(339), box(1306), NULL); avl = remove_int(avl, 570); avl = remove_int(avl, 752); avl = remove_int(avl, 552); avl = remove_int(avl, 442); avl = remove_int(avl, 639); - avl = gpr_avl_add(avl, box(313), box(1312)); + avl = gpr_avl_add(avl, box(313), box(1312), NULL); avl = remove_int(avl, 85); - avl = gpr_avl_add(avl, box(964), box(1314)); - avl = gpr_avl_add(avl, box(559), box(1315)); + avl = gpr_avl_add(avl, box(964), box(1314), NULL); + avl = gpr_avl_add(avl, box(559), box(1315), NULL); avl = remove_int(avl, 167); - avl = gpr_avl_add(avl, box(866), box(1317)); + avl = gpr_avl_add(avl, box(866), box(1317), NULL); avl = remove_int(avl, 275); - avl = gpr_avl_add(avl, box(173), box(1319)); - avl = gpr_avl_add(avl, box(765), box(1320)); + avl = gpr_avl_add(avl, box(173), box(1319), NULL); + avl = gpr_avl_add(avl, box(765), box(1320), NULL); avl = remove_int(avl, 883); - avl = gpr_avl_add(avl, box(547), box(1322)); - avl = gpr_avl_add(avl, box(847), box(1323)); + avl = gpr_avl_add(avl, box(547), box(1322), NULL); + avl = gpr_avl_add(avl, box(847), box(1323), NULL); avl = remove_int(avl, 817); avl = remove_int(avl, 850); avl = remove_int(avl, 718); - avl = gpr_avl_add(avl, box(806), box(1327)); - avl = gpr_avl_add(avl, box(360), box(1328)); + avl = gpr_avl_add(avl, box(806), box(1327), NULL); + avl = gpr_avl_add(avl, box(360), box(1328), NULL); avl = remove_int(avl, 991); - avl = gpr_avl_add(avl, box(493), box(1330)); + avl = gpr_avl_add(avl, box(493), box(1330), NULL); avl = remove_int(avl, 516); - avl = gpr_avl_add(avl, box(361), box(1332)); + avl = gpr_avl_add(avl, box(361), box(1332), NULL); avl = remove_int(avl, 355); - avl = gpr_avl_add(avl, box(512), box(1334)); - avl = gpr_avl_add(avl, box(191), box(1335)); + avl = gpr_avl_add(avl, box(512), box(1334), NULL); + avl = gpr_avl_add(avl, box(191), box(1335), NULL); avl = remove_int(avl, 703); - avl = gpr_avl_add(avl, box(333), box(1337)); + avl = gpr_avl_add(avl, box(333), box(1337), NULL); avl = remove_int(avl, 481); - avl = gpr_avl_add(avl, box(501), box(1339)); + avl = gpr_avl_add(avl, box(501), box(1339), NULL); avl = remove_int(avl, 532); avl = remove_int(avl, 510); - avl = gpr_avl_add(avl, box(793), box(1342)); - avl = gpr_avl_add(avl, box(234), box(1343)); + avl = gpr_avl_add(avl, box(793), box(1342), NULL); + avl = gpr_avl_add(avl, box(234), box(1343), NULL); avl = remove_int(avl, 159); avl = remove_int(avl, 429); avl = remove_int(avl, 728); avl = remove_int(avl, 288); - avl = gpr_avl_add(avl, box(281), box(1348)); - avl = gpr_avl_add(avl, box(702), box(1349)); - avl = gpr_avl_add(avl, box(149), box(1350)); + avl = gpr_avl_add(avl, box(281), box(1348), NULL); + avl = gpr_avl_add(avl, box(702), box(1349), NULL); + avl = gpr_avl_add(avl, box(149), box(1350), NULL); avl = remove_int(avl, 22); avl = remove_int(avl, 944); avl = remove_int(avl, 55); avl = remove_int(avl, 512); avl = remove_int(avl, 676); avl = remove_int(avl, 884); - avl = gpr_avl_add(avl, box(246), box(1357)); - avl = gpr_avl_add(avl, box(455), box(1358)); + avl = gpr_avl_add(avl, box(246), box(1357), NULL); + avl = gpr_avl_add(avl, box(455), box(1358), NULL); avl = remove_int(avl, 782); avl = remove_int(avl, 682); - avl = gpr_avl_add(avl, box(243), box(1361)); - avl = gpr_avl_add(avl, box(109), box(1362)); - avl = gpr_avl_add(avl, box(452), box(1363)); + avl = gpr_avl_add(avl, box(243), box(1361), NULL); + avl = gpr_avl_add(avl, box(109), box(1362), NULL); + avl = gpr_avl_add(avl, box(452), box(1363), NULL); avl = remove_int(avl, 151); - avl = gpr_avl_add(avl, box(159), box(1365)); + avl = gpr_avl_add(avl, box(159), box(1365), NULL); avl = remove_int(avl, 1023); - avl = gpr_avl_add(avl, box(129), box(1367)); - avl = gpr_avl_add(avl, box(537), box(1368)); + avl = gpr_avl_add(avl, box(129), box(1367), NULL); + avl = gpr_avl_add(avl, box(537), box(1368), NULL); avl = remove_int(avl, 321); - avl = gpr_avl_add(avl, box(740), box(1370)); + avl = gpr_avl_add(avl, box(740), box(1370), NULL); avl = remove_int(avl, 45); avl = remove_int(avl, 136); - avl = gpr_avl_add(avl, box(229), box(1373)); + avl = gpr_avl_add(avl, box(229), box(1373), NULL); avl = remove_int(avl, 772); - avl = gpr_avl_add(avl, box(181), box(1375)); + avl = gpr_avl_add(avl, box(181), box(1375), NULL); avl = remove_int(avl, 175); - avl = gpr_avl_add(avl, box(817), box(1377)); + avl = gpr_avl_add(avl, box(817), box(1377), NULL); avl = remove_int(avl, 956); - avl = gpr_avl_add(avl, box(675), box(1379)); - avl = gpr_avl_add(avl, box(375), box(1380)); + avl = gpr_avl_add(avl, box(675), box(1379), NULL); + avl = gpr_avl_add(avl, box(375), box(1380), NULL); avl = remove_int(avl, 384); - avl = gpr_avl_add(avl, box(1016), box(1382)); + avl = gpr_avl_add(avl, box(1016), box(1382), NULL); avl = remove_int(avl, 295); avl = remove_int(avl, 697); avl = remove_int(avl, 554); avl = remove_int(avl, 590); avl = remove_int(avl, 1014); - avl = gpr_avl_add(avl, box(890), box(1388)); - avl = gpr_avl_add(avl, box(293), box(1389)); + avl = gpr_avl_add(avl, box(890), box(1388), NULL); + avl = gpr_avl_add(avl, box(293), box(1389), NULL); avl = remove_int(avl, 207); avl = remove_int(avl, 46); - avl = gpr_avl_add(avl, box(899), box(1392)); - avl = gpr_avl_add(avl, box(666), box(1393)); - avl = gpr_avl_add(avl, box(85), box(1394)); - avl = gpr_avl_add(avl, box(914), box(1395)); - avl = gpr_avl_add(avl, box(128), box(1396)); - avl = gpr_avl_add(avl, box(835), box(1397)); - avl = gpr_avl_add(avl, box(787), box(1398)); - avl = gpr_avl_add(avl, box(649), box(1399)); - avl = gpr_avl_add(avl, box(723), box(1400)); + avl = gpr_avl_add(avl, box(899), box(1392), NULL); + avl = gpr_avl_add(avl, box(666), box(1393), NULL); + avl = gpr_avl_add(avl, box(85), box(1394), NULL); + avl = gpr_avl_add(avl, box(914), box(1395), NULL); + avl = gpr_avl_add(avl, box(128), box(1396), NULL); + avl = gpr_avl_add(avl, box(835), box(1397), NULL); + avl = gpr_avl_add(avl, box(787), box(1398), NULL); + avl = gpr_avl_add(avl, box(649), box(1399), NULL); + avl = gpr_avl_add(avl, box(723), box(1400), NULL); avl = remove_int(avl, 874); - avl = gpr_avl_add(avl, box(778), box(1402)); - avl = gpr_avl_add(avl, box(1015), box(1403)); - avl = gpr_avl_add(avl, box(59), box(1404)); - avl = gpr_avl_add(avl, box(259), box(1405)); - avl = gpr_avl_add(avl, box(758), box(1406)); + avl = gpr_avl_add(avl, box(778), box(1402), NULL); + avl = gpr_avl_add(avl, box(1015), box(1403), NULL); + avl = gpr_avl_add(avl, box(59), box(1404), NULL); + avl = gpr_avl_add(avl, box(259), box(1405), NULL); + avl = gpr_avl_add(avl, box(758), box(1406), NULL); avl = remove_int(avl, 648); - avl = gpr_avl_add(avl, box(145), box(1408)); - avl = gpr_avl_add(avl, box(440), box(1409)); + avl = gpr_avl_add(avl, box(145), box(1408), NULL); + avl = gpr_avl_add(avl, box(440), box(1409), NULL); avl = remove_int(avl, 608); avl = remove_int(avl, 690); - avl = gpr_avl_add(avl, box(605), box(1412)); + avl = gpr_avl_add(avl, box(605), box(1412), NULL); avl = remove_int(avl, 856); avl = remove_int(avl, 608); - avl = gpr_avl_add(avl, box(829), box(1415)); - avl = gpr_avl_add(avl, box(660), box(1416)); + avl = gpr_avl_add(avl, box(829), box(1415), NULL); + avl = gpr_avl_add(avl, box(660), box(1416), NULL); avl = remove_int(avl, 596); - avl = gpr_avl_add(avl, box(519), box(1418)); - avl = gpr_avl_add(avl, box(35), box(1419)); - avl = gpr_avl_add(avl, box(871), box(1420)); + avl = gpr_avl_add(avl, box(519), box(1418), NULL); + avl = gpr_avl_add(avl, box(35), box(1419), NULL); + avl = gpr_avl_add(avl, box(871), box(1420), NULL); avl = remove_int(avl, 845); - avl = gpr_avl_add(avl, box(600), box(1422)); - avl = gpr_avl_add(avl, box(215), box(1423)); + avl = gpr_avl_add(avl, box(600), box(1422), NULL); + avl = gpr_avl_add(avl, box(215), box(1423), NULL); avl = remove_int(avl, 761); - avl = gpr_avl_add(avl, box(975), box(1425)); + avl = gpr_avl_add(avl, box(975), box(1425), NULL); avl = remove_int(avl, 987); - avl = gpr_avl_add(avl, box(58), box(1427)); + avl = gpr_avl_add(avl, box(58), box(1427), NULL); avl = remove_int(avl, 119); - avl = gpr_avl_add(avl, box(937), box(1429)); - avl = gpr_avl_add(avl, box(372), box(1430)); - avl = gpr_avl_add(avl, box(11), box(1431)); - avl = gpr_avl_add(avl, box(398), box(1432)); - avl = gpr_avl_add(avl, box(423), box(1433)); + avl = gpr_avl_add(avl, box(937), box(1429), NULL); + avl = gpr_avl_add(avl, box(372), box(1430), NULL); + avl = gpr_avl_add(avl, box(11), box(1431), NULL); + avl = gpr_avl_add(avl, box(398), box(1432), NULL); + avl = gpr_avl_add(avl, box(423), box(1433), NULL); avl = remove_int(avl, 171); - avl = gpr_avl_add(avl, box(473), box(1435)); + avl = gpr_avl_add(avl, box(473), box(1435), NULL); avl = remove_int(avl, 752); avl = remove_int(avl, 625); avl = remove_int(avl, 764); avl = remove_int(avl, 49); - avl = gpr_avl_add(avl, box(472), box(1440)); + avl = gpr_avl_add(avl, box(472), box(1440), NULL); avl = remove_int(avl, 847); avl = remove_int(avl, 642); avl = remove_int(avl, 1004); avl = remove_int(avl, 795); avl = remove_int(avl, 465); - avl = gpr_avl_add(avl, box(636), box(1446)); + avl = gpr_avl_add(avl, box(636), box(1446), NULL); avl = remove_int(avl, 152); - avl = gpr_avl_add(avl, box(61), box(1448)); + avl = gpr_avl_add(avl, box(61), box(1448), NULL); avl = remove_int(avl, 929); avl = remove_int(avl, 9); - avl = gpr_avl_add(avl, box(251), box(1451)); - avl = gpr_avl_add(avl, box(672), box(1452)); - avl = gpr_avl_add(avl, box(66), box(1453)); + avl = gpr_avl_add(avl, box(251), box(1451), NULL); + avl = gpr_avl_add(avl, box(672), box(1452), NULL); + avl = gpr_avl_add(avl, box(66), box(1453), NULL); avl = remove_int(avl, 693); avl = remove_int(avl, 914); avl = remove_int(avl, 116); avl = remove_int(avl, 577); - avl = gpr_avl_add(avl, box(618), box(1458)); - avl = gpr_avl_add(avl, box(495), box(1459)); + avl = gpr_avl_add(avl, box(618), box(1458), NULL); + avl = gpr_avl_add(avl, box(495), box(1459), NULL); avl = remove_int(avl, 450); - avl = gpr_avl_add(avl, box(533), box(1461)); - avl = gpr_avl_add(avl, box(414), box(1462)); + avl = gpr_avl_add(avl, box(533), box(1461), NULL); + avl = gpr_avl_add(avl, box(414), box(1462), NULL); avl = remove_int(avl, 74); avl = remove_int(avl, 236); - avl = gpr_avl_add(avl, box(707), box(1465)); - avl = gpr_avl_add(avl, box(357), box(1466)); - avl = gpr_avl_add(avl, box(1007), box(1467)); - avl = gpr_avl_add(avl, box(811), box(1468)); - avl = gpr_avl_add(avl, box(418), box(1469)); - avl = gpr_avl_add(avl, box(164), box(1470)); - avl = gpr_avl_add(avl, box(622), box(1471)); + avl = gpr_avl_add(avl, box(707), box(1465), NULL); + avl = gpr_avl_add(avl, box(357), box(1466), NULL); + avl = gpr_avl_add(avl, box(1007), box(1467), NULL); + avl = gpr_avl_add(avl, box(811), box(1468), NULL); + avl = gpr_avl_add(avl, box(418), box(1469), NULL); + avl = gpr_avl_add(avl, box(164), box(1470), NULL); + avl = gpr_avl_add(avl, box(622), box(1471), NULL); avl = remove_int(avl, 22); avl = remove_int(avl, 14); avl = remove_int(avl, 732); avl = remove_int(avl, 7); avl = remove_int(avl, 447); - avl = gpr_avl_add(avl, box(221), box(1477)); - avl = gpr_avl_add(avl, box(202), box(1478)); - avl = gpr_avl_add(avl, box(312), box(1479)); + avl = gpr_avl_add(avl, box(221), box(1477), NULL); + avl = gpr_avl_add(avl, box(202), box(1478), NULL); + avl = gpr_avl_add(avl, box(312), box(1479), NULL); avl = remove_int(avl, 274); - avl = gpr_avl_add(avl, box(684), box(1481)); - avl = gpr_avl_add(avl, box(954), box(1482)); - avl = gpr_avl_add(avl, box(637), box(1483)); + avl = gpr_avl_add(avl, box(684), box(1481), NULL); + avl = gpr_avl_add(avl, box(954), box(1482), NULL); + avl = gpr_avl_add(avl, box(637), box(1483), NULL); avl = remove_int(avl, 716); - avl = gpr_avl_add(avl, box(198), box(1485)); + avl = gpr_avl_add(avl, box(198), box(1485), NULL); avl = remove_int(avl, 340); avl = remove_int(avl, 137); avl = remove_int(avl, 995); avl = remove_int(avl, 1004); - avl = gpr_avl_add(avl, box(661), box(1490)); - avl = gpr_avl_add(avl, box(862), box(1491)); + avl = gpr_avl_add(avl, box(661), box(1490), NULL); + avl = gpr_avl_add(avl, box(862), box(1491), NULL); avl = remove_int(avl, 527); - avl = gpr_avl_add(avl, box(945), box(1493)); + avl = gpr_avl_add(avl, box(945), box(1493), NULL); avl = remove_int(avl, 355); avl = remove_int(avl, 144); - avl = gpr_avl_add(avl, box(229), box(1496)); - avl = gpr_avl_add(avl, box(237), box(1497)); + avl = gpr_avl_add(avl, box(229), box(1496), NULL); + avl = gpr_avl_add(avl, box(237), box(1497), NULL); avl = remove_int(avl, 471); avl = remove_int(avl, 901); - avl = gpr_avl_add(avl, box(905), box(1500)); + avl = gpr_avl_add(avl, box(905), box(1500), NULL); avl = remove_int(avl, 19); avl = remove_int(avl, 896); avl = remove_int(avl, 585); avl = remove_int(avl, 308); - avl = gpr_avl_add(avl, box(547), box(1505)); - avl = gpr_avl_add(avl, box(552), box(1506)); - avl = gpr_avl_add(avl, box(30), box(1507)); - avl = gpr_avl_add(avl, box(445), box(1508)); + avl = gpr_avl_add(avl, box(547), box(1505), NULL); + avl = gpr_avl_add(avl, box(552), box(1506), NULL); + avl = gpr_avl_add(avl, box(30), box(1507), NULL); + avl = gpr_avl_add(avl, box(445), box(1508), NULL); avl = remove_int(avl, 785); avl = remove_int(avl, 185); - avl = gpr_avl_add(avl, box(405), box(1511)); - avl = gpr_avl_add(avl, box(733), box(1512)); - avl = gpr_avl_add(avl, box(573), box(1513)); - avl = gpr_avl_add(avl, box(492), box(1514)); - avl = gpr_avl_add(avl, box(343), box(1515)); - avl = gpr_avl_add(avl, box(527), box(1516)); - avl = gpr_avl_add(avl, box(596), box(1517)); - avl = gpr_avl_add(avl, box(519), box(1518)); + avl = gpr_avl_add(avl, box(405), box(1511), NULL); + avl = gpr_avl_add(avl, box(733), box(1512), NULL); + avl = gpr_avl_add(avl, box(573), box(1513), NULL); + avl = gpr_avl_add(avl, box(492), box(1514), NULL); + avl = gpr_avl_add(avl, box(343), box(1515), NULL); + avl = gpr_avl_add(avl, box(527), box(1516), NULL); + avl = gpr_avl_add(avl, box(596), box(1517), NULL); + avl = gpr_avl_add(avl, box(519), box(1518), NULL); avl = remove_int(avl, 243); avl = remove_int(avl, 722); - avl = gpr_avl_add(avl, box(772), box(1521)); + avl = gpr_avl_add(avl, box(772), box(1521), NULL); avl = remove_int(avl, 152); avl = remove_int(avl, 305); - avl = gpr_avl_add(avl, box(754), box(1524)); - avl = gpr_avl_add(avl, box(373), box(1525)); + avl = gpr_avl_add(avl, box(754), box(1524), NULL); + avl = gpr_avl_add(avl, box(373), box(1525), NULL); avl = remove_int(avl, 995); - avl = gpr_avl_add(avl, box(329), box(1527)); + avl = gpr_avl_add(avl, box(329), box(1527), NULL); avl = remove_int(avl, 397); - avl = gpr_avl_add(avl, box(884), box(1529)); + avl = gpr_avl_add(avl, box(884), box(1529), NULL); avl = remove_int(avl, 329); avl = remove_int(avl, 240); - avl = gpr_avl_add(avl, box(566), box(1532)); - avl = gpr_avl_add(avl, box(232), box(1533)); + avl = gpr_avl_add(avl, box(566), box(1532), NULL); + avl = gpr_avl_add(avl, box(232), box(1533), NULL); avl = remove_int(avl, 993); - avl = gpr_avl_add(avl, box(888), box(1535)); + avl = gpr_avl_add(avl, box(888), box(1535), NULL); avl = remove_int(avl, 242); - avl = gpr_avl_add(avl, box(941), box(1537)); + avl = gpr_avl_add(avl, box(941), box(1537), NULL); avl = remove_int(avl, 415); - avl = gpr_avl_add(avl, box(992), box(1539)); + avl = gpr_avl_add(avl, box(992), box(1539), NULL); avl = remove_int(avl, 289); - avl = gpr_avl_add(avl, box(60), box(1541)); - avl = gpr_avl_add(avl, box(97), box(1542)); + avl = gpr_avl_add(avl, box(60), box(1541), NULL); + avl = gpr_avl_add(avl, box(97), box(1542), NULL); avl = remove_int(avl, 965); avl = remove_int(avl, 267); avl = remove_int(avl, 360); - avl = gpr_avl_add(avl, box(5), box(1546)); + avl = gpr_avl_add(avl, box(5), box(1546), NULL); avl = remove_int(avl, 429); - avl = gpr_avl_add(avl, box(412), box(1548)); + avl = gpr_avl_add(avl, box(412), box(1548), NULL); avl = remove_int(avl, 632); avl = remove_int(avl, 113); - avl = gpr_avl_add(avl, box(48), box(1551)); - avl = gpr_avl_add(avl, box(108), box(1552)); - avl = gpr_avl_add(avl, box(750), box(1553)); + avl = gpr_avl_add(avl, box(48), box(1551), NULL); + avl = gpr_avl_add(avl, box(108), box(1552), NULL); + avl = gpr_avl_add(avl, box(750), box(1553), NULL); avl = remove_int(avl, 188); - avl = gpr_avl_add(avl, box(668), box(1555)); + avl = gpr_avl_add(avl, box(668), box(1555), NULL); avl = remove_int(avl, 37); avl = remove_int(avl, 737); - avl = gpr_avl_add(avl, box(93), box(1558)); - avl = gpr_avl_add(avl, box(628), box(1559)); - avl = gpr_avl_add(avl, box(480), box(1560)); + avl = gpr_avl_add(avl, box(93), box(1558), NULL); + avl = gpr_avl_add(avl, box(628), box(1559), NULL); + avl = gpr_avl_add(avl, box(480), box(1560), NULL); avl = remove_int(avl, 958); avl = remove_int(avl, 565); avl = remove_int(avl, 32); avl = remove_int(avl, 1); avl = remove_int(avl, 335); - avl = gpr_avl_add(avl, box(136), box(1566)); - avl = gpr_avl_add(avl, box(469), box(1567)); + avl = gpr_avl_add(avl, box(136), box(1566), NULL); + avl = gpr_avl_add(avl, box(469), box(1567), NULL); avl = remove_int(avl, 349); - avl = gpr_avl_add(avl, box(768), box(1569)); - avl = gpr_avl_add(avl, box(915), box(1570)); + avl = gpr_avl_add(avl, box(768), box(1569), NULL); + avl = gpr_avl_add(avl, box(915), box(1570), NULL); avl = remove_int(avl, 1014); - avl = gpr_avl_add(avl, box(117), box(1572)); + avl = gpr_avl_add(avl, box(117), box(1572), NULL); avl = remove_int(avl, 62); - avl = gpr_avl_add(avl, box(382), box(1574)); + avl = gpr_avl_add(avl, box(382), box(1574), NULL); avl = remove_int(avl, 571); - avl = gpr_avl_add(avl, box(655), box(1576)); - avl = gpr_avl_add(avl, box(323), box(1577)); + avl = gpr_avl_add(avl, box(655), box(1576), NULL); + avl = gpr_avl_add(avl, box(323), box(1577), NULL); avl = remove_int(avl, 869); avl = remove_int(avl, 151); - avl = gpr_avl_add(avl, box(1019), box(1580)); - avl = gpr_avl_add(avl, box(984), box(1581)); - avl = gpr_avl_add(avl, box(870), box(1582)); - avl = gpr_avl_add(avl, box(376), box(1583)); + avl = gpr_avl_add(avl, box(1019), box(1580), NULL); + avl = gpr_avl_add(avl, box(984), box(1581), NULL); + avl = gpr_avl_add(avl, box(870), box(1582), NULL); + avl = gpr_avl_add(avl, box(376), box(1583), NULL); avl = remove_int(avl, 625); - avl = gpr_avl_add(avl, box(733), box(1585)); + avl = gpr_avl_add(avl, box(733), box(1585), NULL); avl = remove_int(avl, 532); avl = remove_int(avl, 444); - avl = gpr_avl_add(avl, box(428), box(1588)); - avl = gpr_avl_add(avl, box(860), box(1589)); - avl = gpr_avl_add(avl, box(173), box(1590)); + avl = gpr_avl_add(avl, box(428), box(1588), NULL); + avl = gpr_avl_add(avl, box(860), box(1589), NULL); + avl = gpr_avl_add(avl, box(173), box(1590), NULL); avl = remove_int(avl, 649); avl = remove_int(avl, 913); avl = remove_int(avl, 1); avl = remove_int(avl, 304); - avl = gpr_avl_add(avl, box(604), box(1595)); - avl = gpr_avl_add(avl, box(639), box(1596)); + avl = gpr_avl_add(avl, box(604), box(1595), NULL); + avl = gpr_avl_add(avl, box(639), box(1596), NULL); avl = remove_int(avl, 431); - avl = gpr_avl_add(avl, box(993), box(1598)); + avl = gpr_avl_add(avl, box(993), box(1598), NULL); avl = remove_int(avl, 681); avl = remove_int(avl, 927); - avl = gpr_avl_add(avl, box(87), box(1601)); - avl = gpr_avl_add(avl, box(91), box(1602)); + avl = gpr_avl_add(avl, box(87), box(1601), NULL); + avl = gpr_avl_add(avl, box(91), box(1602), NULL); avl = remove_int(avl, 61); avl = remove_int(avl, 14); avl = remove_int(avl, 305); avl = remove_int(avl, 304); avl = remove_int(avl, 1016); - avl = gpr_avl_add(avl, box(903), box(1608)); - avl = gpr_avl_add(avl, box(951), box(1609)); - avl = gpr_avl_add(avl, box(146), box(1610)); - avl = gpr_avl_add(avl, box(482), box(1611)); - avl = gpr_avl_add(avl, box(71), box(1612)); + avl = gpr_avl_add(avl, box(903), box(1608), NULL); + avl = gpr_avl_add(avl, box(951), box(1609), NULL); + avl = gpr_avl_add(avl, box(146), box(1610), NULL); + avl = gpr_avl_add(avl, box(482), box(1611), NULL); + avl = gpr_avl_add(avl, box(71), box(1612), NULL); avl = remove_int(avl, 246); avl = remove_int(avl, 696); - avl = gpr_avl_add(avl, box(636), box(1615)); - avl = gpr_avl_add(avl, box(295), box(1616)); + avl = gpr_avl_add(avl, box(636), box(1615), NULL); + avl = gpr_avl_add(avl, box(295), box(1616), NULL); avl = remove_int(avl, 11); avl = remove_int(avl, 231); - avl = gpr_avl_add(avl, box(905), box(1619)); - avl = gpr_avl_add(avl, box(993), box(1620)); - avl = gpr_avl_add(avl, box(433), box(1621)); - avl = gpr_avl_add(avl, box(117), box(1622)); - avl = gpr_avl_add(avl, box(467), box(1623)); + avl = gpr_avl_add(avl, box(905), box(1619), NULL); + avl = gpr_avl_add(avl, box(993), box(1620), NULL); + avl = gpr_avl_add(avl, box(433), box(1621), NULL); + avl = gpr_avl_add(avl, box(117), box(1622), NULL); + avl = gpr_avl_add(avl, box(467), box(1623), NULL); avl = remove_int(avl, 419); - avl = gpr_avl_add(avl, box(179), box(1625)); + avl = gpr_avl_add(avl, box(179), box(1625), NULL); avl = remove_int(avl, 926); avl = remove_int(avl, 326); - avl = gpr_avl_add(avl, box(551), box(1628)); + avl = gpr_avl_add(avl, box(551), box(1628), NULL); avl = remove_int(avl, 14); avl = remove_int(avl, 476); avl = remove_int(avl, 823); - avl = gpr_avl_add(avl, box(350), box(1632)); - avl = gpr_avl_add(avl, box(133), box(1633)); + avl = gpr_avl_add(avl, box(350), box(1632), NULL); + avl = gpr_avl_add(avl, box(133), box(1633), NULL); avl = remove_int(avl, 906); - avl = gpr_avl_add(avl, box(827), box(1635)); - avl = gpr_avl_add(avl, box(201), box(1636)); + avl = gpr_avl_add(avl, box(827), box(1635), NULL); + avl = gpr_avl_add(avl, box(201), box(1636), NULL); avl = remove_int(avl, 124); avl = remove_int(avl, 662); - avl = gpr_avl_add(avl, box(314), box(1639)); - avl = gpr_avl_add(avl, box(986), box(1640)); - avl = gpr_avl_add(avl, box(622), box(1641)); + avl = gpr_avl_add(avl, box(314), box(1639), NULL); + avl = gpr_avl_add(avl, box(986), box(1640), NULL); + avl = gpr_avl_add(avl, box(622), box(1641), NULL); avl = remove_int(avl, 130); - avl = gpr_avl_add(avl, box(861), box(1643)); + avl = gpr_avl_add(avl, box(861), box(1643), NULL); avl = remove_int(avl, 497); avl = remove_int(avl, 905); - avl = gpr_avl_add(avl, box(502), box(1646)); + avl = gpr_avl_add(avl, box(502), box(1646), NULL); avl = remove_int(avl, 721); - avl = gpr_avl_add(avl, box(514), box(1648)); - avl = gpr_avl_add(avl, box(410), box(1649)); + avl = gpr_avl_add(avl, box(514), box(1648), NULL); + avl = gpr_avl_add(avl, box(410), box(1649), NULL); avl = remove_int(avl, 869); avl = remove_int(avl, 247); - avl = gpr_avl_add(avl, box(450), box(1652)); + avl = gpr_avl_add(avl, box(450), box(1652), NULL); avl = remove_int(avl, 364); - avl = gpr_avl_add(avl, box(963), box(1654)); - avl = gpr_avl_add(avl, box(146), box(1655)); + avl = gpr_avl_add(avl, box(963), box(1654), NULL); + avl = gpr_avl_add(avl, box(146), box(1655), NULL); avl = remove_int(avl, 147); avl = remove_int(avl, 789); - avl = gpr_avl_add(avl, box(693), box(1658)); - avl = gpr_avl_add(avl, box(959), box(1659)); + avl = gpr_avl_add(avl, box(693), box(1658), NULL); + avl = gpr_avl_add(avl, box(959), box(1659), NULL); avl = remove_int(avl, 478); - avl = gpr_avl_add(avl, box(116), box(1661)); - avl = gpr_avl_add(avl, box(520), box(1662)); - avl = gpr_avl_add(avl, box(809), box(1663)); - avl = gpr_avl_add(avl, box(667), box(1664)); - avl = gpr_avl_add(avl, box(406), box(1665)); + avl = gpr_avl_add(avl, box(116), box(1661), NULL); + avl = gpr_avl_add(avl, box(520), box(1662), NULL); + avl = gpr_avl_add(avl, box(809), box(1663), NULL); + avl = gpr_avl_add(avl, box(667), box(1664), NULL); + avl = gpr_avl_add(avl, box(406), box(1665), NULL); avl = remove_int(avl, 409); - avl = gpr_avl_add(avl, box(558), box(1667)); - avl = gpr_avl_add(avl, box(0), box(1668)); - avl = gpr_avl_add(avl, box(948), box(1669)); - avl = gpr_avl_add(avl, box(576), box(1670)); + avl = gpr_avl_add(avl, box(558), box(1667), NULL); + avl = gpr_avl_add(avl, box(0), box(1668), NULL); + avl = gpr_avl_add(avl, box(948), box(1669), NULL); + avl = gpr_avl_add(avl, box(576), box(1670), NULL); avl = remove_int(avl, 864); avl = remove_int(avl, 840); avl = remove_int(avl, 1001); - avl = gpr_avl_add(avl, box(232), box(1674)); + avl = gpr_avl_add(avl, box(232), box(1674), NULL); avl = remove_int(avl, 676); avl = remove_int(avl, 752); avl = remove_int(avl, 667); avl = remove_int(avl, 605); - avl = gpr_avl_add(avl, box(258), box(1679)); - avl = gpr_avl_add(avl, box(648), box(1680)); - avl = gpr_avl_add(avl, box(761), box(1681)); + avl = gpr_avl_add(avl, box(258), box(1679), NULL); + avl = gpr_avl_add(avl, box(648), box(1680), NULL); + avl = gpr_avl_add(avl, box(761), box(1681), NULL); avl = remove_int(avl, 293); avl = remove_int(avl, 893); - avl = gpr_avl_add(avl, box(194), box(1684)); + avl = gpr_avl_add(avl, box(194), box(1684), NULL); avl = remove_int(avl, 233); - avl = gpr_avl_add(avl, box(888), box(1686)); + avl = gpr_avl_add(avl, box(888), box(1686), NULL); avl = remove_int(avl, 470); avl = remove_int(avl, 703); avl = remove_int(avl, 190); avl = remove_int(avl, 359); - avl = gpr_avl_add(avl, box(621), box(1691)); + avl = gpr_avl_add(avl, box(621), box(1691), NULL); avl = remove_int(avl, 634); avl = remove_int(avl, 335); - avl = gpr_avl_add(avl, box(718), box(1694)); - avl = gpr_avl_add(avl, box(463), box(1695)); - avl = gpr_avl_add(avl, box(233), box(1696)); + avl = gpr_avl_add(avl, box(718), box(1694), NULL); + avl = gpr_avl_add(avl, box(463), box(1695), NULL); + avl = gpr_avl_add(avl, box(233), box(1696), NULL); avl = remove_int(avl, 376); avl = remove_int(avl, 496); avl = remove_int(avl, 819); avl = remove_int(avl, 38); avl = remove_int(avl, 436); avl = remove_int(avl, 102); - avl = gpr_avl_add(avl, box(607), box(1703)); + avl = gpr_avl_add(avl, box(607), box(1703), NULL); avl = remove_int(avl, 329); - avl = gpr_avl_add(avl, box(716), box(1705)); + avl = gpr_avl_add(avl, box(716), box(1705), NULL); avl = remove_int(avl, 639); avl = remove_int(avl, 775); avl = remove_int(avl, 578); @@ -2849,402 +2851,402 @@ static void test_badcase3(void) { avl = remove_int(avl, 679); avl = remove_int(avl, 615); avl = remove_int(avl, 104); - avl = gpr_avl_add(avl, box(414), box(1713)); - avl = gpr_avl_add(avl, box(212), box(1714)); - avl = gpr_avl_add(avl, box(266), box(1715)); - avl = gpr_avl_add(avl, box(238), box(1716)); + avl = gpr_avl_add(avl, box(414), box(1713), NULL); + avl = gpr_avl_add(avl, box(212), box(1714), NULL); + avl = gpr_avl_add(avl, box(266), box(1715), NULL); + avl = gpr_avl_add(avl, box(238), box(1716), NULL); avl = remove_int(avl, 153); - avl = gpr_avl_add(avl, box(585), box(1718)); + avl = gpr_avl_add(avl, box(585), box(1718), NULL); avl = remove_int(avl, 121); - avl = gpr_avl_add(avl, box(534), box(1720)); + avl = gpr_avl_add(avl, box(534), box(1720), NULL); avl = remove_int(avl, 579); - avl = gpr_avl_add(avl, box(127), box(1722)); - avl = gpr_avl_add(avl, box(399), box(1723)); + avl = gpr_avl_add(avl, box(127), box(1722), NULL); + avl = gpr_avl_add(avl, box(399), box(1723), NULL); avl = remove_int(avl, 417); - avl = gpr_avl_add(avl, box(978), box(1725)); - avl = gpr_avl_add(avl, box(768), box(1726)); + avl = gpr_avl_add(avl, box(978), box(1725), NULL); + avl = gpr_avl_add(avl, box(768), box(1726), NULL); avl = remove_int(avl, 985); - avl = gpr_avl_add(avl, box(536), box(1728)); - avl = gpr_avl_add(avl, box(449), box(1729)); - avl = gpr_avl_add(avl, box(586), box(1730)); + avl = gpr_avl_add(avl, box(536), box(1728), NULL); + avl = gpr_avl_add(avl, box(449), box(1729), NULL); + avl = gpr_avl_add(avl, box(586), box(1730), NULL); avl = remove_int(avl, 998); avl = remove_int(avl, 394); avl = remove_int(avl, 141); - avl = gpr_avl_add(avl, box(889), box(1734)); - avl = gpr_avl_add(avl, box(871), box(1735)); - avl = gpr_avl_add(avl, box(76), box(1736)); - avl = gpr_avl_add(avl, box(549), box(1737)); - avl = gpr_avl_add(avl, box(757), box(1738)); + avl = gpr_avl_add(avl, box(889), box(1734), NULL); + avl = gpr_avl_add(avl, box(871), box(1735), NULL); + avl = gpr_avl_add(avl, box(76), box(1736), NULL); + avl = gpr_avl_add(avl, box(549), box(1737), NULL); + avl = gpr_avl_add(avl, box(757), box(1738), NULL); avl = remove_int(avl, 908); - avl = gpr_avl_add(avl, box(789), box(1740)); + avl = gpr_avl_add(avl, box(789), box(1740), NULL); avl = remove_int(avl, 224); - avl = gpr_avl_add(avl, box(407), box(1742)); - avl = gpr_avl_add(avl, box(381), box(1743)); - avl = gpr_avl_add(avl, box(561), box(1744)); - avl = gpr_avl_add(avl, box(667), box(1745)); - avl = gpr_avl_add(avl, box(522), box(1746)); - avl = gpr_avl_add(avl, box(948), box(1747)); + avl = gpr_avl_add(avl, box(407), box(1742), NULL); + avl = gpr_avl_add(avl, box(381), box(1743), NULL); + avl = gpr_avl_add(avl, box(561), box(1744), NULL); + avl = gpr_avl_add(avl, box(667), box(1745), NULL); + avl = gpr_avl_add(avl, box(522), box(1746), NULL); + avl = gpr_avl_add(avl, box(948), box(1747), NULL); avl = remove_int(avl, 770); - avl = gpr_avl_add(avl, box(872), box(1749)); - avl = gpr_avl_add(avl, box(327), box(1750)); + avl = gpr_avl_add(avl, box(872), box(1749), NULL); + avl = gpr_avl_add(avl, box(327), box(1750), NULL); avl = remove_int(avl, 10); - avl = gpr_avl_add(avl, box(122), box(1752)); + avl = gpr_avl_add(avl, box(122), box(1752), NULL); avl = remove_int(avl, 606); - avl = gpr_avl_add(avl, box(485), box(1754)); + avl = gpr_avl_add(avl, box(485), box(1754), NULL); avl = remove_int(avl, 6); - avl = gpr_avl_add(avl, box(329), box(1756)); - avl = gpr_avl_add(avl, box(783), box(1757)); + avl = gpr_avl_add(avl, box(329), box(1756), NULL); + avl = gpr_avl_add(avl, box(783), box(1757), NULL); avl = remove_int(avl, 416); - avl = gpr_avl_add(avl, box(656), box(1759)); - avl = gpr_avl_add(avl, box(971), box(1760)); - avl = gpr_avl_add(avl, box(77), box(1761)); - avl = gpr_avl_add(avl, box(942), box(1762)); + avl = gpr_avl_add(avl, box(656), box(1759), NULL); + avl = gpr_avl_add(avl, box(971), box(1760), NULL); + avl = gpr_avl_add(avl, box(77), box(1761), NULL); + avl = gpr_avl_add(avl, box(942), box(1762), NULL); avl = remove_int(avl, 361); - avl = gpr_avl_add(avl, box(66), box(1764)); - avl = gpr_avl_add(avl, box(299), box(1765)); - avl = gpr_avl_add(avl, box(929), box(1766)); - avl = gpr_avl_add(avl, box(797), box(1767)); + avl = gpr_avl_add(avl, box(66), box(1764), NULL); + avl = gpr_avl_add(avl, box(299), box(1765), NULL); + avl = gpr_avl_add(avl, box(929), box(1766), NULL); + avl = gpr_avl_add(avl, box(797), box(1767), NULL); avl = remove_int(avl, 869); avl = remove_int(avl, 907); - avl = gpr_avl_add(avl, box(870), box(1770)); + avl = gpr_avl_add(avl, box(870), box(1770), NULL); avl = remove_int(avl, 580); avl = remove_int(avl, 120); - avl = gpr_avl_add(avl, box(913), box(1773)); + avl = gpr_avl_add(avl, box(913), box(1773), NULL); avl = remove_int(avl, 480); - avl = gpr_avl_add(avl, box(489), box(1775)); + avl = gpr_avl_add(avl, box(489), box(1775), NULL); avl = remove_int(avl, 845); - avl = gpr_avl_add(avl, box(896), box(1777)); + avl = gpr_avl_add(avl, box(896), box(1777), NULL); avl = remove_int(avl, 567); avl = remove_int(avl, 427); - avl = gpr_avl_add(avl, box(443), box(1780)); - avl = gpr_avl_add(avl, box(3), box(1781)); + avl = gpr_avl_add(avl, box(443), box(1780), NULL); + avl = gpr_avl_add(avl, box(3), box(1781), NULL); avl = remove_int(avl, 12); - avl = gpr_avl_add(avl, box(376), box(1783)); - avl = gpr_avl_add(avl, box(155), box(1784)); - avl = gpr_avl_add(avl, box(188), box(1785)); - avl = gpr_avl_add(avl, box(149), box(1786)); - avl = gpr_avl_add(avl, box(178), box(1787)); + avl = gpr_avl_add(avl, box(376), box(1783), NULL); + avl = gpr_avl_add(avl, box(155), box(1784), NULL); + avl = gpr_avl_add(avl, box(188), box(1785), NULL); + avl = gpr_avl_add(avl, box(149), box(1786), NULL); + avl = gpr_avl_add(avl, box(178), box(1787), NULL); avl = remove_int(avl, 84); - avl = gpr_avl_add(avl, box(805), box(1789)); - avl = gpr_avl_add(avl, box(612), box(1790)); + avl = gpr_avl_add(avl, box(805), box(1789), NULL); + avl = gpr_avl_add(avl, box(612), box(1790), NULL); avl = remove_int(avl, 991); - avl = gpr_avl_add(avl, box(837), box(1792)); + avl = gpr_avl_add(avl, box(837), box(1792), NULL); avl = remove_int(avl, 173); avl = remove_int(avl, 72); - avl = gpr_avl_add(avl, box(1014), box(1795)); + avl = gpr_avl_add(avl, box(1014), box(1795), NULL); avl = remove_int(avl, 303); - avl = gpr_avl_add(avl, box(865), box(1797)); - avl = gpr_avl_add(avl, box(793), box(1798)); + avl = gpr_avl_add(avl, box(865), box(1797), NULL); + avl = gpr_avl_add(avl, box(793), box(1798), NULL); avl = remove_int(avl, 173); avl = remove_int(avl, 477); - avl = gpr_avl_add(avl, box(950), box(1801)); - avl = gpr_avl_add(avl, box(105), box(1802)); - avl = gpr_avl_add(avl, box(895), box(1803)); - avl = gpr_avl_add(avl, box(171), box(1804)); - avl = gpr_avl_add(avl, box(753), box(1805)); - avl = gpr_avl_add(avl, box(946), box(1806)); + avl = gpr_avl_add(avl, box(950), box(1801), NULL); + avl = gpr_avl_add(avl, box(105), box(1802), NULL); + avl = gpr_avl_add(avl, box(895), box(1803), NULL); + avl = gpr_avl_add(avl, box(171), box(1804), NULL); + avl = gpr_avl_add(avl, box(753), box(1805), NULL); + avl = gpr_avl_add(avl, box(946), box(1806), NULL); avl = remove_int(avl, 194); avl = remove_int(avl, 559); avl = remove_int(avl, 116); - avl = gpr_avl_add(avl, box(968), box(1810)); + avl = gpr_avl_add(avl, box(968), box(1810), NULL); avl = remove_int(avl, 124); avl = remove_int(avl, 99); - avl = gpr_avl_add(avl, box(563), box(1813)); + avl = gpr_avl_add(avl, box(563), box(1813), NULL); avl = remove_int(avl, 182); - avl = gpr_avl_add(avl, box(816), box(1815)); + avl = gpr_avl_add(avl, box(816), box(1815), NULL); avl = remove_int(avl, 73); avl = remove_int(avl, 261); - avl = gpr_avl_add(avl, box(847), box(1818)); - avl = gpr_avl_add(avl, box(368), box(1819)); - avl = gpr_avl_add(avl, box(808), box(1820)); - avl = gpr_avl_add(avl, box(779), box(1821)); + avl = gpr_avl_add(avl, box(847), box(1818), NULL); + avl = gpr_avl_add(avl, box(368), box(1819), NULL); + avl = gpr_avl_add(avl, box(808), box(1820), NULL); + avl = gpr_avl_add(avl, box(779), box(1821), NULL); avl = remove_int(avl, 818); - avl = gpr_avl_add(avl, box(466), box(1823)); + avl = gpr_avl_add(avl, box(466), box(1823), NULL); avl = remove_int(avl, 316); - avl = gpr_avl_add(avl, box(986), box(1825)); - avl = gpr_avl_add(avl, box(688), box(1826)); - avl = gpr_avl_add(avl, box(509), box(1827)); - avl = gpr_avl_add(avl, box(51), box(1828)); + avl = gpr_avl_add(avl, box(986), box(1825), NULL); + avl = gpr_avl_add(avl, box(688), box(1826), NULL); + avl = gpr_avl_add(avl, box(509), box(1827), NULL); + avl = gpr_avl_add(avl, box(51), box(1828), NULL); avl = remove_int(avl, 655); avl = remove_int(avl, 785); avl = remove_int(avl, 893); - avl = gpr_avl_add(avl, box(167), box(1832)); + avl = gpr_avl_add(avl, box(167), box(1832), NULL); avl = remove_int(avl, 13); avl = remove_int(avl, 263); - avl = gpr_avl_add(avl, box(1009), box(1835)); + avl = gpr_avl_add(avl, box(1009), box(1835), NULL); avl = remove_int(avl, 480); avl = remove_int(avl, 778); avl = remove_int(avl, 713); avl = remove_int(avl, 628); - avl = gpr_avl_add(avl, box(803), box(1840)); + avl = gpr_avl_add(avl, box(803), box(1840), NULL); avl = remove_int(avl, 267); - avl = gpr_avl_add(avl, box(676), box(1842)); - avl = gpr_avl_add(avl, box(231), box(1843)); - avl = gpr_avl_add(avl, box(824), box(1844)); + avl = gpr_avl_add(avl, box(676), box(1842), NULL); + avl = gpr_avl_add(avl, box(231), box(1843), NULL); + avl = gpr_avl_add(avl, box(824), box(1844), NULL); avl = remove_int(avl, 961); - avl = gpr_avl_add(avl, box(311), box(1846)); - avl = gpr_avl_add(avl, box(420), box(1847)); - avl = gpr_avl_add(avl, box(960), box(1848)); - avl = gpr_avl_add(avl, box(468), box(1849)); - avl = gpr_avl_add(avl, box(815), box(1850)); + avl = gpr_avl_add(avl, box(311), box(1846), NULL); + avl = gpr_avl_add(avl, box(420), box(1847), NULL); + avl = gpr_avl_add(avl, box(960), box(1848), NULL); + avl = gpr_avl_add(avl, box(468), box(1849), NULL); + avl = gpr_avl_add(avl, box(815), box(1850), NULL); avl = remove_int(avl, 247); avl = remove_int(avl, 194); - avl = gpr_avl_add(avl, box(546), box(1853)); + avl = gpr_avl_add(avl, box(546), box(1853), NULL); avl = remove_int(avl, 222); avl = remove_int(avl, 914); avl = remove_int(avl, 741); - avl = gpr_avl_add(avl, box(470), box(1857)); - avl = gpr_avl_add(avl, box(933), box(1858)); - avl = gpr_avl_add(avl, box(97), box(1859)); + avl = gpr_avl_add(avl, box(470), box(1857), NULL); + avl = gpr_avl_add(avl, box(933), box(1858), NULL); + avl = gpr_avl_add(avl, box(97), box(1859), NULL); avl = remove_int(avl, 564); avl = remove_int(avl, 295); - avl = gpr_avl_add(avl, box(864), box(1862)); + avl = gpr_avl_add(avl, box(864), box(1862), NULL); avl = remove_int(avl, 329); - avl = gpr_avl_add(avl, box(124), box(1864)); - avl = gpr_avl_add(avl, box(1000), box(1865)); - avl = gpr_avl_add(avl, box(228), box(1866)); - avl = gpr_avl_add(avl, box(187), box(1867)); + avl = gpr_avl_add(avl, box(124), box(1864), NULL); + avl = gpr_avl_add(avl, box(1000), box(1865), NULL); + avl = gpr_avl_add(avl, box(228), box(1866), NULL); + avl = gpr_avl_add(avl, box(187), box(1867), NULL); avl = remove_int(avl, 224); avl = remove_int(avl, 306); avl = remove_int(avl, 884); - avl = gpr_avl_add(avl, box(449), box(1871)); - avl = gpr_avl_add(avl, box(353), box(1872)); - avl = gpr_avl_add(avl, box(994), box(1873)); - avl = gpr_avl_add(avl, box(596), box(1874)); - avl = gpr_avl_add(avl, box(996), box(1875)); - avl = gpr_avl_add(avl, box(101), box(1876)); - avl = gpr_avl_add(avl, box(1012), box(1877)); - avl = gpr_avl_add(avl, box(982), box(1878)); - avl = gpr_avl_add(avl, box(742), box(1879)); + avl = gpr_avl_add(avl, box(449), box(1871), NULL); + avl = gpr_avl_add(avl, box(353), box(1872), NULL); + avl = gpr_avl_add(avl, box(994), box(1873), NULL); + avl = gpr_avl_add(avl, box(596), box(1874), NULL); + avl = gpr_avl_add(avl, box(996), box(1875), NULL); + avl = gpr_avl_add(avl, box(101), box(1876), NULL); + avl = gpr_avl_add(avl, box(1012), box(1877), NULL); + avl = gpr_avl_add(avl, box(982), box(1878), NULL); + avl = gpr_avl_add(avl, box(742), box(1879), NULL); avl = remove_int(avl, 92); avl = remove_int(avl, 1022); - avl = gpr_avl_add(avl, box(941), box(1882)); + avl = gpr_avl_add(avl, box(941), box(1882), NULL); avl = remove_int(avl, 742); avl = remove_int(avl, 919); - avl = gpr_avl_add(avl, box(588), box(1885)); + avl = gpr_avl_add(avl, box(588), box(1885), NULL); avl = remove_int(avl, 221); - avl = gpr_avl_add(avl, box(356), box(1887)); - avl = gpr_avl_add(avl, box(932), box(1888)); + avl = gpr_avl_add(avl, box(356), box(1887), NULL); + avl = gpr_avl_add(avl, box(932), box(1888), NULL); avl = remove_int(avl, 837); - avl = gpr_avl_add(avl, box(394), box(1890)); - avl = gpr_avl_add(avl, box(642), box(1891)); - avl = gpr_avl_add(avl, box(52), box(1892)); - avl = gpr_avl_add(avl, box(437), box(1893)); - avl = gpr_avl_add(avl, box(948), box(1894)); - avl = gpr_avl_add(avl, box(93), box(1895)); + avl = gpr_avl_add(avl, box(394), box(1890), NULL); + avl = gpr_avl_add(avl, box(642), box(1891), NULL); + avl = gpr_avl_add(avl, box(52), box(1892), NULL); + avl = gpr_avl_add(avl, box(437), box(1893), NULL); + avl = gpr_avl_add(avl, box(948), box(1894), NULL); + avl = gpr_avl_add(avl, box(93), box(1895), NULL); avl = remove_int(avl, 873); avl = remove_int(avl, 336); avl = remove_int(avl, 277); avl = remove_int(avl, 932); - avl = gpr_avl_add(avl, box(80), box(1900)); - avl = gpr_avl_add(avl, box(952), box(1901)); - avl = gpr_avl_add(avl, box(510), box(1902)); + avl = gpr_avl_add(avl, box(80), box(1900), NULL); + avl = gpr_avl_add(avl, box(952), box(1901), NULL); + avl = gpr_avl_add(avl, box(510), box(1902), NULL); avl = remove_int(avl, 876); avl = remove_int(avl, 612); - avl = gpr_avl_add(avl, box(923), box(1905)); - avl = gpr_avl_add(avl, box(475), box(1906)); + avl = gpr_avl_add(avl, box(923), box(1905), NULL); + avl = gpr_avl_add(avl, box(475), box(1906), NULL); avl = remove_int(avl, 478); avl = remove_int(avl, 148); - avl = gpr_avl_add(avl, box(538), box(1909)); + avl = gpr_avl_add(avl, box(538), box(1909), NULL); avl = remove_int(avl, 47); - avl = gpr_avl_add(avl, box(89), box(1911)); + avl = gpr_avl_add(avl, box(89), box(1911), NULL); avl = remove_int(avl, 723); - avl = gpr_avl_add(avl, box(687), box(1913)); - avl = gpr_avl_add(avl, box(480), box(1914)); - avl = gpr_avl_add(avl, box(149), box(1915)); + avl = gpr_avl_add(avl, box(687), box(1913), NULL); + avl = gpr_avl_add(avl, box(480), box(1914), NULL); + avl = gpr_avl_add(avl, box(149), box(1915), NULL); avl = remove_int(avl, 68); avl = remove_int(avl, 862); avl = remove_int(avl, 363); - avl = gpr_avl_add(avl, box(996), box(1919)); + avl = gpr_avl_add(avl, box(996), box(1919), NULL); avl = remove_int(avl, 380); - avl = gpr_avl_add(avl, box(957), box(1921)); + avl = gpr_avl_add(avl, box(957), box(1921), NULL); avl = remove_int(avl, 413); - avl = gpr_avl_add(avl, box(360), box(1923)); - avl = gpr_avl_add(avl, box(304), box(1924)); - avl = gpr_avl_add(avl, box(634), box(1925)); - avl = gpr_avl_add(avl, box(506), box(1926)); + avl = gpr_avl_add(avl, box(360), box(1923), NULL); + avl = gpr_avl_add(avl, box(304), box(1924), NULL); + avl = gpr_avl_add(avl, box(634), box(1925), NULL); + avl = gpr_avl_add(avl, box(506), box(1926), NULL); avl = remove_int(avl, 248); - avl = gpr_avl_add(avl, box(124), box(1928)); - avl = gpr_avl_add(avl, box(181), box(1929)); + avl = gpr_avl_add(avl, box(124), box(1928), NULL); + avl = gpr_avl_add(avl, box(181), box(1929), NULL); avl = remove_int(avl, 507); - avl = gpr_avl_add(avl, box(141), box(1931)); + avl = gpr_avl_add(avl, box(141), box(1931), NULL); avl = remove_int(avl, 409); avl = remove_int(avl, 129); avl = remove_int(avl, 694); avl = remove_int(avl, 723); - avl = gpr_avl_add(avl, box(998), box(1936)); - avl = gpr_avl_add(avl, box(906), box(1937)); - avl = gpr_avl_add(avl, box(44), box(1938)); + avl = gpr_avl_add(avl, box(998), box(1936), NULL); + avl = gpr_avl_add(avl, box(906), box(1937), NULL); + avl = gpr_avl_add(avl, box(44), box(1938), NULL); avl = remove_int(avl, 949); avl = remove_int(avl, 117); - avl = gpr_avl_add(avl, box(700), box(1941)); - avl = gpr_avl_add(avl, box(258), box(1942)); + avl = gpr_avl_add(avl, box(700), box(1941), NULL); + avl = gpr_avl_add(avl, box(258), box(1942), NULL); avl = remove_int(avl, 828); - avl = gpr_avl_add(avl, box(860), box(1944)); - avl = gpr_avl_add(avl, box(987), box(1945)); - avl = gpr_avl_add(avl, box(316), box(1946)); - avl = gpr_avl_add(avl, box(919), box(1947)); + avl = gpr_avl_add(avl, box(860), box(1944), NULL); + avl = gpr_avl_add(avl, box(987), box(1945), NULL); + avl = gpr_avl_add(avl, box(316), box(1946), NULL); + avl = gpr_avl_add(avl, box(919), box(1947), NULL); avl = remove_int(avl, 84); - avl = gpr_avl_add(avl, box(473), box(1949)); + avl = gpr_avl_add(avl, box(473), box(1949), NULL); avl = remove_int(avl, 127); avl = remove_int(avl, 829); avl = remove_int(avl, 829); - avl = gpr_avl_add(avl, box(488), box(1953)); - avl = gpr_avl_add(avl, box(954), box(1954)); + avl = gpr_avl_add(avl, box(488), box(1953), NULL); + avl = gpr_avl_add(avl, box(954), box(1954), NULL); avl = remove_int(avl, 198); avl = remove_int(avl, 972); avl = remove_int(avl, 670); - avl = gpr_avl_add(avl, box(822), box(1958)); + avl = gpr_avl_add(avl, box(822), box(1958), NULL); avl = remove_int(avl, 589); avl = remove_int(avl, 459); - avl = gpr_avl_add(avl, box(1003), box(1961)); - avl = gpr_avl_add(avl, box(657), box(1962)); - avl = gpr_avl_add(avl, box(477), box(1963)); - avl = gpr_avl_add(avl, box(923), box(1964)); + avl = gpr_avl_add(avl, box(1003), box(1961), NULL); + avl = gpr_avl_add(avl, box(657), box(1962), NULL); + avl = gpr_avl_add(avl, box(477), box(1963), NULL); + avl = gpr_avl_add(avl, box(923), box(1964), NULL); avl = remove_int(avl, 496); avl = remove_int(avl, 99); - avl = gpr_avl_add(avl, box(127), box(1967)); - avl = gpr_avl_add(avl, box(1013), box(1968)); - avl = gpr_avl_add(avl, box(778), box(1969)); + avl = gpr_avl_add(avl, box(127), box(1967), NULL); + avl = gpr_avl_add(avl, box(1013), box(1968), NULL); + avl = gpr_avl_add(avl, box(778), box(1969), NULL); avl = remove_int(avl, 5); avl = remove_int(avl, 990); avl = remove_int(avl, 850); avl = remove_int(avl, 160); avl = remove_int(avl, 86); - avl = gpr_avl_add(avl, box(283), box(1975)); + avl = gpr_avl_add(avl, box(283), box(1975), NULL); avl = remove_int(avl, 278); avl = remove_int(avl, 297); avl = remove_int(avl, 137); avl = remove_int(avl, 653); - avl = gpr_avl_add(avl, box(702), box(1980)); + avl = gpr_avl_add(avl, box(702), box(1980), NULL); avl = remove_int(avl, 63); avl = remove_int(avl, 427); avl = remove_int(avl, 706); avl = remove_int(avl, 806); - avl = gpr_avl_add(avl, box(335), box(1985)); - avl = gpr_avl_add(avl, box(412), box(1986)); + avl = gpr_avl_add(avl, box(335), box(1985), NULL); + avl = gpr_avl_add(avl, box(412), box(1986), NULL); avl = remove_int(avl, 766); avl = remove_int(avl, 937); avl = remove_int(avl, 886); avl = remove_int(avl, 652); - avl = gpr_avl_add(avl, box(545), box(1991)); - avl = gpr_avl_add(avl, box(408), box(1992)); - avl = gpr_avl_add(avl, box(841), box(1993)); + avl = gpr_avl_add(avl, box(545), box(1991), NULL); + avl = gpr_avl_add(avl, box(408), box(1992), NULL); + avl = gpr_avl_add(avl, box(841), box(1993), NULL); avl = remove_int(avl, 593); - avl = gpr_avl_add(avl, box(582), box(1995)); - avl = gpr_avl_add(avl, box(597), box(1996)); + avl = gpr_avl_add(avl, box(582), box(1995), NULL); + avl = gpr_avl_add(avl, box(597), box(1996), NULL); avl = remove_int(avl, 49); avl = remove_int(avl, 835); - avl = gpr_avl_add(avl, box(417), box(1999)); - avl = gpr_avl_add(avl, box(191), box(2000)); + avl = gpr_avl_add(avl, box(417), box(1999), NULL); + avl = gpr_avl_add(avl, box(191), box(2000), NULL); avl = remove_int(avl, 406); - avl = gpr_avl_add(avl, box(30), box(2002)); + avl = gpr_avl_add(avl, box(30), box(2002), NULL); avl = remove_int(avl, 841); avl = remove_int(avl, 50); - avl = gpr_avl_add(avl, box(967), box(2005)); - avl = gpr_avl_add(avl, box(849), box(2006)); + avl = gpr_avl_add(avl, box(967), box(2005), NULL); + avl = gpr_avl_add(avl, box(849), box(2006), NULL); avl = remove_int(avl, 608); - avl = gpr_avl_add(avl, box(306), box(2008)); + avl = gpr_avl_add(avl, box(306), box(2008), NULL); avl = remove_int(avl, 779); - avl = gpr_avl_add(avl, box(897), box(2010)); - avl = gpr_avl_add(avl, box(147), box(2011)); + avl = gpr_avl_add(avl, box(897), box(2010), NULL); + avl = gpr_avl_add(avl, box(147), box(2011), NULL); avl = remove_int(avl, 982); - avl = gpr_avl_add(avl, box(470), box(2013)); + avl = gpr_avl_add(avl, box(470), box(2013), NULL); avl = remove_int(avl, 951); - avl = gpr_avl_add(avl, box(388), box(2015)); + avl = gpr_avl_add(avl, box(388), box(2015), NULL); avl = remove_int(avl, 616); avl = remove_int(avl, 721); avl = remove_int(avl, 942); avl = remove_int(avl, 589); - avl = gpr_avl_add(avl, box(218), box(2020)); + avl = gpr_avl_add(avl, box(218), box(2020), NULL); avl = remove_int(avl, 671); - avl = gpr_avl_add(avl, box(1020), box(2022)); + avl = gpr_avl_add(avl, box(1020), box(2022), NULL); avl = remove_int(avl, 277); - avl = gpr_avl_add(avl, box(681), box(2024)); - avl = gpr_avl_add(avl, box(179), box(2025)); - avl = gpr_avl_add(avl, box(370), box(2026)); - avl = gpr_avl_add(avl, box(0), box(2027)); + avl = gpr_avl_add(avl, box(681), box(2024), NULL); + avl = gpr_avl_add(avl, box(179), box(2025), NULL); + avl = gpr_avl_add(avl, box(370), box(2026), NULL); + avl = gpr_avl_add(avl, box(0), box(2027), NULL); avl = remove_int(avl, 523); - avl = gpr_avl_add(avl, box(99), box(2029)); - avl = gpr_avl_add(avl, box(334), box(2030)); - avl = gpr_avl_add(avl, box(569), box(2031)); - avl = gpr_avl_add(avl, box(257), box(2032)); + avl = gpr_avl_add(avl, box(99), box(2029), NULL); + avl = gpr_avl_add(avl, box(334), box(2030), NULL); + avl = gpr_avl_add(avl, box(569), box(2031), NULL); + avl = gpr_avl_add(avl, box(257), box(2032), NULL); avl = remove_int(avl, 572); - avl = gpr_avl_add(avl, box(805), box(2034)); - avl = gpr_avl_add(avl, box(143), box(2035)); - avl = gpr_avl_add(avl, box(670), box(2036)); + avl = gpr_avl_add(avl, box(805), box(2034), NULL); + avl = gpr_avl_add(avl, box(143), box(2035), NULL); + avl = gpr_avl_add(avl, box(670), box(2036), NULL); avl = remove_int(avl, 42); - avl = gpr_avl_add(avl, box(46), box(2038)); + avl = gpr_avl_add(avl, box(46), box(2038), NULL); avl = remove_int(avl, 970); - avl = gpr_avl_add(avl, box(353), box(2040)); + avl = gpr_avl_add(avl, box(353), box(2040), NULL); avl = remove_int(avl, 258); - avl = gpr_avl_add(avl, box(451), box(2042)); - avl = gpr_avl_add(avl, box(28), box(2043)); - avl = gpr_avl_add(avl, box(729), box(2044)); - avl = gpr_avl_add(avl, box(401), box(2045)); - avl = gpr_avl_add(avl, box(614), box(2046)); + avl = gpr_avl_add(avl, box(451), box(2042), NULL); + avl = gpr_avl_add(avl, box(28), box(2043), NULL); + avl = gpr_avl_add(avl, box(729), box(2044), NULL); + avl = gpr_avl_add(avl, box(401), box(2045), NULL); + avl = gpr_avl_add(avl, box(614), box(2046), NULL); avl = remove_int(avl, 990); avl = remove_int(avl, 212); avl = remove_int(avl, 22); avl = remove_int(avl, 677); - avl = gpr_avl_add(avl, box(1016), box(2051)); - avl = gpr_avl_add(avl, box(980), box(2052)); - avl = gpr_avl_add(avl, box(990), box(2053)); - avl = gpr_avl_add(avl, box(355), box(2054)); + avl = gpr_avl_add(avl, box(1016), box(2051), NULL); + avl = gpr_avl_add(avl, box(980), box(2052), NULL); + avl = gpr_avl_add(avl, box(990), box(2053), NULL); + avl = gpr_avl_add(avl, box(355), box(2054), NULL); avl = remove_int(avl, 730); avl = remove_int(avl, 37); - avl = gpr_avl_add(avl, box(407), box(2057)); - avl = gpr_avl_add(avl, box(222), box(2058)); - avl = gpr_avl_add(avl, box(439), box(2059)); - avl = gpr_avl_add(avl, box(563), box(2060)); + avl = gpr_avl_add(avl, box(407), box(2057), NULL); + avl = gpr_avl_add(avl, box(222), box(2058), NULL); + avl = gpr_avl_add(avl, box(439), box(2059), NULL); + avl = gpr_avl_add(avl, box(563), box(2060), NULL); avl = remove_int(avl, 992); avl = remove_int(avl, 786); - avl = gpr_avl_add(avl, box(1), box(2063)); - avl = gpr_avl_add(avl, box(473), box(2064)); - avl = gpr_avl_add(avl, box(992), box(2065)); + avl = gpr_avl_add(avl, box(1), box(2063), NULL); + avl = gpr_avl_add(avl, box(473), box(2064), NULL); + avl = gpr_avl_add(avl, box(992), box(2065), NULL); avl = remove_int(avl, 190); avl = remove_int(avl, 450); avl = remove_int(avl, 1020); avl = remove_int(avl, 149); - avl = gpr_avl_add(avl, box(329), box(2070)); - avl = gpr_avl_add(avl, box(35), box(2071)); + avl = gpr_avl_add(avl, box(329), box(2070), NULL); + avl = gpr_avl_add(avl, box(35), box(2071), NULL); avl = remove_int(avl, 843); - avl = gpr_avl_add(avl, box(855), box(2073)); + avl = gpr_avl_add(avl, box(855), box(2073), NULL); avl = remove_int(avl, 878); - avl = gpr_avl_add(avl, box(993), box(2075)); - avl = gpr_avl_add(avl, box(87), box(2076)); - avl = gpr_avl_add(avl, box(572), box(2077)); + avl = gpr_avl_add(avl, box(993), box(2075), NULL); + avl = gpr_avl_add(avl, box(87), box(2076), NULL); + avl = gpr_avl_add(avl, box(572), box(2077), NULL); avl = remove_int(avl, 896); - avl = gpr_avl_add(avl, box(849), box(2079)); + avl = gpr_avl_add(avl, box(849), box(2079), NULL); avl = remove_int(avl, 597); - avl = gpr_avl_add(avl, box(472), box(2081)); + avl = gpr_avl_add(avl, box(472), box(2081), NULL); avl = remove_int(avl, 778); avl = remove_int(avl, 934); avl = remove_int(avl, 314); - avl = gpr_avl_add(avl, box(101), box(2085)); + avl = gpr_avl_add(avl, box(101), box(2085), NULL); avl = remove_int(avl, 938); avl = remove_int(avl, 1010); - avl = gpr_avl_add(avl, box(579), box(2088)); + avl = gpr_avl_add(avl, box(579), box(2088), NULL); avl = remove_int(avl, 798); avl = remove_int(avl, 88); - avl = gpr_avl_add(avl, box(851), box(2091)); + avl = gpr_avl_add(avl, box(851), box(2091), NULL); avl = remove_int(avl, 705); - avl = gpr_avl_add(avl, box(26), box(2093)); + avl = gpr_avl_add(avl, box(26), box(2093), NULL); avl = remove_int(avl, 973); - avl = gpr_avl_add(avl, box(923), box(2095)); + avl = gpr_avl_add(avl, box(923), box(2095), NULL); avl = remove_int(avl, 668); - avl = gpr_avl_add(avl, box(310), box(2097)); - avl = gpr_avl_add(avl, box(269), box(2098)); + avl = gpr_avl_add(avl, box(310), box(2097), NULL); + avl = gpr_avl_add(avl, box(269), box(2098), NULL); avl = remove_int(avl, 173); - avl = gpr_avl_add(avl, box(279), box(2100)); + avl = gpr_avl_add(avl, box(279), box(2100), NULL); avl = remove_int(avl, 203); - avl = gpr_avl_add(avl, box(411), box(2102)); + avl = gpr_avl_add(avl, box(411), box(2102), NULL); avl = remove_int(avl, 950); - avl = gpr_avl_add(avl, box(6), box(2104)); + avl = gpr_avl_add(avl, box(6), box(2104), NULL); avl = remove_int(avl, 400); avl = remove_int(avl, 468); avl = remove_int(avl, 271); - avl = gpr_avl_add(avl, box(627), box(2108)); + avl = gpr_avl_add(avl, box(627), box(2108), NULL); avl = remove_int(avl, 727); avl = remove_int(avl, 148); avl = remove_int(avl, 98); @@ -3253,259 +3255,259 @@ static void test_badcase3(void) { avl = remove_int(avl, 628); avl = remove_int(avl, 826); avl = remove_int(avl, 664); - avl = gpr_avl_add(avl, box(76), box(2117)); + avl = gpr_avl_add(avl, box(76), box(2117), NULL); avl = remove_int(avl, 194); avl = remove_int(avl, 18); - avl = gpr_avl_add(avl, box(727), box(2120)); + avl = gpr_avl_add(avl, box(727), box(2120), NULL); avl = remove_int(avl, 295); - avl = gpr_avl_add(avl, box(645), box(2122)); + avl = gpr_avl_add(avl, box(645), box(2122), NULL); avl = remove_int(avl, 321); avl = remove_int(avl, 863); - avl = gpr_avl_add(avl, box(824), box(2125)); - avl = gpr_avl_add(avl, box(651), box(2126)); - avl = gpr_avl_add(avl, box(804), box(2127)); + avl = gpr_avl_add(avl, box(824), box(2125), NULL); + avl = gpr_avl_add(avl, box(651), box(2126), NULL); + avl = gpr_avl_add(avl, box(804), box(2127), NULL); avl = remove_int(avl, 307); - avl = gpr_avl_add(avl, box(867), box(2129)); + avl = gpr_avl_add(avl, box(867), box(2129), NULL); avl = remove_int(avl, 384); - avl = gpr_avl_add(avl, box(819), box(2131)); + avl = gpr_avl_add(avl, box(819), box(2131), NULL); avl = remove_int(avl, 674); - avl = gpr_avl_add(avl, box(76), box(2133)); + avl = gpr_avl_add(avl, box(76), box(2133), NULL); avl = remove_int(avl, 898); - avl = gpr_avl_add(avl, box(45), box(2135)); - avl = gpr_avl_add(avl, box(512), box(2136)); + avl = gpr_avl_add(avl, box(45), box(2135), NULL); + avl = gpr_avl_add(avl, box(512), box(2136), NULL); avl = remove_int(avl, 773); avl = remove_int(avl, 907); avl = remove_int(avl, 382); avl = remove_int(avl, 95); avl = remove_int(avl, 734); avl = remove_int(avl, 81); - avl = gpr_avl_add(avl, box(348), box(2143)); + avl = gpr_avl_add(avl, box(348), box(2143), NULL); avl = remove_int(avl, 509); avl = remove_int(avl, 301); - avl = gpr_avl_add(avl, box(861), box(2146)); - avl = gpr_avl_add(avl, box(918), box(2147)); + avl = gpr_avl_add(avl, box(861), box(2146), NULL); + avl = gpr_avl_add(avl, box(918), box(2147), NULL); avl = remove_int(avl, 992); - avl = gpr_avl_add(avl, box(356), box(2149)); + avl = gpr_avl_add(avl, box(356), box(2149), NULL); avl = remove_int(avl, 64); avl = remove_int(avl, 444); avl = remove_int(avl, 741); - avl = gpr_avl_add(avl, box(710), box(2153)); - avl = gpr_avl_add(avl, box(264), box(2154)); + avl = gpr_avl_add(avl, box(710), box(2153), NULL); + avl = gpr_avl_add(avl, box(264), box(2154), NULL); avl = remove_int(avl, 347); avl = remove_int(avl, 250); - avl = gpr_avl_add(avl, box(82), box(2157)); - avl = gpr_avl_add(avl, box(571), box(2158)); + avl = gpr_avl_add(avl, box(82), box(2157), NULL); + avl = gpr_avl_add(avl, box(571), box(2158), NULL); avl = remove_int(avl, 721); avl = remove_int(avl, 622); - avl = gpr_avl_add(avl, box(950), box(2161)); - avl = gpr_avl_add(avl, box(94), box(2162)); + avl = gpr_avl_add(avl, box(950), box(2161), NULL); + avl = gpr_avl_add(avl, box(94), box(2162), NULL); avl = remove_int(avl, 970); - avl = gpr_avl_add(avl, box(815), box(2164)); + avl = gpr_avl_add(avl, box(815), box(2164), NULL); avl = remove_int(avl, 930); avl = remove_int(avl, 703); - avl = gpr_avl_add(avl, box(432), box(2167)); + avl = gpr_avl_add(avl, box(432), box(2167), NULL); avl = remove_int(avl, 544); - avl = gpr_avl_add(avl, box(21), box(2169)); - avl = gpr_avl_add(avl, box(186), box(2170)); + avl = gpr_avl_add(avl, box(21), box(2169), NULL); + avl = gpr_avl_add(avl, box(186), box(2170), NULL); avl = remove_int(avl, 143); - avl = gpr_avl_add(avl, box(425), box(2172)); + avl = gpr_avl_add(avl, box(425), box(2172), NULL); avl = remove_int(avl, 769); - avl = gpr_avl_add(avl, box(656), box(2174)); + avl = gpr_avl_add(avl, box(656), box(2174), NULL); avl = remove_int(avl, 29); - avl = gpr_avl_add(avl, box(464), box(2176)); + avl = gpr_avl_add(avl, box(464), box(2176), NULL); avl = remove_int(avl, 713); - avl = gpr_avl_add(avl, box(800), box(2178)); + avl = gpr_avl_add(avl, box(800), box(2178), NULL); avl = remove_int(avl, 621); - avl = gpr_avl_add(avl, box(962), box(2180)); + avl = gpr_avl_add(avl, box(962), box(2180), NULL); avl = remove_int(avl, 448); - avl = gpr_avl_add(avl, box(878), box(2182)); + avl = gpr_avl_add(avl, box(878), box(2182), NULL); avl = remove_int(avl, 39); avl = remove_int(avl, 999); - avl = gpr_avl_add(avl, box(182), box(2185)); - avl = gpr_avl_add(avl, box(429), box(2186)); - avl = gpr_avl_add(avl, box(598), box(2187)); + avl = gpr_avl_add(avl, box(182), box(2185), NULL); + avl = gpr_avl_add(avl, box(429), box(2186), NULL); + avl = gpr_avl_add(avl, box(598), box(2187), NULL); avl = remove_int(avl, 551); - avl = gpr_avl_add(avl, box(827), box(2189)); - avl = gpr_avl_add(avl, box(809), box(2190)); + avl = gpr_avl_add(avl, box(827), box(2189), NULL); + avl = gpr_avl_add(avl, box(809), box(2190), NULL); avl = remove_int(avl, 438); avl = remove_int(avl, 811); - avl = gpr_avl_add(avl, box(808), box(2193)); - avl = gpr_avl_add(avl, box(788), box(2194)); + avl = gpr_avl_add(avl, box(808), box(2193), NULL); + avl = gpr_avl_add(avl, box(788), box(2194), NULL); avl = remove_int(avl, 156); - avl = gpr_avl_add(avl, box(933), box(2196)); - avl = gpr_avl_add(avl, box(344), box(2197)); + avl = gpr_avl_add(avl, box(933), box(2196), NULL); + avl = gpr_avl_add(avl, box(344), box(2197), NULL); avl = remove_int(avl, 460); - avl = gpr_avl_add(avl, box(161), box(2199)); - avl = gpr_avl_add(avl, box(444), box(2200)); + avl = gpr_avl_add(avl, box(161), box(2199), NULL); + avl = gpr_avl_add(avl, box(444), box(2200), NULL); avl = remove_int(avl, 597); avl = remove_int(avl, 668); - avl = gpr_avl_add(avl, box(703), box(2203)); + avl = gpr_avl_add(avl, box(703), box(2203), NULL); avl = remove_int(avl, 515); - avl = gpr_avl_add(avl, box(380), box(2205)); - avl = gpr_avl_add(avl, box(338), box(2206)); + avl = gpr_avl_add(avl, box(380), box(2205), NULL); + avl = gpr_avl_add(avl, box(338), box(2206), NULL); avl = remove_int(avl, 550); avl = remove_int(avl, 946); avl = remove_int(avl, 714); avl = remove_int(avl, 739); - avl = gpr_avl_add(avl, box(413), box(2211)); + avl = gpr_avl_add(avl, box(413), box(2211), NULL); avl = remove_int(avl, 450); - avl = gpr_avl_add(avl, box(411), box(2213)); - avl = gpr_avl_add(avl, box(117), box(2214)); - avl = gpr_avl_add(avl, box(322), box(2215)); - avl = gpr_avl_add(avl, box(915), box(2216)); - avl = gpr_avl_add(avl, box(410), box(2217)); - avl = gpr_avl_add(avl, box(66), box(2218)); + avl = gpr_avl_add(avl, box(411), box(2213), NULL); + avl = gpr_avl_add(avl, box(117), box(2214), NULL); + avl = gpr_avl_add(avl, box(322), box(2215), NULL); + avl = gpr_avl_add(avl, box(915), box(2216), NULL); + avl = gpr_avl_add(avl, box(410), box(2217), NULL); + avl = gpr_avl_add(avl, box(66), box(2218), NULL); avl = remove_int(avl, 756); avl = remove_int(avl, 596); - avl = gpr_avl_add(avl, box(882), box(2221)); - avl = gpr_avl_add(avl, box(930), box(2222)); - avl = gpr_avl_add(avl, box(36), box(2223)); + avl = gpr_avl_add(avl, box(882), box(2221), NULL); + avl = gpr_avl_add(avl, box(930), box(2222), NULL); + avl = gpr_avl_add(avl, box(36), box(2223), NULL); avl = remove_int(avl, 742); - avl = gpr_avl_add(avl, box(539), box(2225)); - avl = gpr_avl_add(avl, box(596), box(2226)); + avl = gpr_avl_add(avl, box(539), box(2225), NULL); + avl = gpr_avl_add(avl, box(596), box(2226), NULL); avl = remove_int(avl, 82); avl = remove_int(avl, 686); avl = remove_int(avl, 933); avl = remove_int(avl, 42); avl = remove_int(avl, 340); - avl = gpr_avl_add(avl, box(126), box(2232)); - avl = gpr_avl_add(avl, box(493), box(2233)); - avl = gpr_avl_add(avl, box(839), box(2234)); + avl = gpr_avl_add(avl, box(126), box(2232), NULL); + avl = gpr_avl_add(avl, box(493), box(2233), NULL); + avl = gpr_avl_add(avl, box(839), box(2234), NULL); avl = remove_int(avl, 774); - avl = gpr_avl_add(avl, box(337), box(2236)); + avl = gpr_avl_add(avl, box(337), box(2236), NULL); avl = remove_int(avl, 322); - avl = gpr_avl_add(avl, box(16), box(2238)); + avl = gpr_avl_add(avl, box(16), box(2238), NULL); avl = remove_int(avl, 73); avl = remove_int(avl, 85); avl = remove_int(avl, 191); avl = remove_int(avl, 541); - avl = gpr_avl_add(avl, box(704), box(2243)); + avl = gpr_avl_add(avl, box(704), box(2243), NULL); avl = remove_int(avl, 767); avl = remove_int(avl, 1006); avl = remove_int(avl, 844); avl = remove_int(avl, 742); - avl = gpr_avl_add(avl, box(48), box(2248)); - avl = gpr_avl_add(avl, box(138), box(2249)); - avl = gpr_avl_add(avl, box(437), box(2250)); - avl = gpr_avl_add(avl, box(275), box(2251)); + avl = gpr_avl_add(avl, box(48), box(2248), NULL); + avl = gpr_avl_add(avl, box(138), box(2249), NULL); + avl = gpr_avl_add(avl, box(437), box(2250), NULL); + avl = gpr_avl_add(avl, box(275), box(2251), NULL); avl = remove_int(avl, 520); - avl = gpr_avl_add(avl, box(1019), box(2253)); + avl = gpr_avl_add(avl, box(1019), box(2253), NULL); avl = remove_int(avl, 955); - avl = gpr_avl_add(avl, box(270), box(2255)); + avl = gpr_avl_add(avl, box(270), box(2255), NULL); avl = remove_int(avl, 680); avl = remove_int(avl, 698); - avl = gpr_avl_add(avl, box(735), box(2258)); - avl = gpr_avl_add(avl, box(400), box(2259)); + avl = gpr_avl_add(avl, box(735), box(2258), NULL); + avl = gpr_avl_add(avl, box(400), box(2259), NULL); avl = remove_int(avl, 991); - avl = gpr_avl_add(avl, box(263), box(2261)); + avl = gpr_avl_add(avl, box(263), box(2261), NULL); avl = remove_int(avl, 704); - avl = gpr_avl_add(avl, box(757), box(2263)); + avl = gpr_avl_add(avl, box(757), box(2263), NULL); avl = remove_int(avl, 194); avl = remove_int(avl, 616); avl = remove_int(avl, 784); - avl = gpr_avl_add(avl, box(382), box(2267)); - avl = gpr_avl_add(avl, box(464), box(2268)); - avl = gpr_avl_add(avl, box(817), box(2269)); + avl = gpr_avl_add(avl, box(382), box(2267), NULL); + avl = gpr_avl_add(avl, box(464), box(2268), NULL); + avl = gpr_avl_add(avl, box(817), box(2269), NULL); avl = remove_int(avl, 445); - avl = gpr_avl_add(avl, box(412), box(2271)); + avl = gpr_avl_add(avl, box(412), box(2271), NULL); avl = remove_int(avl, 525); - avl = gpr_avl_add(avl, box(299), box(2273)); - avl = gpr_avl_add(avl, box(464), box(2274)); - avl = gpr_avl_add(avl, box(715), box(2275)); + avl = gpr_avl_add(avl, box(299), box(2273), NULL); + avl = gpr_avl_add(avl, box(464), box(2274), NULL); + avl = gpr_avl_add(avl, box(715), box(2275), NULL); avl = remove_int(avl, 58); avl = remove_int(avl, 218); - avl = gpr_avl_add(avl, box(961), box(2278)); - avl = gpr_avl_add(avl, box(491), box(2279)); + avl = gpr_avl_add(avl, box(961), box(2278), NULL); + avl = gpr_avl_add(avl, box(491), box(2279), NULL); avl = remove_int(avl, 846); - avl = gpr_avl_add(avl, box(762), box(2281)); + avl = gpr_avl_add(avl, box(762), box(2281), NULL); avl = remove_int(avl, 974); avl = remove_int(avl, 887); - avl = gpr_avl_add(avl, box(498), box(2284)); + avl = gpr_avl_add(avl, box(498), box(2284), NULL); avl = remove_int(avl, 810); avl = remove_int(avl, 743); avl = remove_int(avl, 22); avl = remove_int(avl, 284); - avl = gpr_avl_add(avl, box(482), box(2289)); - avl = gpr_avl_add(avl, box(1021), box(2290)); + avl = gpr_avl_add(avl, box(482), box(2289), NULL); + avl = gpr_avl_add(avl, box(1021), box(2290), NULL); avl = remove_int(avl, 155); avl = remove_int(avl, 128); - avl = gpr_avl_add(avl, box(819), box(2293)); - avl = gpr_avl_add(avl, box(324), box(2294)); + avl = gpr_avl_add(avl, box(819), box(2293), NULL); + avl = gpr_avl_add(avl, box(324), box(2294), NULL); avl = remove_int(avl, 196); avl = remove_int(avl, 370); avl = remove_int(avl, 753); avl = remove_int(avl, 56); avl = remove_int(avl, 735); - avl = gpr_avl_add(avl, box(272), box(2300)); - avl = gpr_avl_add(avl, box(474), box(2301)); - avl = gpr_avl_add(avl, box(719), box(2302)); - avl = gpr_avl_add(avl, box(236), box(2303)); + avl = gpr_avl_add(avl, box(272), box(2300), NULL); + avl = gpr_avl_add(avl, box(474), box(2301), NULL); + avl = gpr_avl_add(avl, box(719), box(2302), NULL); + avl = gpr_avl_add(avl, box(236), box(2303), NULL); avl = remove_int(avl, 818); - avl = gpr_avl_add(avl, box(727), box(2305)); + avl = gpr_avl_add(avl, box(727), box(2305), NULL); avl = remove_int(avl, 892); avl = remove_int(avl, 871); avl = remove_int(avl, 231); - avl = gpr_avl_add(avl, box(62), box(2309)); - avl = gpr_avl_add(avl, box(953), box(2310)); + avl = gpr_avl_add(avl, box(62), box(2309), NULL); + avl = gpr_avl_add(avl, box(953), box(2310), NULL); avl = remove_int(avl, 701); - avl = gpr_avl_add(avl, box(193), box(2312)); + avl = gpr_avl_add(avl, box(193), box(2312), NULL); avl = remove_int(avl, 619); avl = remove_int(avl, 22); avl = remove_int(avl, 804); avl = remove_int(avl, 851); - avl = gpr_avl_add(avl, box(286), box(2317)); - avl = gpr_avl_add(avl, box(751), box(2318)); + avl = gpr_avl_add(avl, box(286), box(2317), NULL); + avl = gpr_avl_add(avl, box(751), box(2318), NULL); avl = remove_int(avl, 525); - avl = gpr_avl_add(avl, box(217), box(2320)); + avl = gpr_avl_add(avl, box(217), box(2320), NULL); avl = remove_int(avl, 336); - avl = gpr_avl_add(avl, box(86), box(2322)); - avl = gpr_avl_add(avl, box(81), box(2323)); - avl = gpr_avl_add(avl, box(850), box(2324)); + avl = gpr_avl_add(avl, box(86), box(2322), NULL); + avl = gpr_avl_add(avl, box(81), box(2323), NULL); + avl = gpr_avl_add(avl, box(850), box(2324), NULL); avl = remove_int(avl, 872); - avl = gpr_avl_add(avl, box(402), box(2326)); - avl = gpr_avl_add(avl, box(54), box(2327)); - avl = gpr_avl_add(avl, box(980), box(2328)); - avl = gpr_avl_add(avl, box(845), box(2329)); + avl = gpr_avl_add(avl, box(402), box(2326), NULL); + avl = gpr_avl_add(avl, box(54), box(2327), NULL); + avl = gpr_avl_add(avl, box(980), box(2328), NULL); + avl = gpr_avl_add(avl, box(845), box(2329), NULL); avl = remove_int(avl, 1004); avl = remove_int(avl, 273); avl = remove_int(avl, 879); - avl = gpr_avl_add(avl, box(354), box(2333)); - avl = gpr_avl_add(avl, box(58), box(2334)); - avl = gpr_avl_add(avl, box(127), box(2335)); + avl = gpr_avl_add(avl, box(354), box(2333), NULL); + avl = gpr_avl_add(avl, box(58), box(2334), NULL); + avl = gpr_avl_add(avl, box(127), box(2335), NULL); avl = remove_int(avl, 84); - avl = gpr_avl_add(avl, box(360), box(2337)); + avl = gpr_avl_add(avl, box(360), box(2337), NULL); avl = remove_int(avl, 648); avl = remove_int(avl, 488); avl = remove_int(avl, 585); avl = remove_int(avl, 230); - avl = gpr_avl_add(avl, box(887), box(2342)); + avl = gpr_avl_add(avl, box(887), box(2342), NULL); avl = remove_int(avl, 558); avl = remove_int(avl, 958); - avl = gpr_avl_add(avl, box(822), box(2345)); + avl = gpr_avl_add(avl, box(822), box(2345), NULL); avl = remove_int(avl, 1004); avl = remove_int(avl, 747); - avl = gpr_avl_add(avl, box(631), box(2348)); - avl = gpr_avl_add(avl, box(442), box(2349)); + avl = gpr_avl_add(avl, box(631), box(2348), NULL); + avl = gpr_avl_add(avl, box(442), box(2349), NULL); avl = remove_int(avl, 957); avl = remove_int(avl, 964); - avl = gpr_avl_add(avl, box(10), box(2352)); + avl = gpr_avl_add(avl, box(10), box(2352), NULL); avl = remove_int(avl, 189); - avl = gpr_avl_add(avl, box(742), box(2354)); + avl = gpr_avl_add(avl, box(742), box(2354), NULL); avl = remove_int(avl, 108); - avl = gpr_avl_add(avl, box(1014), box(2356)); + avl = gpr_avl_add(avl, box(1014), box(2356), NULL); avl = remove_int(avl, 266); avl = remove_int(avl, 623); avl = remove_int(avl, 697); - avl = gpr_avl_add(avl, box(180), box(2360)); + avl = gpr_avl_add(avl, box(180), box(2360), NULL); avl = remove_int(avl, 472); - avl = gpr_avl_add(avl, box(567), box(2362)); + avl = gpr_avl_add(avl, box(567), box(2362), NULL); avl = remove_int(avl, 1020); avl = remove_int(avl, 273); - avl = gpr_avl_add(avl, box(864), box(2365)); - avl = gpr_avl_add(avl, box(1009), box(2366)); + avl = gpr_avl_add(avl, box(864), box(2365), NULL); + avl = gpr_avl_add(avl, box(1009), box(2366), NULL); avl = remove_int(avl, 224); avl = remove_int(avl, 81); - avl = gpr_avl_add(avl, box(653), box(2369)); + avl = gpr_avl_add(avl, box(653), box(2369), NULL); avl = remove_int(avl, 67); avl = remove_int(avl, 102); avl = remove_int(avl, 76); @@ -3513,51 +3515,51 @@ static void test_badcase3(void) { avl = remove_int(avl, 169); avl = remove_int(avl, 232); avl = remove_int(avl, 79); - avl = gpr_avl_add(avl, box(509), box(2377)); + avl = gpr_avl_add(avl, box(509), box(2377), NULL); avl = remove_int(avl, 900); avl = remove_int(avl, 822); avl = remove_int(avl, 945); avl = remove_int(avl, 356); - avl = gpr_avl_add(avl, box(443), box(2382)); - avl = gpr_avl_add(avl, box(925), box(2383)); + avl = gpr_avl_add(avl, box(443), box(2382), NULL); + avl = gpr_avl_add(avl, box(925), box(2383), NULL); avl = remove_int(avl, 994); avl = remove_int(avl, 324); - avl = gpr_avl_add(avl, box(291), box(2386)); + avl = gpr_avl_add(avl, box(291), box(2386), NULL); avl = remove_int(avl, 94); avl = remove_int(avl, 795); avl = remove_int(avl, 42); - avl = gpr_avl_add(avl, box(613), box(2390)); + avl = gpr_avl_add(avl, box(613), box(2390), NULL); avl = remove_int(avl, 289); - avl = gpr_avl_add(avl, box(980), box(2392)); + avl = gpr_avl_add(avl, box(980), box(2392), NULL); avl = remove_int(avl, 316); - avl = gpr_avl_add(avl, box(281), box(2394)); - avl = gpr_avl_add(avl, box(1006), box(2395)); + avl = gpr_avl_add(avl, box(281), box(2394), NULL); + avl = gpr_avl_add(avl, box(1006), box(2395), NULL); avl = remove_int(avl, 776); - avl = gpr_avl_add(avl, box(108), box(2397)); - avl = gpr_avl_add(avl, box(918), box(2398)); + avl = gpr_avl_add(avl, box(108), box(2397), NULL); + avl = gpr_avl_add(avl, box(918), box(2398), NULL); avl = remove_int(avl, 721); avl = remove_int(avl, 563); - avl = gpr_avl_add(avl, box(925), box(2401)); + avl = gpr_avl_add(avl, box(925), box(2401), NULL); avl = remove_int(avl, 448); avl = remove_int(avl, 198); avl = remove_int(avl, 1); - avl = gpr_avl_add(avl, box(160), box(2405)); + avl = gpr_avl_add(avl, box(160), box(2405), NULL); avl = remove_int(avl, 515); - avl = gpr_avl_add(avl, box(284), box(2407)); - avl = gpr_avl_add(avl, box(225), box(2408)); + avl = gpr_avl_add(avl, box(284), box(2407), NULL); + avl = gpr_avl_add(avl, box(225), box(2408), NULL); avl = remove_int(avl, 304); - avl = gpr_avl_add(avl, box(714), box(2410)); - avl = gpr_avl_add(avl, box(708), box(2411)); - avl = gpr_avl_add(avl, box(624), box(2412)); + avl = gpr_avl_add(avl, box(714), box(2410), NULL); + avl = gpr_avl_add(avl, box(708), box(2411), NULL); + avl = gpr_avl_add(avl, box(624), box(2412), NULL); avl = remove_int(avl, 662); avl = remove_int(avl, 825); avl = remove_int(avl, 383); avl = remove_int(avl, 381); - avl = gpr_avl_add(avl, box(194), box(2417)); + avl = gpr_avl_add(avl, box(194), box(2417), NULL); avl = remove_int(avl, 280); avl = remove_int(avl, 25); avl = remove_int(avl, 633); - avl = gpr_avl_add(avl, box(897), box(2421)); + avl = gpr_avl_add(avl, box(897), box(2421), NULL); avl = remove_int(avl, 636); avl = remove_int(avl, 596); avl = remove_int(avl, 757); @@ -3567,33 +3569,33 @@ static void test_badcase3(void) { avl = remove_int(avl, 843); avl = remove_int(avl, 280); avl = remove_int(avl, 911); - avl = gpr_avl_add(avl, box(1008), box(2431)); + avl = gpr_avl_add(avl, box(1008), box(2431), NULL); avl = remove_int(avl, 948); avl = remove_int(avl, 74); avl = remove_int(avl, 571); - avl = gpr_avl_add(avl, box(486), box(2435)); - avl = gpr_avl_add(avl, box(285), box(2436)); + avl = gpr_avl_add(avl, box(486), box(2435), NULL); + avl = gpr_avl_add(avl, box(285), box(2436), NULL); avl = remove_int(avl, 304); avl = remove_int(avl, 516); - avl = gpr_avl_add(avl, box(758), box(2439)); - avl = gpr_avl_add(avl, box(776), box(2440)); + avl = gpr_avl_add(avl, box(758), box(2439), NULL); + avl = gpr_avl_add(avl, box(776), box(2440), NULL); avl = remove_int(avl, 696); - avl = gpr_avl_add(avl, box(104), box(2442)); - avl = gpr_avl_add(avl, box(700), box(2443)); - avl = gpr_avl_add(avl, box(114), box(2444)); - avl = gpr_avl_add(avl, box(567), box(2445)); + avl = gpr_avl_add(avl, box(104), box(2442), NULL); + avl = gpr_avl_add(avl, box(700), box(2443), NULL); + avl = gpr_avl_add(avl, box(114), box(2444), NULL); + avl = gpr_avl_add(avl, box(567), box(2445), NULL); avl = remove_int(avl, 620); - avl = gpr_avl_add(avl, box(270), box(2447)); + avl = gpr_avl_add(avl, box(270), box(2447), NULL); avl = remove_int(avl, 730); - avl = gpr_avl_add(avl, box(749), box(2449)); - avl = gpr_avl_add(avl, box(443), box(2450)); + avl = gpr_avl_add(avl, box(749), box(2449), NULL); + avl = gpr_avl_add(avl, box(443), box(2450), NULL); avl = remove_int(avl, 457); - avl = gpr_avl_add(avl, box(571), box(2452)); - avl = gpr_avl_add(avl, box(626), box(2453)); + avl = gpr_avl_add(avl, box(571), box(2452), NULL); + avl = gpr_avl_add(avl, box(626), box(2453), NULL); avl = remove_int(avl, 638); avl = remove_int(avl, 313); - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } static void test_stress(int amount_of_stress) { @@ -3616,9 +3618,9 @@ static void test_stress(int amount_of_stress) { GPR_ASSERT(i); if (rand() < RAND_MAX / 2) { added[idx] = i; - printf("avl = gpr_avl_add(avl, box(%d), box(%d)); /* d=%d */\n", idx, i, - deletions); - avl = gpr_avl_add(avl, box(idx), box(i)); + printf("avl = gpr_avl_add(avl, box(%d), box(%d), NULL); /* d=%d */\n", + idx, i, deletions); + avl = gpr_avl_add(avl, box(idx), box(i), NULL); } else { deletions += (added[idx] != 0); added[idx] = 0; @@ -3634,7 +3636,7 @@ static void test_stress(int amount_of_stress) { } } - gpr_avl_unref(avl); + gpr_avl_unref(avl, NULL); } int main(int argc, char *argv[]) { diff --git a/test/core/surface/BUILD b/test/core/surface/BUILD index 2923927412..17db7737f7 100644 --- a/test/core/surface/BUILD +++ b/test/core/surface/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") licenses(["notice"]) # Apache v2 -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/surface") grpc_cc_test( name = "alarm_test", diff --git a/test/core/surface/alarm_test.c b/test/core/surface/alarm_test.c index baaa05928e..6971d92074 100644 --- a/test/core/surface/alarm_test.c +++ b/test/core/surface/alarm_test.c @@ -73,6 +73,21 @@ static void test_alarm(void) { GPR_ASSERT(ev.success == 0); grpc_alarm_destroy(alarm); } + { + /* alarm_destroy before cq_next */ + grpc_event ev; + void *tag = create_test_tag(); + grpc_alarm *alarm = + grpc_alarm_create(cc, grpc_timeout_seconds_to_deadline(2), tag); + + grpc_alarm_destroy(alarm); + ev = grpc_completion_queue_next(cc, grpc_timeout_seconds_to_deadline(1), + NULL); + GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); + GPR_ASSERT(ev.tag == tag); + GPR_ASSERT(ev.success == 0); + } + shutdown_and_destroy(cc); } diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index f9d88d6327..e6372a379c 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -144,7 +144,7 @@ static void test_cq_end_op(void) { cc = grpc_completion_queue_create( grpc_completion_queue_factory_lookup(&attr), &attr, NULL); - grpc_cq_begin_op(cc, tag); + GPR_ASSERT(grpc_cq_begin_op(cc, tag)); grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE, do_nothing_end_completion, NULL, &completion); @@ -233,7 +233,7 @@ static void test_pluck(void) { grpc_completion_queue_factory_lookup(&attr), &attr, NULL); for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { - grpc_cq_begin_op(cc, tags[i]); + GPR_ASSERT(grpc_cq_begin_op(cc, tags[i])); grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion, NULL, &completions[i]); } @@ -245,7 +245,7 @@ static void test_pluck(void) { } for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { - grpc_cq_begin_op(cc, tags[i]); + GPR_ASSERT(grpc_cq_begin_op(cc, tags[i])); grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion, NULL, &completions[i]); } diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.c index 99d0fa4980..9996b6b840 100644 --- a/test/core/surface/completion_queue_threading_test.c +++ b/test/core/surface/completion_queue_threading_test.c @@ -107,7 +107,7 @@ static void test_too_many_plucks(void) { GPR_ASSERT(ev.type == GRPC_QUEUE_TIMEOUT); for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { - grpc_cq_begin_op(cc, tags[i]); + GPR_ASSERT(grpc_cq_begin_op(cc, tags[i])); grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion, NULL, &completions[i]); } @@ -153,7 +153,7 @@ static void producer_thread(void *arg) { gpr_log(GPR_INFO, "producer %d phase 1", opt->id); for (i = 0; i < TEST_THREAD_EVENTS; i++) { - grpc_cq_begin_op(opt->cc, (void *)(intptr_t)1); + GPR_ASSERT(grpc_cq_begin_op(opt->cc, (void *)(intptr_t)1)); } gpr_log(GPR_INFO, "producer %d phase 1 done", opt->id); diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index 3b1c53390b..0d7f68c0ad 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -36,6 +36,7 @@ #include <grpc/impl/codegen/slice.h> #include <grpc/impl/codegen/status.h> #include <grpc/impl/codegen/sync.h> +#include <grpc/impl/codegen/sync_custom.h> #include <grpc/impl/codegen/sync_generic.h> #include <grpc/load_reporting.h> #include <grpc/slice.h> @@ -53,6 +54,7 @@ #include <grpc/support/string_util.h> #include <grpc/support/subprocess.h> #include <grpc/support/sync.h> +#include <grpc/support/sync_custom.h> #include <grpc/support/sync_generic.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD index 8091cf9c63..12e36132c8 100644 --- a/test/core/transport/BUILD +++ b/test/core/transport/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") licenses(["notice"]) # Apache v2 -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/transport") grpc_cc_test( name = "bdp_estimator_test", @@ -36,6 +31,18 @@ grpc_cc_test( ) grpc_cc_test( + name = "byte_stream_test", + srcs = ["byte_stream_test.c"], + language = "C", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], +) + +grpc_cc_test( name = "connectivity_state_test", srcs = ["connectivity_state_test.c"], language = "C", diff --git a/test/core/transport/bdp_estimator_test.c b/test/core/transport/bdp_estimator_test.c index e2612c7718..dda48f45b1 100644 --- a/test/core/transport/bdp_estimator_test.c +++ b/test/core/transport/bdp_estimator_test.c @@ -43,12 +43,13 @@ static void test_get_estimate_no_samples(void) { static void add_samples(grpc_bdp_estimator *estimator, int64_t *samples, size_t n) { - GPR_ASSERT(grpc_bdp_estimator_add_incoming_bytes(estimator, 1234567) == true); + grpc_bdp_estimator_add_incoming_bytes(estimator, 1234567); + GPR_ASSERT(grpc_bdp_estimator_need_ping(estimator) == true); grpc_bdp_estimator_schedule_ping(estimator); grpc_bdp_estimator_start_ping(estimator); for (size_t i = 0; i < n; i++) { - GPR_ASSERT(grpc_bdp_estimator_add_incoming_bytes(estimator, samples[i]) == - false); + grpc_bdp_estimator_add_incoming_bytes(estimator, samples[i]); + GPR_ASSERT(grpc_bdp_estimator_need_ping(estimator) == false); } gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(1, GPR_TIMESPAN))); diff --git a/test/core/transport/byte_stream_test.c b/test/core/transport/byte_stream_test.c new file mode 100644 index 0000000000..a0c5f961cf --- /dev/null +++ b/test/core/transport/byte_stream_test.c @@ -0,0 +1,279 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "src/core/lib/transport/byte_stream.h" + +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/useful.h> + +#include "src/core/lib/slice/slice_internal.h" + +#include "test/core/util/test_config.h" + +// +// grpc_slice_buffer_stream tests +// + +static void not_called_closure(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + GPR_ASSERT(false); +} + +static void test_slice_buffer_stream_basic(void) { + gpr_log(GPR_DEBUG, "test_slice_buffer_stream_basic"); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + // Create and populate slice buffer. + grpc_slice_buffer buffer; + grpc_slice_buffer_init(&buffer); + grpc_slice input[] = { + grpc_slice_from_static_string("foo"), + grpc_slice_from_static_string("bar"), + }; + for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) { + grpc_slice_buffer_add(&buffer, input[i]); + } + // Create byte stream. + grpc_slice_buffer_stream stream; + grpc_slice_buffer_stream_init(&stream, &buffer, 0); + GPR_ASSERT(stream.base.length == 6); + grpc_closure closure; + GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL, + grpc_schedule_on_exec_ctx); + // Read each slice. Note that next() always returns synchronously. + for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) { + GPR_ASSERT( + grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure)); + grpc_slice output; + grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); + GPR_ASSERT(error == GRPC_ERROR_NONE); + GPR_ASSERT(grpc_slice_eq(input[i], output)); + grpc_slice_unref_internal(&exec_ctx, output); + } + // Clean up. + grpc_byte_stream_destroy(&exec_ctx, &stream.base); + grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer); + grpc_exec_ctx_finish(&exec_ctx); +} + +static void test_slice_buffer_stream_shutdown(void) { + gpr_log(GPR_DEBUG, "test_slice_buffer_stream_shutdown"); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + // Create and populate slice buffer. + grpc_slice_buffer buffer; + grpc_slice_buffer_init(&buffer); + grpc_slice input[] = { + grpc_slice_from_static_string("foo"), + grpc_slice_from_static_string("bar"), + }; + for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) { + grpc_slice_buffer_add(&buffer, input[i]); + } + // Create byte stream. + grpc_slice_buffer_stream stream; + grpc_slice_buffer_stream_init(&stream, &buffer, 0); + GPR_ASSERT(stream.base.length == 6); + grpc_closure closure; + GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL, + grpc_schedule_on_exec_ctx); + // Read the first slice. + GPR_ASSERT( + grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure)); + grpc_slice output; + grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); + GPR_ASSERT(error == GRPC_ERROR_NONE); + GPR_ASSERT(grpc_slice_eq(input[0], output)); + grpc_slice_unref_internal(&exec_ctx, output); + // Now shutdown. + grpc_error *shutdown_error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("shutdown error"); + grpc_byte_stream_shutdown(&exec_ctx, &stream.base, + GRPC_ERROR_REF(shutdown_error)); + // After shutdown, the next pull() should return the error. + GPR_ASSERT( + grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure)); + error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); + GPR_ASSERT(error == shutdown_error); + GRPC_ERROR_UNREF(error); + GRPC_ERROR_UNREF(shutdown_error); + // Clean up. + grpc_byte_stream_destroy(&exec_ctx, &stream.base); + grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer); + grpc_exec_ctx_finish(&exec_ctx); +} + +// +// grpc_caching_byte_stream tests +// + +static void test_caching_byte_stream_basic(void) { + gpr_log(GPR_DEBUG, "test_caching_byte_stream_basic"); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + // Create and populate slice buffer byte stream. + grpc_slice_buffer buffer; + grpc_slice_buffer_init(&buffer); + grpc_slice input[] = { + grpc_slice_from_static_string("foo"), + grpc_slice_from_static_string("bar"), + }; + for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) { + grpc_slice_buffer_add(&buffer, input[i]); + } + grpc_slice_buffer_stream underlying_stream; + grpc_slice_buffer_stream_init(&underlying_stream, &buffer, 0); + // Create cache and caching stream. + grpc_byte_stream_cache cache; + grpc_byte_stream_cache_init(&cache, &underlying_stream.base); + grpc_caching_byte_stream stream; + grpc_caching_byte_stream_init(&stream, &cache); + grpc_closure closure; + GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL, + grpc_schedule_on_exec_ctx); + // Read each slice. Note that next() always returns synchronously, + // because the underlying byte stream always does. + for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) { + GPR_ASSERT( + grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure)); + grpc_slice output; + grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); + GPR_ASSERT(error == GRPC_ERROR_NONE); + GPR_ASSERT(grpc_slice_eq(input[i], output)); + grpc_slice_unref_internal(&exec_ctx, output); + } + // Clean up. + grpc_byte_stream_destroy(&exec_ctx, &stream.base); + grpc_byte_stream_cache_destroy(&exec_ctx, &cache); + grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer); + grpc_exec_ctx_finish(&exec_ctx); +} + +static void test_caching_byte_stream_reset(void) { + gpr_log(GPR_DEBUG, "test_caching_byte_stream_reset"); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + // Create and populate slice buffer byte stream. + grpc_slice_buffer buffer; + grpc_slice_buffer_init(&buffer); + grpc_slice input[] = { + grpc_slice_from_static_string("foo"), + grpc_slice_from_static_string("bar"), + }; + for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) { + grpc_slice_buffer_add(&buffer, input[i]); + } + grpc_slice_buffer_stream underlying_stream; + grpc_slice_buffer_stream_init(&underlying_stream, &buffer, 0); + // Create cache and caching stream. + grpc_byte_stream_cache cache; + grpc_byte_stream_cache_init(&cache, &underlying_stream.base); + grpc_caching_byte_stream stream; + grpc_caching_byte_stream_init(&stream, &cache); + grpc_closure closure; + GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL, + grpc_schedule_on_exec_ctx); + // Read one slice. + GPR_ASSERT( + grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure)); + grpc_slice output; + grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); + GPR_ASSERT(error == GRPC_ERROR_NONE); + GPR_ASSERT(grpc_slice_eq(input[0], output)); + grpc_slice_unref_internal(&exec_ctx, output); + // Reset the caching stream. The reads should start over from the + // first slice. + grpc_caching_byte_stream_reset(&stream); + for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) { + GPR_ASSERT( + grpc_byte_stream_next(&exec_ctx, &stream.base, ~(size_t)0, &closure)); + error = grpc_byte_stream_pull(&exec_ctx, &stream.base, &output); + GPR_ASSERT(error == GRPC_ERROR_NONE); + GPR_ASSERT(grpc_slice_eq(input[i], output)); + grpc_slice_unref_internal(&exec_ctx, output); + } + // Clean up. + grpc_byte_stream_destroy(&exec_ctx, &stream.base); + grpc_byte_stream_cache_destroy(&exec_ctx, &cache); + grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer); + grpc_exec_ctx_finish(&exec_ctx); +} + +static void test_caching_byte_stream_shared_cache(void) { + gpr_log(GPR_DEBUG, "test_caching_byte_stream_shared_cache"); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + // Create and populate slice buffer byte stream. + grpc_slice_buffer buffer; + grpc_slice_buffer_init(&buffer); + grpc_slice input[] = { + grpc_slice_from_static_string("foo"), + grpc_slice_from_static_string("bar"), + }; + for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) { + grpc_slice_buffer_add(&buffer, input[i]); + } + grpc_slice_buffer_stream underlying_stream; + grpc_slice_buffer_stream_init(&underlying_stream, &buffer, 0); + // Create cache and two caching streams. + grpc_byte_stream_cache cache; + grpc_byte_stream_cache_init(&cache, &underlying_stream.base); + grpc_caching_byte_stream stream1; + grpc_caching_byte_stream_init(&stream1, &cache); + grpc_caching_byte_stream stream2; + grpc_caching_byte_stream_init(&stream2, &cache); + grpc_closure closure; + GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL, + grpc_schedule_on_exec_ctx); + // Read one slice from stream1. + GPR_ASSERT( + grpc_byte_stream_next(&exec_ctx, &stream1.base, ~(size_t)0, &closure)); + grpc_slice output; + grpc_error *error = grpc_byte_stream_pull(&exec_ctx, &stream1.base, &output); + GPR_ASSERT(error == GRPC_ERROR_NONE); + GPR_ASSERT(grpc_slice_eq(input[0], output)); + grpc_slice_unref_internal(&exec_ctx, output); + // Read all slices from stream2. + for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) { + GPR_ASSERT( + grpc_byte_stream_next(&exec_ctx, &stream2.base, ~(size_t)0, &closure)); + error = grpc_byte_stream_pull(&exec_ctx, &stream2.base, &output); + GPR_ASSERT(error == GRPC_ERROR_NONE); + GPR_ASSERT(grpc_slice_eq(input[i], output)); + grpc_slice_unref_internal(&exec_ctx, output); + } + // Now read the second slice from stream1. + GPR_ASSERT( + grpc_byte_stream_next(&exec_ctx, &stream1.base, ~(size_t)0, &closure)); + error = grpc_byte_stream_pull(&exec_ctx, &stream1.base, &output); + GPR_ASSERT(error == GRPC_ERROR_NONE); + GPR_ASSERT(grpc_slice_eq(input[1], output)); + grpc_slice_unref_internal(&exec_ctx, output); + // Clean up. + grpc_byte_stream_destroy(&exec_ctx, &stream1.base); + grpc_byte_stream_destroy(&exec_ctx, &stream2.base); + grpc_byte_stream_cache_destroy(&exec_ctx, &cache); + grpc_slice_buffer_destroy_internal(&exec_ctx, &buffer); + grpc_exec_ctx_finish(&exec_ctx); +} + +int main(int argc, char **argv) { + grpc_test_init(argc, argv); + test_slice_buffer_stream_basic(); + test_slice_buffer_stream_shutdown(); + test_caching_byte_stream_basic(); + test_caching_byte_stream_reset(); + test_caching_byte_stream_shared_cache(); + return 0; +} diff --git a/test/core/transport/chttp2/BUILD b/test/core/transport/chttp2/BUILD index e3989f7059..6081940243 100644 --- a/test/core/transport/chttp2/BUILD +++ b/test/core/transport/chttp2/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") licenses(["notice"]) # Apache v2 -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/transport/chttp2") load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") diff --git a/test/core/tsi/BUILD b/test/core/tsi/BUILD index 3bbc50b27e..82e0e5fb80 100644 --- a/test/core/tsi/BUILD +++ b/test/core/tsi/BUILD @@ -12,16 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") licenses(["notice"]) # Apache v2 -package( - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/tsi") grpc_cc_test( name = "transport_security_test", diff --git a/test/core/util/BUILD b/test/core/util/BUILD index 9d899bc7be..10eefe159a 100644 --- a/test/core/util/BUILD +++ b/test/core/util/BUILD @@ -12,17 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package") licenses(["notice"]) # Apache v2 -package( - default_visibility = ["//visibility:public"], - features = [ - "-layering_check", - "-parse_headers", - ], -) +grpc_package(name = "test/core/util", visibility = "public") grpc_cc_library( name = "gpr_test_util", @@ -38,7 +32,7 @@ grpc_cc_library( ) grpc_cc_library( - name = "grpc_test_util", + name = "grpc_test_util_base", srcs = [ "debugger_macros.c", "grpc_profiler.c", @@ -68,11 +62,33 @@ grpc_cc_library( language = "C", deps = [ ":gpr_test_util", + "//:grpc_common", + ], +) + +grpc_cc_library( + name = "grpc_test_util", + srcs = [], + hdrs = [], + language = "C", + deps = [ + ":grpc_test_util_base", "//:grpc", ], ) grpc_cc_library( + name = "grpc_test_util_unsecure", + srcs = [], + hdrs = [], + language = "C", + deps = [ + ":grpc_test_util_base", + "//:grpc_unsecure", + ], +) + +grpc_cc_library( name = "one_corpus_entry_fuzzer", srcs = ["one_corpus_entry_fuzzer.c"], deps = [ diff --git a/test/core/util/port.c b/test/core/util/port.c index f430c543bd..b1fc722858 100644 --- a/test/core/util/port.c +++ b/test/core/util/port.c @@ -79,7 +79,7 @@ static void chose_port(int port) { chosen_ports[num_chosen_ports - 1] = port; } -int grpc_pick_unused_port(void) { +static int grpc_pick_unused_port_impl(void) { int port = grpc_pick_port_using_server(); if (port != 0) { chose_port(port); @@ -88,7 +88,7 @@ int grpc_pick_unused_port(void) { return port; } -int grpc_pick_unused_port_or_die(void) { +static int grpc_pick_unused_port_or_die_impl(void) { int port = grpc_pick_unused_port(); if (port == 0) { fprintf(stderr, @@ -101,6 +101,31 @@ int grpc_pick_unused_port_or_die(void) { return port; } -void grpc_recycle_unused_port(int port) { GPR_ASSERT(free_chosen_port(port)); } +static void grpc_recycle_unused_port_impl(int port) { + GPR_ASSERT(free_chosen_port(port)); +} + +static grpc_pick_port_functions g_pick_port_functions = { + grpc_pick_unused_port_impl, grpc_pick_unused_port_or_die_impl, + grpc_recycle_unused_port_impl}; + +int grpc_pick_unused_port(void) { + return g_pick_port_functions.pick_unused_port_fn(); +} + +int grpc_pick_unused_port_or_die(void) { + return g_pick_port_functions.pick_unused_port_or_die_fn(); +} + +void grpc_recycle_unused_port(int port) { + g_pick_port_functions.recycle_unused_port_fn(port); +} + +void grpc_set_pick_port_functions(grpc_pick_port_functions functions) { + GPR_ASSERT(functions.pick_unused_port_fn != NULL); + GPR_ASSERT(functions.pick_unused_port_or_die_fn != NULL); + GPR_ASSERT(functions.recycle_unused_port_fn != NULL); + g_pick_port_functions = functions; +} #endif /* GRPC_TEST_PICK_PORT */ diff --git a/test/core/util/port.h b/test/core/util/port.h index 154e8f830c..602099dea6 100644 --- a/test/core/util/port.h +++ b/test/core/util/port.h @@ -23,6 +23,12 @@ extern "C" { #endif +typedef struct grpc_pick_port_functions { + int (*pick_unused_port_fn)(void); + int (*pick_unused_port_or_die_fn)(void); + void (*recycle_unused_port_fn)(int port); +} grpc_pick_port_functions; + /* pick a port number that is currently unused by either tcp or udp. return 0 on failure. */ int grpc_pick_unused_port(void); @@ -36,6 +42,9 @@ int grpc_pick_unused_port_or_die(void); * ports back to the server if it is going to allocate a large number. */ void grpc_recycle_unused_port(int port); +/** Request the family of pick_port functions in \a functions be used. */ +void grpc_set_pick_port_functions(grpc_pick_port_functions functions); + #ifdef __cplusplus } #endif |