File: test_status_enum.c

package info (click to toggle)
librabbitmq 0.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,080 kB
  • sloc: ansic: 11,497; xml: 747; python: 532; sh: 84; makefile: 5
file content (31 lines) | stat: -rw-r--r-- 805 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2007 - 2021, Alan Antonuk and the rabbitmq-c contributors.
// SPDX-License-Identifier: mit

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <rabbitmq-c/amqp.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static void check_errorstrings(amqp_status_enum start, amqp_status_enum end) {
  int i;
  for (i = start; i > end; --i) {
    const char* err = amqp_error_string2(i);
    if (0 == strcmp(err, "(unknown error)")) {
      printf("amqp_status_enum value %s%X", i < 0 ? "-" : "", (unsigned)i);
      abort();
    }
  }
}

int main(void) {
  check_errorstrings(AMQP_STATUS_OK, _AMQP_STATUS_NEXT_VALUE);
  check_errorstrings(AMQP_STATUS_TCP_ERROR, _AMQP_STATUS_TCP_NEXT_VALUE);
  check_errorstrings(AMQP_STATUS_SSL_ERROR, _AMQP_STATUS_SSL_NEXT_VALUE);

  return 0;
}