Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change argument testing method (100% coverage)
[simgrid.git] / examples / simdag / dax / dax_test.c
index 92b035d..934d812 100644 (file)
@@ -35,25 +35,17 @@ int main(int argc, char **argv)
   SD_init(&argc, argv);
 
   /* Check our arguments */
-  if (argc < 3) {
-    XBT_INFO("Usage: %s platform_file dax_file [trace_file]", argv[0]);
-    XBT_INFO
-        ("example: %s ../sd_platform.xml Montage_50.xml Montage_50.mytrace",
-         argv[0]);
-    exit(1);
-  }
-  char *tracefilename;
-  if (argc == 3) {
-    char *last = strrchr(argv[2], '.');
-
-    tracefilename =
-        bprintf("%.*s.trace",
-                (int) (last == NULL ? strlen(argv[2]) : last - argv[2]),
-                argv[2]);
-  } else {
+  xbt_assert(argc > 2, "Usage: %s platform_file dax_file [jedule_file]\n"
+            "\tExample: %s simulacrum_7_hosts.xml Montage_25.xml Montage_25.jed", 
+            argv[0], argv[0]);
+
+  char *last = strrchr(argv[2], '.');
+  char * tracefilename = bprintf("%.*s.trace",(int) (last == NULL ? 
+                                                  strlen(argv[2]) : 
+                                                  last - argv[2]), argv[2]);  
+  if (argc == 4)
     tracefilename = xbt_strdup(argv[3]);
-  }
-
   /* creation of the environment */
   SD_create_environment(argv[1]);