Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Factor common code.
[simgrid.git] / src / kernel / routing / DragonflyZone_test.cpp
index 02a2a96..f90dd3d 100644 (file)
@@ -5,25 +5,14 @@
 
 #include "catch.hpp"
 
+#include "NetZone_test.hpp" // CreateHost callback
 #include "simgrid/kernel/routing/DragonflyZone.hpp"
-#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
-#include "simgrid/s4u/Host.hpp"
-#include "simgrid/s4u/NetZone.hpp"
-
-namespace {
-std::pair<simgrid::kernel::routing::NetPoint*, simgrid::kernel::routing::NetPoint*>
-create_host(simgrid::s4u::NetZone* zone, const std::vector<unsigned int>& /*coord*/, int id)
-{
-  const simgrid::s4u::Host* host = zone->create_host(std::to_string(id), 1e9)->seal();
-  return std::make_pair(host->get_netpoint(), nullptr);
-}
-} // namespace
 
 TEST_CASE("kernel::routing::DragonflyZone: Creating Zone", "")
 {
   simgrid::s4u::Engine e("test");
-  simgrid::s4u::ClusterCallbacks callbacks(create_host);
+  simgrid::s4u::ClusterCallbacks callbacks(CreateHost{});
   REQUIRE(create_dragonfly_zone("test", e.get_netzone_root(), {{3, 4}, {4, 3}, {5, 1}, 2}, callbacks, 1e9, 10,
                                 simgrid::s4u::Link::SharingPolicy::SHARED));
 }
@@ -31,7 +20,7 @@ TEST_CASE("kernel::routing::DragonflyZone: Creating Zone", "")
 TEST_CASE("kernel::routing::DragonflyZone: Invalid params", "")
 {
   simgrid::s4u::Engine e("test");
-  simgrid::s4u::ClusterCallbacks callbacks(create_host);
+  simgrid::s4u::ClusterCallbacks callbacks(CreateHost{});
 
   SECTION("0 nodes")
   {