Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Sonar variety
[simgrid.git] / src / kernel / routing / TorusZone_test.cpp
index 4bc09ca..a33a15c 100644 (file)
 #include "simgrid/s4u/NetZone.hpp"
 
 namespace {
-class EngineWrapper {
-public:
-  explicit EngineWrapper(std::string name) : argv(&name[0]), e(&argc, &argv) {}
-  int argc = 1;
-  char* argv;
-  simgrid::s4u::Engine e;
-};
-
 std::pair<simgrid::kernel::routing::NetPoint*, simgrid::kernel::routing::NetPoint*>
 create_host(simgrid::s4u::NetZone* zone, const std::vector<unsigned int>& /*coord*/, int id)
 {
@@ -30,39 +22,39 @@ create_host(simgrid::s4u::NetZone* zone, const std::vector<unsigned int>& /*coor
 
 TEST_CASE("kernel::routing::TorusZone: Creating Zone", "")
 {
-  using namespace simgrid::s4u;
-  EngineWrapper e("test");
-  REQUIRE(create_torus_zone("test", e.e.get_netzone_root(), {3, 3, 3}, 1e9, 10,
-                            simgrid::s4u::Link::SharingPolicy::SHARED, create_host));
+  simgrid::s4u::Engine e("test");
+  simgrid::s4u::ClusterCallbacks callbacks(create_host);
+  REQUIRE(create_torus_zone("test", e.get_netzone_root(), {3, 3, 3}, callbacks, 1e9, 10,
+                            simgrid::s4u::Link::SharingPolicy::SHARED));
 }
 
 TEST_CASE("kernel::routing::TorusZone: Invalid params", "")
 {
-  using namespace simgrid::s4u;
-  EngineWrapper e("test");
+  simgrid::s4u::Engine e("test");
+  simgrid::s4u::ClusterCallbacks callbacks(create_host);
 
   SECTION("Empty dimensions")
   {
-    REQUIRE_THROWS_AS(create_torus_zone("test", e.e.get_netzone_root(), {}, 1e9, 10,
-                                        simgrid::s4u::Link::SharingPolicy::SHARED, create_host),
+    REQUIRE_THROWS_AS(create_torus_zone("test", e.get_netzone_root(), {}, callbacks, 1e9, 10,
+                                        simgrid::s4u::Link::SharingPolicy::SHARED),
                       std::invalid_argument);
   }
   SECTION("One 0 dimension")
   {
-    REQUIRE_THROWS_AS(create_torus_zone("test", e.e.get_netzone_root(), {3, 0, 2}, 1e9, 10,
-                                        simgrid::s4u::Link::SharingPolicy::SHARED, create_host),
+    REQUIRE_THROWS_AS(create_torus_zone("test", e.get_netzone_root(), {3, 0, 2}, callbacks, 1e9, 10,
+                                        simgrid::s4u::Link::SharingPolicy::SHARED),
                       std::invalid_argument);
   }
   SECTION("Invalid bandwidth")
   {
-    REQUIRE_THROWS_AS(create_torus_zone("test", e.e.get_netzone_root(), {3, 2, 2}, 0, 10,
-                                        simgrid::s4u::Link::SharingPolicy::SHARED, create_host),
+    REQUIRE_THROWS_AS(create_torus_zone("test", e.get_netzone_root(), {3, 2, 2}, callbacks, 0, 10,
+                                        simgrid::s4u::Link::SharingPolicy::SHARED),
                       std::invalid_argument);
   }
   SECTION("Invalid latency")
   {
-    REQUIRE_THROWS_AS(create_torus_zone("test", e.e.get_netzone_root(), {3, 2, 2}, 1e9, -10,
-                                        simgrid::s4u::Link::SharingPolicy::SHARED, create_host),
+    REQUIRE_THROWS_AS(create_torus_zone("test", e.get_netzone_root(), {3, 2, 2}, callbacks, 1e9, -10,
+                                        simgrid::s4u::Link::SharingPolicy::SHARED),
                       std::invalid_argument);
   }
-}
\ No newline at end of file
+}