Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
speeling mistakes in teshsuite (even mpich tests because why not)
[simgrid.git] / teshsuite / smpi / mpich3-test / info / infodup.c
index b89d020..cbce96b 100644 (file)
@@ -13,7 +13,7 @@
 #include <string.h>
 #endif
 
-int main( int argc, char *argv[] )
+int main(int argc, char *argv[])
 {
     int errs = 0;
     MPI_Info info1, infodup;
@@ -21,62 +21,61 @@ int main( int argc, char *argv[] )
     char key[MPI_MAX_INFO_KEY], keydup[MPI_MAX_INFO_KEY];
     char value[MPI_MAX_INFO_VAL], valdup[MPI_MAX_INFO_VAL];
 
-    MTest_Init( &argc, &argv );
+    MTest_Init(&argc, &argv);
 
-    MPI_Info_create( &info1 );
-    /* Use only named keys incase the info implementation only supports
-       the predefined keys (e.g., IBM) */
-    MPI_Info_set( info1, (char*)"host", (char*)"myhost.myorg.org" );
-    MPI_Info_set( info1, (char*)"file", (char*)"runfile.txt" );
-    MPI_Info_set( info1, (char*)"soft", (char*)"2:1000:4,3:1000:7" );
+    MPI_Info_create(&info1);
+    /* Use only named keys in case the info implementation only supports
+     * the predefined keys (e.g., IBM) */
+    MPI_Info_set(info1, (char *) "host", (char *) "myhost.myorg.org");
+    MPI_Info_set(info1, (char *) "file", (char *) "runfile.txt");
+    MPI_Info_set(info1, (char *) "soft", (char *) "2:1000:4,3:1000:7");
 
-    MPI_Info_dup( info1, &infodup );
+    MPI_Info_dup(info1, &infodup);
 
-    MPI_Info_get_nkeys( infodup, &nkeysdup );
-    MPI_Info_get_nkeys( info1, &nkeys );
+    MPI_Info_get_nkeys(infodup, &nkeysdup);
+    MPI_Info_get_nkeys(info1, &nkeys);
     if (nkeys != nkeysdup) {
-       errs++;
-       printf( "Dup'ed info has a different number of keys; is %d should be %d\n",
-               nkeysdup, nkeys );
+        errs++;
+        printf("Dup'ed info has a different number of keys; is %d should be %d\n", nkeysdup, nkeys);
     }
     vallen = MPI_MAX_INFO_VAL;
-    for (i=0; i<nkeys; i++) {
-       /* MPI requires that the keys are in the same order after the dup */
-       MPI_Info_get_nthkey( info1, i, key );
-       MPI_Info_get_nthkey( infodup, i, keydup );
-       if (strcmp(key, keydup)) {
-           errs++;
-           printf( "keys do not match: %s should be %s\n", keydup, key );
-       }
+    for (i = 0; i < nkeys; i++) {
+        /* MPI requires that the keys are in the same order after the dup */
+        MPI_Info_get_nthkey(info1, i, key);
+        MPI_Info_get_nthkey(infodup, i, keydup);
+        if (strcmp(key, keydup)) {
+            errs++;
+            printf("keys do not match: %s should be %s\n", keydup, key);
+        }
 
-       vallen = MPI_MAX_INFO_VAL;
-       MPI_Info_get( info1, key, vallen, value, &flag );
-       MPI_Info_get( infodup, keydup, vallen, valdup, &flagdup );
-       if (!flag || !flagdup) {
-           errs++;
-           printf( "Info get failed for key %s\n", key );
-       }
-       else if (strcmp( value, valdup )) {
-           errs++;
-           printf( "Info values for key %s not the same after dup\n", key );
-       }
+        vallen = MPI_MAX_INFO_VAL;
+        MPI_Info_get(info1, key, vallen, value, &flag);
+        MPI_Info_get(infodup, keydup, vallen, valdup, &flagdup);
+        if (!flag || !flagdup) {
+            errs++;
+            printf("Info get failed for key %s\n", key);
+        }
+        else if (strcmp(value, valdup)) {
+            errs++;
+            printf("Info values for key %s not the same after dup\n", key);
+        }
     }
 
-    /* Change info and check that infodup does NOT have the new value 
-       (ensure that lazy dups are still duped) */
-    MPI_Info_set( info1, (char*)"path", (char*)"/a:/b:/c/d" );
+    /* Change info and check that infodup does NOT have the new value
+     * (ensure that lazy dups are still duped) */
+    MPI_Info_set(info1, (char *) "path", (char *) "/a:/b:/c/d");
 
-    MPI_Info_get( infodup, (char*)"path", vallen, value, &flag );
+    MPI_Info_get(infodup, (char *) "path", vallen, value, &flag);
     if (flag) {
-       errs++;
-       printf( "inserting path into info changed infodup\n" );
+        errs++;
+        printf("inserting path into info changed infodup\n");
     }
-    
-    MPI_Info_free( &info1 );
-    MPI_Info_free( &infodup );
-    
-    MTest_Finalize( errs );
+
+    MPI_Info_free(&info1);
+    MPI_Info_free(&infodup);
+
+    MTest_Finalize(errs);
     MPI_Finalize();
     return 0;
-  
+
 }