Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to fix the build on centos
[simgrid.git] / src / surf / trace_mgr_test.cpp
index 24e202c..3b64866 100644 (file)
@@ -1,14 +1,15 @@
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved.               */
+/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved.               */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #define BOOST_TEST_MODULE Trace Manager tests
-bool init_unit_test(); // boost forget to give this prototype on NetBSD, which does not fit our paranoid flags
+bool init_unit_test(); // boost sometimes forget to give this prototype (NetBSD and other), which does not fit our paranoid flags
 #define BOOST_TEST_DYN_LINK
 #define BOOST_TEST_NO_MAIN
 #include <boost/test/unit_test.hpp>
 
+#include "simgrid/kernel/resource/Resource.hpp"
 #include "src/surf/surf_interface.hpp"
 #include "src/surf/trace_mgr.hpp"
 
@@ -23,15 +24,15 @@ namespace tmgr = simgrid::trace_mgr;
 XBT_LOG_NEW_DEFAULT_CATEGORY(unit, "Unit tests of the Trace Manager");
 
 double thedate;
-class MockedResource : public simgrid::surf::Resource {
+class MockedResource : public simgrid::kernel::resource::Resource {
 public:
-  explicit MockedResource() : simgrid::surf::Resource(nullptr, "fake", nullptr) {}
-  void apply_event(tmgr_trace_event_t event, double value)
+  explicit MockedResource() : simgrid::kernel::resource::Resource(nullptr, "fake", nullptr) {}
+  void apply_event(tmgr_trace_event_t event, double value) override
   {
     XBT_VERB("t=%.1f: Change value to %lg (idx: %u)", thedate, value, event->idx);
     tmgr_trace_event_unref(&event);
   }
-  bool isUsed() { return true; }
+  bool is_used() override { return true; }
 };
 
 static void trace2vector(const char* str, std::vector<tmgr::DatedValue>* whereto)
@@ -39,7 +40,7 @@ static void trace2vector(const char* str, std::vector<tmgr::DatedValue>* whereto
   simgrid::trace_mgr::trace* trace = tmgr_trace_new_from_string("TheName", str, 0);
   XBT_VERB("---------------------------------------------------------");
   XBT_VERB("data>>\n%s<<data\n", str);
-  for (auto evt : trace->event_list)
+  for (auto const& evt : trace->event_list)
     XBT_VERB("event: d:%lg v:%lg", evt.date_, evt.value_);
 
   MockedResource daResource;
@@ -49,7 +50,7 @@ static void trace2vector(const char* str, std::vector<tmgr::DatedValue>* whereto
   while (fes.next_date() <= 20.0 && fes.next_date() >= 0) {
     thedate = fes.next_date();
     double value;
-    simgrid::surf::Resource* res;
+    simgrid::kernel::resource::Resource* res;
     tmgr_trace_event_t it = fes.pop_leq(thedate, &value, &res);
     if (it == nullptr)
       continue;
@@ -157,7 +158,6 @@ static bool init_function()
 
 int main(int argc, char** argv)
 {
-  XBT_LOG_CONNECT(unit);
   xbt_log_init(&argc, argv);
   return ::boost::unit_test::unit_test_main(&init_function, argc, argv);
 }