X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/672e33e4ec04de8fa4f69d453cf97de31478e721..7981fe568ccfcc3c517bd73ac146d2b59fa85ea2:/src/surf/trace_mgr_test.cpp diff --git a/src/surf/trace_mgr_test.cpp b/src/surf/trace_mgr_test.cpp index bc2d47cf96..d8bc1c94c0 100644 --- a/src/surf/trace_mgr_test.cpp +++ b/src/surf/trace_mgr_test.cpp @@ -1,4 +1,4 @@ -/* 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. */ @@ -9,13 +9,14 @@ bool init_unit_test(); // boost forget to give this prototype on NetBSD, which d #define BOOST_TEST_NO_MAIN #include +#include "src/kernel/model/Resource.hpp" #include "src/surf/surf_interface.hpp" #include "src/surf/trace_mgr.hpp" #include "xbt/log.h" #include "xbt/misc.h" -#include +#include namespace utf = boost::unit_test; namespace tmgr = simgrid::trace_mgr; @@ -23,12 +24,12 @@ 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::model::Resource { public: - explicit MockedResource() : simgrid::surf::Resource(nullptr, "fake", nullptr) {} + explicit MockedResource() : simgrid::kernel::model::Resource(nullptr, "fake", nullptr) {} void apply_event(tmgr_trace_event_t event, double value) { - XBT_VERB("t=%.1f: Change value to %lg (idx: %d)", thedate, value, event->idx); + XBT_VERB("t=%.1f: Change value to %lg (idx: %u)", thedate, value, event->idx); tmgr_trace_event_unref(&event); } bool isUsed() { return true; } @@ -39,7 +40,7 @@ static void trace2vector(const char* str, std::vector* whereto simgrid::trace_mgr::trace* trace = tmgr_trace_new_from_string("TheName", str, 0); XBT_VERB("---------------------------------------------------------"); XBT_VERB("data>>\n%s<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* whereto while (fes.next_date() <= 20.0 && fes.next_date() >= 0) { thedate = fes.next_date(); double value; - simgrid::surf::Resource* res; + simgrid::kernel::model::Resource* res; tmgr_trace_event_t it = fes.pop_leq(thedate, &value, &res); if (it == nullptr) continue; @@ -59,7 +60,7 @@ static void trace2vector(const char* str, std::vector* whereto res->apply_event(it, value); whereto->push_back(tmgr::DatedValue(thedate, value)); } else { - XBT_DEBUG("%.1f: ignore an event (idx: %d)\n", thedate, it->idx); + XBT_DEBUG("%.1f: ignore an event (idx: %u)\n", thedate, it->idx); } } tmgr_finalize(); @@ -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); }