Debian Codegraph @

tests/test_status_enum.c

raw symbols SCIP
1 // Copyright 2007 - 2021, Alan Antonuk and the rabbitmq-c contributors.
2 // SPDX-License-Identifier: mit
3
4 #ifdef HAVE_CONFIG_H
5 #include "config.h"
6 #endif
7
8 #include <rabbitmq-c/amqp.h>
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13
14 static void check_errorstrings(amqp_status_enum start, amqp_status_enum end) {
15 int i;
16 for (i = start; i > end; --i) {
17 const char* err = amqp_error_string2(i);
18 if (0 == strcmp(err, "(unknown error)")) {
19 printf("amqp_status_enum value %s%X", i < 0 ? "-" : "", (unsigned)i);
20 abort();
21 }
22 }
23 }
24
25 int main(void) {
26 check_errorstrings(AMQP_STATUS_OK, _AMQP_STATUS_NEXT_VALUE);
27 check_errorstrings(AMQP_STATUS_TCP_ERROR, _AMQP_STATUS_TCP_NEXT_VALUE);
28 check_errorstrings(AMQP_STATUS_SSL_ERROR, _AMQP_STATUS_SSL_NEXT_VALUE);
29
30 return 0;
31 }