Skip to content

Commit

Permalink
Generated from commit 0b4f50068339f4c4fa184624be444295b2e21785
Browse files Browse the repository at this point in the history
  • Loading branch information
Pusnow committed Apr 1, 2021
1 parent 3c6c708 commit cb2cc1a
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions app/kens/testenv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 Target> class TestEnv1 : public ::testing::Test {
Expand All @@ -53,7 +67,7 @@ template <class Target> 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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -272,7 +286,7 @@ class TestEnv3 : public ::testing::Test {

virtual void SetUp() {

setup_random();
setup_env();

prev_log = NetworkLog::defaultLevel;
NetworkLog::defaultLevel |= (
Expand Down

0 comments on commit cb2cc1a

Please sign in to comment.