Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
coverage madness in examples
[simgrid.git] / examples / msg / pastry / pastry.c
index da3f463..131e8e7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014. The SimGrid Team.
+/* Copyright (c) 2013-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -6,7 +6,7 @@
 
 #include <stdio.h>
 #include <math.h>
-#include "msg/msg.h"
+#include "simgrid/msg.h"
 #include "xbt/log.h"
 #include "xbt/asserts.h"
 
@@ -130,7 +130,7 @@ static int shl(int a, int b) {
 }
 
 /*
- * Get the cloest id to the dest in the node namespace_set
+ * Get the closest id to the dest in the node namespace_set
  */
 static int closest_in_namespace_set(node_t node, int dest) {
   int best_dist;
@@ -423,7 +423,7 @@ static int join(node_t node){
 }
 
 /*
- * Print the node infomations
+ * Print the node infomation
  */
 static void print_node(node_t node) {
   printf("Node:\n");
@@ -613,11 +613,10 @@ static int node(int argc, char *argv[])
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n", argv[0]);
-    printf("example: %s ../msg_platform.xml chord.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, 
+            "Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n"
+            "\tExample: %s ../msg_platform.xml pastry10.xml\n", 
+            argv[0], argv[0]);
   
   char **options = &argv[1];
   while (!strncmp(options[0], "-", 1)) {
@@ -653,9 +652,5 @@ int main(int argc, char *argv[])
   XBT_CRITICAL("Messages created: %ld", smx_total_comms);
   XBT_INFO("Simulated time: %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-
+  return res != MSG_OK;
 }