Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Ensure that the expected RNG (xbt) is used for unit-tests.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 23 Oct 2020 11:58:15 +0000 (13:58 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 23 Oct 2020 12:00:55 +0000 (14:00 +0200)
Profile tests run through "./unit-tests --order rand" were sometimes failing.

src/kernel/resource/profile/Profile_test.cpp
src/xbt/random_test.cpp

index ec95c30..8bb95a8 100644 (file)
@@ -189,6 +189,7 @@ TEST_CASE("kernel::profile: Resource profiles, defining the external load", "ker
 
   SECTION("Two stochastic events (drawing each distribution)")
   {
+    simgrid::xbt::random::set_implem_xbt();
     simgrid::xbt::random::set_mersenne_seed(12345);
     std::vector<simgrid::kernel::profile::DatedValue> got = trace2vector("STOCHASTIC\n"
                                                                          "DET 0 UNIF 10 20\n"
@@ -204,6 +205,7 @@ TEST_CASE("kernel::profile: Resource profiles, defining the external load", "ker
 
   SECTION("Two stochastic events, with a loop")
   {
+    simgrid::xbt::random::set_implem_xbt();
     simgrid::xbt::random::set_mersenne_seed(12345);
     std::vector<simgrid::kernel::profile::DatedValue> got = trace2vector("STOCHASTIC LOOP\n"
                                                                          "DET 0 UNIF 10 20\n"
index 9b66134..e6179be 100644 (file)
@@ -15,6 +15,7 @@ TEST_CASE("xbt::random: Random Number Generation")
 {
   SECTION("Using XBT_RNG_xbt")
   {
+    simgrid::xbt::random::set_implem_xbt();
     simgrid::xbt::random::set_mersenne_seed(12345);
     REQUIRE_THAT(simgrid::xbt::random::exponential(25), EpsilonApprox(0.00291934351538427348));
     REQUIRE(simgrid::xbt::random::uniform_int(1, 6) == 4);