Blame tests/test_status_enum.c

Packit 12c978
/*
Packit 12c978
 * Copyright 2015 Alan Antonuk
Packit 12c978
 *
Packit 12c978
 * Permission is hereby granted, free of charge, to any person
Packit 12c978
 * obtaining a copy of this software and associated documentation
Packit 12c978
 * files (the "Software"), to deal in the Software without
Packit 12c978
 * restriction, including without limitation the rights to use, copy,
Packit 12c978
 * modify, merge, publish, distribute, sublicense, and/or sell copies
Packit 12c978
 * of the Software, and to permit persons to whom the Software is
Packit 12c978
 * furnished to do so, subject to the following conditions:
Packit 12c978
 *
Packit 12c978
 * The above copyright notice and this permission notice shall be
Packit 12c978
 * included in all copies or substantial portions of the Software.
Packit 12c978
 *
Packit 12c978
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Packit 12c978
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 12c978
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Packit 12c978
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
Packit 12c978
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
Packit 12c978
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Packit 12c978
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Packit 12c978
 * SOFTWARE.
Packit 12c978
 */
Packit 12c978
Packit 12c978
#ifdef HAVE_CONFIG_H
Packit 12c978
#include "config.h"
Packit 12c978
#endif
Packit 12c978
Packit 12c978
#include "amqp.h"
Packit 12c978
Packit 12c978
#include <stdio.h>
Packit 12c978
#include <stdlib.h>
Packit 12c978
#include <string.h>
Packit 12c978
Packit 12c978
static void check_errorstrings(amqp_status_enum start, amqp_status_enum end) {
Packit 12c978
  int i;
Packit 12c978
  for (i = start; i > end; --i) {
Packit 12c978
    const char* err = amqp_error_string2(i);
Packit 12c978
    if (0 == strcmp(err, "(unknown error)")) {
Packit 12c978
      printf("amqp_status_enum value %s%X", i < 0 ? "-" : "", (unsigned)i);
Packit 12c978
      abort();
Packit 12c978
    }
Packit 12c978
  }
Packit 12c978
}
Packit 12c978
Packit 12c978
int main(void) {
Packit 12c978
  check_errorstrings(AMQP_STATUS_OK, _AMQP_STATUS_NEXT_VALUE);
Packit 12c978
  check_errorstrings(AMQP_STATUS_TCP_ERROR, _AMQP_STATUS_TCP_NEXT_VALUE);
Packit 12c978
  check_errorstrings(AMQP_STATUS_SSL_ERROR, _AMQP_STATUS_SSL_NEXT_VALUE);
Packit 12c978
Packit 12c978
  return 0;
Packit 12c978
}