-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from K-Johnson-Horrigan/refactor
Intergration tests, not sure why codecov thinks coverage is going down, but it's clearly wrong, oh well!
- Loading branch information
Showing
7 changed files
with
359 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 117 additions & 2 deletions
119
source/test/integration_test/dirty_transmission/hz_mut_rate.test.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,118 @@ | ||
#include "../../../efficient_mode/EfficientWorldSetup.cc" | ||
|
||
TEST_CASE("Horizontal Mutation Rate Results", "[integration]"){ | ||
|
||
} | ||
emp::Random random(14); | ||
SymConfigBase config; | ||
EfficientWorld world(random, &config); | ||
|
||
config.HOST_INT(-2); | ||
config.SYM_INT(-2); | ||
config.EFFICIENT_SYM(1); | ||
config.SYNERGY(2); | ||
config.MUTATION_RATE(0.1); | ||
config.HOST_AGE_MAX(100); | ||
config.SYM_AGE_MAX(50); | ||
config.UPDATES(2001); | ||
|
||
config.GRID_X(10); | ||
config.GRID_Y(10); | ||
|
||
emp::DataMonitor<double, emp::data::Histogram>& sym_val_node = world.GetHostedSymIntValDataNode(); | ||
emp::DataMonitor<double>& sym_eff_node = world.GetEfficiencyDataNode(); | ||
|
||
WHEN("Vertical transmission rate is low"){ | ||
config.VERTICAL_TRANSMISSION(0.1); | ||
world.Setup(); | ||
WHEN("Horizontal transmission mutation rate is low") { | ||
config.HORIZ_MUTATION_RATE(0.1); | ||
world.RunExperiment(false); | ||
THEN("Symbionts evolve to be parasitic and efficient") { | ||
REQUIRE(sym_val_node.GetMean() < -0.7); | ||
REQUIRE(sym_eff_node.GetMean() > 0.94); | ||
} | ||
} | ||
WHEN("Horizontal transmission mutation rate is intermediate") { | ||
config.HORIZ_MUTATION_RATE(0.5); | ||
world.RunExperiment(false); | ||
THEN("Symbionts evolve to be parasitic and efficient") { | ||
REQUIRE(sym_val_node.GetMean() < -0.6); | ||
REQUIRE(sym_eff_node.GetMean() > 0.94); | ||
} | ||
} | ||
WHEN("Horizontal transmission mutation rate is high") { | ||
config.HORIZ_MUTATION_RATE(1); | ||
world.RunExperiment(false); | ||
THEN("Symbionts evolve to be parasitic and efficient") { | ||
REQUIRE(sym_val_node.GetMean() < -0.7); | ||
REQUIRE(sym_eff_node.GetMean() > 0.95); | ||
} | ||
} | ||
} | ||
WHEN("Vertical transmission rate is intermediate") { | ||
//other tests work fine with both constrained and paper-replicating world conditions | ||
// (large to reduce drift vs. small for speed | ||
//but in intermediate case need larger world to replicate paper results | ||
config.GRID_X(100); | ||
config.GRID_Y(100); | ||
config.VERTICAL_TRANSMISSION(0.3); | ||
world.Setup(); | ||
WHEN("Horizontal transmission mutation rate is low") { | ||
config.HORIZ_MUTATION_RATE(0.1); | ||
world.RunExperiment(false); | ||
THEN("Symbionts evolve to be slightly parasitic and efficient") { | ||
double sym_val_mean = sym_val_node.GetMean(); | ||
REQUIRE(sym_val_mean < 0); | ||
REQUIRE(sym_val_mean > -0.7); | ||
REQUIRE(sym_eff_node.GetMean() > 0.94); | ||
} | ||
} | ||
WHEN("Horizontal transmission mutation rate is intermediate") { | ||
config.HORIZ_MUTATION_RATE(0.5); | ||
world.RunExperiment(false); | ||
THEN("Symbionts are evolve between slight parasitism and slight mutualism and evolve to be efficient") { | ||
double sym_val_mean = sym_val_node.GetMean(); | ||
REQUIRE(sym_val_mean < 0.5); | ||
REQUIRE(sym_val_mean > -0.5); | ||
REQUIRE(sym_eff_node.GetMean() > 0.94); | ||
} | ||
} | ||
WHEN("Horizontal transmission mutation rate is high") { | ||
config.HORIZ_MUTATION_RATE(1); | ||
world.RunExperiment(false); | ||
THEN("Symbionts evolve to be slightly mutualistic and efficient") { | ||
double sym_val_mean = sym_val_node.GetMean(); | ||
REQUIRE(sym_val_mean > 0); | ||
REQUIRE(sym_val_mean < 0.7); | ||
REQUIRE(sym_eff_node.GetMean() > 0.94); | ||
} | ||
} | ||
} | ||
WHEN("Vertical transmission rate is high") { | ||
config.VERTICAL_TRANSMISSION(0.9); | ||
world.Setup(); | ||
WHEN("Horizontal transmission mutation rate is low") { | ||
config.HORIZ_MUTATION_RATE(0.1); | ||
world.RunExperiment(false); | ||
THEN("Symbionts evolve to be mutualistic and efficient") { | ||
REQUIRE(sym_val_node.GetMean() > 0.7); | ||
REQUIRE(sym_eff_node.GetMean() > 0.94); | ||
} | ||
} | ||
WHEN("Horizontal transmission mutation rate is intermediate") { | ||
config.HORIZ_MUTATION_RATE(0.5); | ||
world.RunExperiment(false); | ||
THEN("Symbionts evolve to be mutualistic and efficient") { | ||
REQUIRE(sym_val_node.GetMean() > 0.7); | ||
REQUIRE(sym_eff_node.GetMean() > 0.94); | ||
} | ||
} | ||
WHEN("Horizontal transmission mutation rate is high") { | ||
config.HORIZ_MUTATION_RATE(1); | ||
world.RunExperiment(false); | ||
THEN("Symbionts evolve to be mutualistic and efficient") { | ||
REQUIRE(sym_val_node.GetMean() > 0.7); | ||
REQUIRE(sym_eff_node.GetMean() > 0.94); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "../../../pgg_mode/PGGWorldSetup.cc" | ||
|
||
|
||
TEST_CASE("Multi-infection results", "[integration]") { | ||
emp::Random random(29); | ||
SymConfigBase config; | ||
PGGWorld world(random, &config); | ||
config.HOST_INT(0); | ||
config.SYM_INT(0); | ||
config.PGG(1); | ||
config.MUTATION_SIZE(0.05); | ||
config.UPDATES(2000); | ||
world.Setup(); | ||
|
||
config.GRID_X(5); | ||
config.GRID_Y(5); | ||
|
||
emp::DataMonitor<double, emp::data::Histogram>& sym_val_node = world.GetHostedSymIntValDataNode(); | ||
emp::DataMonitor<double, emp::data::Histogram>& host_val_node = world.GetHostIntValDataNode(); | ||
|
||
|
||
WHEN("There are few symbionts per host") { | ||
config.SYM_LIMIT(1); | ||
WHEN("Vertical transmission rate is intermediate") { | ||
config.VERTICAL_TRANSMISSION(0.7); | ||
world.RunExperiment(false); | ||
THEN("Mutualism evolves"){ | ||
REQUIRE(sym_val_node.GetMean() > 0.1); | ||
REQUIRE(host_val_node.GetMean() > 0.1); | ||
} | ||
} | ||
WHEN("Vertical transmission rate is high") { | ||
config.VERTICAL_TRANSMISSION(1); | ||
world.RunExperiment(false); | ||
THEN("Mutualism evolves"){ | ||
REQUIRE(sym_val_node.GetMean() > 0.1); | ||
REQUIRE(host_val_node.GetMean() > 0.1); | ||
} | ||
} | ||
} | ||
WHEN("There can be many symbionts per host") { | ||
config.SYM_LIMIT(10); | ||
WHEN("Vertical transmission rate is intermediate") { | ||
config.VERTICAL_TRANSMISSION(0.7); | ||
world.RunExperiment(false); | ||
THEN("Mutualism does not evolve") { | ||
REQUIRE(sym_val_node.GetMean() < -0.1); | ||
REQUIRE(host_val_node.GetMean() < -0.1); | ||
} | ||
} | ||
WHEN("Vertical transmission rate is high") { | ||
config.VERTICAL_TRANSMISSION(1); | ||
world.RunExperiment(false); | ||
THEN("Mutualism evolves") { | ||
REQUIRE(sym_val_node.GetMean() > 0.1); | ||
REQUIRE(host_val_node.GetMean() > 0.1); | ||
} | ||
} | ||
} | ||
} |
182 changes: 181 additions & 1 deletion
182
source/test/integration_test/spatial_structure/vt.test.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,183 @@ | ||
#include "../../../default_mode/WorldSetup.cc" | ||
|
||
|
||
TEST_CASE("Vertical Transmission Results", "[integration]"){ | ||
|
||
//based on paper: Vostinar and Ofria, 2018, "Spatial Structure Can Decrease Symbiotic Cooperation." | ||
|
||
emp::Random random(29); | ||
SymConfigBase config; | ||
SymWorld world(random, &config); | ||
|
||
config.MUTATION_SIZE(0.05); | ||
|
||
emp::DataMonitor<double, emp::data::Histogram>& sym_val_node = world.GetHostedSymIntValDataNode(); | ||
emp::DataMonitor<int>& sym_count_node = world.GetCountHostedSymsDataNode(); | ||
|
||
WHEN("Mutualists are already present in the population (mixed population)") { | ||
config.HOST_INT(-2); | ||
config.SYM_INT(-2); | ||
world.Setup(); | ||
|
||
WHEN("Vertical transmission rate is 0") { | ||
config.VERTICAL_TRANSMISSION(0); | ||
world.RunExperiment(false); | ||
THEN("Clear parasitism evolves") { | ||
REQUIRE(sym_val_node.GetMean() < -0.5); | ||
} | ||
} | ||
WHEN("Vertical transmission rate is 1") { | ||
config.VERTICAL_TRANSMISSION(1); | ||
world.RunExperiment(false); | ||
THEN("Clear mutualism evolves") { | ||
REQUIRE(sym_val_node.GetMean() > 0.5); | ||
} | ||
} | ||
WHEN("Vertical transmission rate is low (0.09)") { | ||
config.VERTICAL_TRANSMISSION(0.09); | ||
int parasite_count = 0; | ||
int mutualist_count = 0; | ||
world.RunExperiment(false); | ||
THEN("A cooexistence between parasitic and mutualistic symbionts may develop") { | ||
for (int i = 0; i < 6; i++) { | ||
parasite_count += sym_val_node.GetHistCounts()[i]; | ||
mutualist_count += sym_val_node.GetHistCounts()[19-i]; | ||
} | ||
REQUIRE(mutualist_count > 0); | ||
REQUIRE(parasite_count > 0); | ||
REQUIRE(parasite_count / mutualist_count > 0.1); | ||
} | ||
} | ||
} | ||
WHEN("Organisms begin the experiment with an interaction value of 0 (all-neutral population)") { | ||
config.HOST_INT(0); | ||
config.SYM_INT(0); | ||
|
||
|
||
WHEN("Vertical transmission rate is 1") { | ||
config.VERTICAL_TRANSMISSION(1); | ||
world.Setup(); | ||
world.RunExperiment(false); | ||
THEN("Mutualists evolve"){ | ||
REQUIRE(sym_val_node.GetMean() > 0.5); | ||
} | ||
} | ||
WHEN("Vertical transmission rate is less than 1") { | ||
config.VERTICAL_TRANSMISSION(0.2); | ||
config.MUTATION_SIZE(0.01); | ||
config.START_MOI(0.5); | ||
world.Setup(); | ||
world.RunExperiment(false); | ||
THEN("Symbionts go extinct"){ | ||
REQUIRE(sym_count_node.GetTotal() == 0); | ||
} | ||
} | ||
} | ||
WHEN("Symbionts begin the experiment with parasitic phenotypes"){ | ||
config.HOST_INT(0); | ||
// not using random parasite values, which the paper used | ||
config.SYM_INT(-0.5); | ||
world.Setup(); | ||
|
||
WHEN("Vertical transmission rate is 0") { | ||
config.VERTICAL_TRANSMISSION(0); | ||
world.RunExperiment(false); | ||
THEN("Symbionts become very parasitic"){ | ||
REQUIRE(sym_val_node.GetMean() < -0.5); | ||
} | ||
} | ||
WHEN("Vertical transmission rate is intermediate (0.5)"){ | ||
config.VERTICAL_TRANSMISSION(0.5); | ||
world.RunExperiment(false); | ||
THEN("Symbionts become slightly parasitic"){ | ||
REQUIRE(sym_val_node.GetMean() < -0.2); | ||
|
||
} | ||
} | ||
WHEN("Vertical transmission rate is high"){ | ||
config.VERTICAL_TRANSMISSION(0.7); | ||
config.MUTATION_RATE(0.95); | ||
config.MUTATION_SIZE(0.04); | ||
world.RunExperiment(false); | ||
THEN("Symbionts become neutral"){ | ||
double mean_sym_val = sym_val_node.GetMean(); | ||
REQUIRE(mean_sym_val > -0.2); | ||
REQUIRE(mean_sym_val < 0.2); | ||
} | ||
} | ||
} | ||
WHEN("Symbionts begin the experiment with mutualistic phenotypes"){ | ||
config.HOST_INT(0); | ||
// not using random parasite values, which the paper used | ||
config.SYM_INT(0.5); | ||
world.Setup(); | ||
|
||
WHEN("Vertical transmission rate is 0") { | ||
config.VERTICAL_TRANSMISSION(0); | ||
world.RunExperiment(false); | ||
THEN("Symbionts become extinct") { | ||
REQUIRE(sym_count_node.GetTotal() == 0); | ||
} | ||
} | ||
WHEN("Vertical transmission rate is intermediate (0.5)") { | ||
config.VERTICAL_TRANSMISSION(0.5); | ||
world.RunExperiment(false); | ||
THEN("Symbionts become mutualistic") { | ||
REQUIRE(sym_val_node.GetMean() > 0.3); | ||
} | ||
} | ||
WHEN("Vertical transmission rate is high") { | ||
config.VERTICAL_TRANSMISSION(1); | ||
world.RunExperiment(false); | ||
THEN("Symbionts become very mutualistic") { | ||
REQUIRE(sym_val_node.GetMean() > 0.7); | ||
} | ||
} | ||
} | ||
|
||
WHEN("Spatial structure is on") { | ||
SymWorld off_world(random, &config); | ||
emp::DataMonitor<double, emp::data::Histogram>& off_sym_val_node = off_world.GetHostedSymIntValDataNode(); | ||
emp::DataMonitor<int>& off_sym_count_node = off_world.GetCountHostedSymsDataNode(); | ||
|
||
config.HOST_INT(0); | ||
config.SYM_INT(0); | ||
config.GRID(1); | ||
world.Setup(); | ||
|
||
WHEN("Vertical transmission rate is high-intermediate (0.7)"){ | ||
config.VERTICAL_TRANSMISSION(0.7); | ||
world.RunExperiment(false); | ||
|
||
config.GRID(0); | ||
off_world.Setup(); | ||
off_world.RunExperiment(false); | ||
|
||
double grid_on_sym_val = sym_val_node.GetMean(); | ||
double grid_off_sym_val = off_sym_val_node.GetMean(); | ||
|
||
THEN("Symbionts evolve to be more parasitic compared to when spatial structure is off"){ | ||
REQUIRE(off_sym_count_node.GetTotal() > 0); | ||
REQUIRE(sym_count_node.GetTotal() > 0); | ||
REQUIRE(grid_on_sym_val < grid_off_sym_val); | ||
} | ||
} | ||
|
||
WHEN("Vertical transmission rate is low-intermediate (0.3)") { | ||
config.VERTICAL_TRANSMISSION(0.3); | ||
world.RunExperiment(false); | ||
|
||
config.GRID(0); | ||
off_world.Setup(); | ||
off_world.RunExperiment(false); | ||
|
||
double grid_on_sym_val = sym_val_node.GetMean(); | ||
double grid_off_sym_val = off_sym_val_node.GetMean(); | ||
|
||
THEN("Symbionts evolve to be less parasitic compared to when spatial structure is off") { | ||
REQUIRE(off_sym_count_node.GetTotal() > 0); | ||
REQUIRE(sym_count_node.GetTotal() > 0); | ||
REQUIRE(grid_on_sym_val > grid_off_sym_val); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.