From cb2cc1a93afe7d7aea4f14227a0d2823d883f0d5 Mon Sep 17 00:00:00 2001 From: Wonsup Yoon Date: Thu, 1 Apr 2021 12:08:02 +0900 Subject: [PATCH] Generated from commit 0b4f50068339f4c4fa184624be444295b2e21785 --- app/kens/testenv.hpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/app/kens/testenv.hpp b/app/kens/testenv.hpp index 06c4490ac..4f15d150c 100644 --- a/app/kens/testenv.hpp +++ b/app/kens/testenv.hpp @@ -28,15 +28,29 @@ using namespace E; -static void setup_random() { +static void setup_env() { + +#ifdef RUN_SOLUTION + const bool run_solution = true; +#else + const bool run_solution = false; +#endif + +#ifdef UNRELIABLE + const bool unreliable = true; +#else + const bool unreliable = false; +#endif + + int seed = RANDOM_SEED_DEFAULT; + const char *random_seed = std::getenv("RANDOM_SEED"); if (random_seed) { - printf("[RANDOM_SEED : %s]\n", random_seed); - srand(atoi(random_seed)); - } else { - printf("[RANDOM_SEED : %d]\n", RANDOM_SEED_DEFAULT); - srand(RANDOM_SEED_DEFAULT); + seed = atoi(random_seed); } + srand(seed); + printf("[RANDOM_SEED : %d RUN_SOLUTION : %d UNRELIABLE : %d]\n", seed, + run_solution, unreliable); } template class TestEnv1 : public ::testing::Test { @@ -53,7 +67,7 @@ template class TestEnv1 : public ::testing::Test { HostModule *interface2; virtual void SetUp() { - setup_random(); + setup_env(); host1 = new Host("TestHost1", 2, &netSystem); host2 = new Host("TestHost2", 2, &netSystem); @@ -156,7 +170,7 @@ class TestEnv2 : public ::testing::Test { HostModule *interface2; virtual void SetUp() { - setup_random(); + setup_env(); host1 = new Host("TestHost1", 2, &netSystem); host2 = new Host("TestHost2", 2, &netSystem); @@ -272,7 +286,7 @@ class TestEnv3 : public ::testing::Test { virtual void SetUp() { - setup_random(); + setup_env(); prev_log = NetworkLog::defaultLevel; NetworkLog::defaultLevel |= (