Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / teshsuite / smpi / mpich3-test / info / infoget.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *  (C) 2001 by Argonne National Laboratory.
4  *      See COPYRIGHT in top-level directory.
5  */
6
7 /* Test code provided by Hajime Fujita. See Trac ticket #2225. */
8
9 #include "mpi.h"
10 #include <stdio.h>
11 #include "mpitest.h"
12 #include <string.h>
13
14 int main(int argc, char *argv[])
15 {
16     MPI_Info info;
17     const char *key = "key", *val = "val";
18     char buff[3 + 1];           /* strlen("val") + 1 */
19     int flag, errs = 0;
20
21     MTest_Init(&argc, &argv);
22
23     MPI_Info_create(&info);
24     MPI_Info_set(info, (char*)key, (char*)val);
25     MPI_Info_get(info, (char*)key, sizeof(buff) - 1, buff, &flag);
26     if (flag) {
27         if (strncmp(buff, val, sizeof(buff) - 1) != 0) {
28             errs++;
29             printf("returned value is %s, should be %s\n", buff, val);
30         }
31     }
32     else {
33         errs++;
34         printf("key not found\n");
35     }
36     MPI_Info_free(&info);
37
38     MTest_Finalize(errs);
39     MPI_Finalize();
40
41     return 0;
42 }