-/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2023. 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. */
-#include "activity-lifecycle.hpp"
+#include "teshsuite/catch_simgrid.hpp"
//========== Creators: create an async activity
const double timeout = simgrid::s4u::Engine::get_clock() + duration;
bool ret;
try {
- std::vector<Activity> activities = {activity};
+ simgrid::s4u::ActivitySet set;
+ set.push(activity);
+
XBT_DEBUG("calling wait_any_for(%f)", duration);
- ssize_t index = Activity::element_type::wait_any_for(activities, duration);
- if (index == -1) {
- XBT_DEBUG("wait_any_for() timed out");
- INFO("wait_any_for() timeout should expire at expected date: " << timeout);
- REQUIRE(simgrid::s4u::Engine::get_clock() == Approx(timeout));
- ret = false;
- } else {
- XBT_DEBUG("wait_any_for() returned index %zd", index);
- REQUIRE(index == 0);
- ret = true;
- }
+ auto waited_activity = set.wait_any_for(duration);
+
+ XBT_DEBUG("wait_any_for() returned activity %p", waited_activity.get());
+ REQUIRE(waited_activity.get() == activity);
+ ret = true;
+
+ } catch (const simgrid::TimeoutException& e) {
+ XBT_DEBUG("wait_any_for() timed out");
+ INFO("wait_any_for() timeout should expire at expected date: " << timeout);
+ REQUIRE(simgrid::s4u::Engine::get_clock() == Approx(timeout));
+ ret = false;
} catch (const simgrid::Exception& e) {
XBT_DEBUG("wait_any_for() threw an exception: %s", e.what());
ret = true;