Debian Codegraph @

tests/test_tune_connection.c

raw symbols SCIP
1 // Copyright 2007 - 2021, Alan Antonuk and the rabbitmq-c contributors.cxx . . $ `<file>/tests/test_tune_connection.c`/
2 // SPDX-License-Identifier: mit
3
4 #include "amqp_private.h"cxx . . $ `<file>/librabbitmq/amqp_private.h`/
5 #include <rabbitmq-c/amqp.h>cxx . . $ `<file>/include/rabbitmq-c/amqp.h`/
6 #include <rabbitmq-c/framing.h>cxx . . $ `<file>/include/rabbitmq-c/framing.h`/
7
8 #include <stdio.h>
9 #include <stdlib.h>
10
11 static void expect_frame_maxcxx . . $ expect_frame_max(3e454b8ccf442868).(int requested, int expected) {
12 int res;
13 amqp_connection_state_tcxx . . $ amqp_connection_state_t# state = amqp_new_connectioncxx . . $ amqp_new_connection(79af3635f28998e8).();
14
15 if (state == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
16 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "amqp_new_connection failed\n");
17 abortcxx . . $ abort(8df32a62017fbbf6).();
18 }
19
20 state->statecxx . . $ amqp_connection_state_t_#state. = CONNECTION_STATE_IDLEcxx . . $ CONNECTION_STATE_IDLE.;
21
22 res = amqp_tune_connectioncxx . . $ amqp_tune_connection(1dfc68dc147d344d).(state, 0, requested, 0);
23 if (res != AMQP_STATUS_OKcxx . . $ AMQP_STATUS_OK.) {
24 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "amqp_tune_connection returned %d\n", res);
25 abortcxx . . $ abort(8df32a62017fbbf6).();
26 }
27
28 if (amqp_get_frame_maxcxx . . $ amqp_get_frame_max(6448aa3e62633771).(state) != expected) {
29 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "expected frame_max %d, got %d\n", expected,
30 amqp_get_frame_maxcxx . . $ amqp_get_frame_max(6448aa3e62633771).(state));
31 abortcxx . . $ abort(8df32a62017fbbf6).();
32 }
33
34 if (state->outbound_buffercxx . . $ amqp_connection_state_t_#outbound_buffer..lencxx . . $ amqp_bytes_t_#len. != (size_t)expected) {
35 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "expected outbound buffer length %d, got %zu\n", expected,
36 state->outbound_buffercxx . . $ amqp_connection_state_t_#outbound_buffer..lencxx . . $ amqp_bytes_t_#len.);
37 abortcxx . . $ abort(8df32a62017fbbf6).();
38 }
39
40 amqp_destroy_connectioncxx . . $ amqp_destroy_connection(6448aa3e62633771).(state);
41 }
42
43 int maincxx . . $ main(b126dc7c1de90089).(void) {
44 expect_frame_maxcxx . . $ expect_frame_max(3e454b8ccf442868).(0, AMQP_FRAME_MIN_SIZEcxx . . $ `include/rabbitmq-c/framing.h:24:9`!);
45 expect_frame_maxcxx . . $ expect_frame_max(3e454b8ccf442868).(1, AMQP_FRAME_MIN_SIZEcxx . . $ `include/rabbitmq-c/framing.h:24:9`!);
46 expect_frame_maxcxx . . $ expect_frame_max(3e454b8ccf442868).(AMQP_FRAME_MIN_SIZEcxx . . $ `include/rabbitmq-c/framing.h:24:9`! - 1, AMQP_FRAME_MIN_SIZEcxx . . $ `include/rabbitmq-c/framing.h:24:9`!);
47 expect_frame_maxcxx . . $ expect_frame_max(3e454b8ccf442868).(AMQP_FRAME_MIN_SIZEcxx . . $ `include/rabbitmq-c/framing.h:24:9`!, AMQP_FRAME_MIN_SIZEcxx . . $ `include/rabbitmq-c/framing.h:24:9`!);
48 expect_frame_maxcxx . . $ expect_frame_max(3e454b8ccf442868).(AMQP_DEFAULT_FRAME_SIZEcxx . . $ `include/rabbitmq-c/amqp.h:225:9`!, AMQP_DEFAULT_FRAME_SIZEcxx . . $ `include/rabbitmq-c/amqp.h:225:9`!);
49
50 return 0;
51 }