| 1 | // Copyright 2007 - 2021, Alan Antonuk and the rabbitmq-c contributors.cxx . . $ `<file>/tests/test_sasl_mechanism.c`/ |
| 2 | // SPDX-License-Identifier: mit |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | #include <stdlib.h> |
| 6 | #include <string.h> |
| 7 | |
| 8 | #include <amqp_socket.h>cxx . . $ `<file>/librabbitmq/amqp_socket.h`/ |
| 9 | |
| 10 | static void parse_successcxx . . $ parse_success(3b2792a7217f161b).(amqp_bytes_tcxx . . $ amqp_bytes_t# mechanisms, |
| 11 | amqp_sasl_method_enumcxx . . $ amqp_sasl_method_enum# method) { |
| 12 | if (!sasl_mechanism_in_listcxx . . $ sasl_mechanism_in_list(e5061403e3692f1f).(mechanisms, method)) { |
| 13 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Expected to find mechanism in list, but didn't: %s\n", |
| 14 | (char *)mechanisms.bytescxx . . $ amqp_bytes_t_#bytes.); |
| 15 | abortcxx . . $ abort(8df32a62017fbbf6).(); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | static void parse_failcxx . . $ parse_fail(3b2792a7217f161b).(amqp_bytes_tcxx . . $ amqp_bytes_t# mechanisms, amqp_sasl_method_enumcxx . . $ amqp_sasl_method_enum# method) { |
| 20 | if (sasl_mechanism_in_listcxx . . $ sasl_mechanism_in_list(e5061403e3692f1f).(mechanisms, method)) { |
| 21 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, |
| 22 | "Expected the mechanism not on the list, but it was present: %s\n", |
| 23 | (char *)mechanisms.bytescxx . . $ amqp_bytes_t_#bytes.); |
| 24 | abortcxx . . $ abort(8df32a62017fbbf6).(); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | int maincxx . . $ main(b126dc7c1de90089).(void) { |
| 29 | parse_successcxx . . $ parse_success(3b2792a7217f161b).(amqp_literal_bytescxx . . $ `include/rabbitmq-c/amqp.h:867:9`!("DIGEST-MD5 CRAM-MD5 LOGIN PLAIN"), |
| 30 | AMQP_SASL_METHOD_PLAINcxx . . $ AMQP_SASL_METHOD_PLAIN.); |
| 31 | parse_failcxx . . $ parse_fail(3b2792a7217f161b).(amqp_literal_bytescxx . . $ `include/rabbitmq-c/amqp.h:867:9`!("DIGEST-MD5 CRAM-MD5 LOGIN PLAIN"), |
| 32 | AMQP_SASL_METHOD_EXTERNALcxx . . $ AMQP_SASL_METHOD_EXTERNAL.); |
| 33 | parse_successcxx . . $ parse_success(3b2792a7217f161b).(amqp_literal_bytescxx . . $ `include/rabbitmq-c/amqp.h:867:9`!("DIGEST-MD5 CRAM-MD5 EXTERNAL"), |
| 34 | AMQP_SASL_METHOD_EXTERNALcxx . . $ AMQP_SASL_METHOD_EXTERNAL.); |
| 35 | parse_failcxx . . $ parse_fail(3b2792a7217f161b).(amqp_literal_bytescxx . . $ `include/rabbitmq-c/amqp.h:867:9`!("DIGEST-MD5 CRAM-MD5 EXTERNAL"), |
| 36 | AMQP_SASL_METHOD_PLAINcxx . . $ AMQP_SASL_METHOD_PLAIN.); |
| 37 | return 0; |
| 38 | } |