1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2001 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
9 #include "mpitestconf.h"
14 static int verbose = 0;
17 int blockindexed_test(void);
19 /* helper functions */
20 int parse_args(int argc, char **argv);
22 int main(int argc, char **argv)
26 MPI_Init(&argc, &argv); /* MPI-1.2 doesn't allow for MPI_Init(0,0) */
27 parse_args(argc, argv);
29 /* To improve reporting of problems about operations, we
30 change the error handler to errors return */
31 MPI_Comm_set_errhandler( MPI_COMM_WORLD, MPI_ERRORS_RETURN );
33 /* perform some tests */
34 err = blockindexed_test();
35 if (err && verbose) fprintf(stderr, "%d errors in blockindexed test.\n",
39 /* print message and exit */
41 fprintf(stderr, "Found %d errors\n", errs);
44 printf(" No Errors\n");
50 /* blockindexed_test()
52 * Tests behavior with a zero-count blockindexed.
54 * Returns the number of errors encountered.
56 int blockindexed_test(void)
66 err = MPI_Type_create_indexed_block(count,
71 if (err != MPI_SUCCESS) {
74 "error creating struct type in blockindexed_test()\n");
79 err = MPI_Type_size(newtype, &size);
80 if (err != MPI_SUCCESS) {
83 "error obtaining type size in blockindexed_test()\n");
91 "error: size != 0 in blockindexed_test()\n");
96 err = MPI_Type_extent(newtype, &extent);
97 if (err != MPI_SUCCESS) {
100 "error obtaining type extent in blockindexed_test()\n");
108 "error: extent != 0 in blockindexed_test()\n");
113 MPI_Type_free( &newtype );
119 int parse_args(int argc, char **argv)
124 while ((ret = getopt(argc, argv, "v")) >= 0)
133 if (argc > 1 && strcmp(argv[1], "-v") == 0)