Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix the last test after the recent change in MSG_hosts_as_dynar order
[simgrid.git] / examples / simdag / test / sd_test.cpp
index 73a4e74..8be5be9 100644 (file)
@@ -9,15 +9,12 @@
 #include <xbt/ex.hpp>
 #include "xbt/log.h"
 #include <math.h>
+#include <set>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test, "Logging specific to this SimDag example");
 
 int main(int argc, char **argv)
 {
-  unsigned int ctr;
-  SD_task_t checkB;
-  SD_task_t checkD;
-  xbt_dynar_t changed_tasks;
   sg_host_t host_list[2];
   double computation_amount[2];
   double communication_amount[4] = { 0 };
@@ -30,8 +27,8 @@ int main(int argc, char **argv)
 
   /* test the estimation functions */
   const sg_host_t *hosts = sg_host_list();
-  sg_host_t h1 = hosts[0];
-  sg_host_t h2 = hosts[1];
+  sg_host_t h1           = hosts[4];
+  sg_host_t h2           = hosts[2];
   const char *name1 = sg_host_get_name(h1);
   const char *name2 = sg_host_get_name(h2);
   double comp_amount1 = 2000000;
@@ -129,17 +126,12 @@ int main(int argc, char **argv)
   SD_task_schedule(taskC, 2, host_list, computation_amount, communication_amount, -1);
   SD_task_schedule(taskD, 2, host_list, computation_amount, communication_amount, -1);
 
-  changed_tasks = SD_simulate(-1.0);
-  xbt_dynar_foreach(changed_tasks, ctr, task) {
+  std::set<SD_task_t> *changed_tasks = simgrid::sd::simulate(-1.0);
+  for (auto task: *changed_tasks){
     XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task),
           SD_task_get_start_time(task), SD_task_get_finish_time(task));
   }
 
-  xbt_dynar_get_cpy(changed_tasks, 0, &checkD);
-  xbt_dynar_get_cpy(changed_tasks, 1, &checkB);
-
-  xbt_assert(checkD == taskD && checkB == taskB, "Unexpected simulation results");
-
   XBT_DEBUG("Destroying tasks...");
   SD_task_destroy(taskA);
   SD_task_destroy(taskB);