Skip to content

Commit c9791b1

Browse files
authored
Merge branch 'master' into instlib-delete-copy-move
2 parents 79051df + 33f2b1c commit c9791b1

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

tests/test_systematics.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ TEST_CASE("Test Systematics", "[evo]")
3232
auto id6 = sys.AddOrg(29, id5, 39);
3333
std::cout << "\nAddOrg 30 (id7; parent id1)\n";
3434
auto id7 = sys.AddOrg(30, id1, 6);
35-
35+
3636

3737
std::cout << "\nRemoveOrg (id2)\n";
3838
sys.RemoveOrg(id1);
@@ -148,16 +148,16 @@ TEST_CASE("Test Data Struct", "[evo]")
148148
auto id1 = sys->AddOrg(1, nullptr);
149149
id1->GetData().fitness.Add(2);
150150
id1->GetData().phenotype = 6;
151-
151+
152152
auto id2 = sys->AddOrg(2, id1);
153153
id2->GetData().mut_counts["substitution"] = 2;
154154
id2->GetData().fitness.Add(1);
155155
id2->GetData().phenotype = 6;
156156
REQUIRE(id2->GetData().mut_counts["substitution"] == 2);
157-
157+
158158
auto id3 = sys->AddOrg(3, id1);
159159
id3->GetData().mut_counts["substitution"] = 5;
160-
id3->GetData().fitness.Add(0);
160+
id3->GetData().fitness.Add(0);
161161
id3->GetData().phenotype = 6;
162162

163163
auto id4 = sys->AddOrg(4, id2);
@@ -179,12 +179,12 @@ TEST_CASE("Test Data Struct", "[evo]")
179179
REQUIRE(CountMuts(id3) == 5);
180180
REQUIRE(CountDeleteriousSteps(id3) == 1);
181181
REQUIRE(CountPhenotypeChanges(id3) == 0);
182-
REQUIRE(CountUniquePhenotypes(id3) == 1);
182+
REQUIRE(CountUniquePhenotypes(id3) == 1);
183183

184184
REQUIRE(CountMuts(id5) == 4);
185185
REQUIRE(CountDeleteriousSteps(id5) == 2);
186186
REQUIRE(CountPhenotypeChanges(id5) == 2);
187-
REQUIRE(CountUniquePhenotypes(id5) == 2);
187+
REQUIRE(CountUniquePhenotypes(id5) == 2);
188188

189189
sys.Delete();
190190

@@ -198,8 +198,8 @@ TEST_CASE("World systematics integration", "[evo]") {
198198
// };
199199

200200
using systematics_t = emp::Systematics<
201-
emp::vector<int>,
202-
emp::vector<int>,
201+
emp::vector<int>,
202+
emp::vector<int>,
203203
emp::datastruct::mut_landscape_info< int >
204204
>;
205205

@@ -274,7 +274,7 @@ TEST_CASE("Run world", "[evo]") {
274274
using gene_systematics_t = emp::Systematics<org_t, org_t::genome_t, data_t>;
275275
using phen_systematics_t = emp::Systematics<org_t, emp::vector<double>, data_t>;
276276

277-
emp::Random random;
277+
emp::Random random(1);
278278
emp::World<org_t> world(random, "AvidaWorld");
279279
world.SetPopStruct_Mixed(true);
280280

@@ -335,7 +335,7 @@ TEST_CASE("Run world", "[evo]") {
335335

336336
// Setup the mutation function.
337337
world.SetMutFun( [&world, &on_mutate_sig](emp::AvidaGP & org, emp::Random & random) {
338-
338+
339339
uint32_t num_muts = random.GetUInt(4); // 0 to 3 mutations.
340340
for (uint32_t m = 0; m < num_muts; m++) {
341341
const uint32_t pos = random.GetUInt(20);

tests/test_tools.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@
7777

7878
TEST_CASE("Test Binomial", "[tools]")
7979
{
80-
emp::Random random;
80+
// test over a consistent set of seeds
81+
for (int s = 1; s <= 200; ++s) {
82+
83+
REQUIRE(s > 0);
84+
emp::Random random(s);
8185

8286
const double flip_prob = 0.03;
8387
const size_t num_flips = 100;
@@ -113,6 +117,7 @@ TEST_CASE("Test Binomial", "[tools]")
113117
// std::cout << " " << bi100.PickRandom(random);
114118
// }
115119
// std::cout << std::endl;
120+
}
116121
}
117122

118123
// this templating is necessary to force full coverage of templated classes.
@@ -524,7 +529,7 @@ TEST_CASE("Test graph", "[tools]")
524529
// emp::Random grand;
525530
TEST_CASE("Test Graph utils", "[tools]")
526531
{
527-
emp::Random random;
532+
emp::Random random(1);
528533
// emp::Graph graph( emp::build_graph_tree(20, random) );
529534
// emp::Graph graph( emp::build_graph_random(20, 40, random) );
530535
emp::Graph graph( emp::build_graph_grid(5, 4, random) );
@@ -1116,7 +1121,11 @@ TEST_CASE("Test NullStream", "[tools]")
11161121

11171122
TEST_CASE("Test random", "[tools]")
11181123
{
1119-
emp::Random rng;
1124+
// test over a consistent set of seeds
1125+
for(int s = 1; s < 102; ++s) {
1126+
1127+
REQUIRE(s > 0);
1128+
emp::Random rng(s);
11201129

11211130
// Test GetDouble with the law of large numbers.
11221131
emp::vector<int> val_counts(10);
@@ -1230,6 +1239,7 @@ TEST_CASE("Test random", "[tools]")
12301239
emp::vector<size_t> choices = Choose(rng,100,10);
12311240

12321241
REQUIRE(choices.size() == 10);
1242+
}
12331243
}
12341244

12351245

0 commit comments

Comments
 (0)