1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2003 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
11 #include "mpitestconf.h"
16 /* Create NCLASSES new classes, each with 5 codes (160 total) */
20 int main(int argc, char *argv[])
23 char string[MPI_MAX_ERROR_STRING], outstring[MPI_MAX_ERROR_STRING];
24 int newclass[NCLASSES], newcode[NCLASSES][NCODES];
25 int i, j, slen, outclass;
27 MTest_Init(&argc, &argv);
29 /* Initialize the new codes */
30 for (i = 0; i < NCLASSES; i++) {
31 MPI_Add_error_class(&newclass[i]);
32 for (j = 0; j < NCODES; j++) {
33 MPI_Add_error_code(newclass[i], &newcode[i][j]);
34 sprintf(string, "code for class %d code %d\n", i, j);
35 MPI_Add_error_string(newcode[i][j], string);
39 /* check the values */
40 for (i = 0; i < NCLASSES; i++) {
41 MPI_Error_class(newclass[i], &outclass);
42 if (outclass != newclass[i]) {
44 printf("Error class %d is not a valid error code %d %d\n", i, outclass, newclass[i]);
46 for (j = 0; j < NCODES; j++) {
47 MPI_Error_class(newcode[i][j], &outclass);
48 if (outclass != newclass[i]) {
50 printf("Class of code for %d is not correct %d %d\n", j, outclass, newclass[i]);
52 MPI_Error_string(newcode[i][j], outstring, &slen);
53 sprintf(string, "code for class %d code %d\n", i, j);
54 if (strcmp(outstring, string)) {
56 printf("Error string is :%s: but should be :%s:\n", outstring, string);
62 return MTestReturnValue(errs);