Skip to content

Commit

Permalink
setup is nice now
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Jul 16, 2024
1 parent f38ee8b commit 96fada4
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions cpptests/test_fixation_pruning_during_simulation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@
#include "fwdpy11/mutation_dominance/MutationDominance.hpp"
#include "fwdpy11/regions/Sregion.hpp"

fwdpy11::MutationRegions
strong_positive_selection()
{
auto nweights = std::vector<double>();
auto sweights = std::vector<double>(1.);
std::vector<std::unique_ptr<fwdpy11::Sregion>> nregions, sregions;

sregions.emplace_back(fwdpy11::ExpS(fwdpy11::Region(0., 10., 1.0, true, 0),
2.0, 0.025, fwdpy11::fixed_dominance(1.))
.clone());
return fwdpy11::MutationRegions::create(0., nweights, sweights, nregions, sregions);
}

struct common_setup
{
fwdpy11::GSLrng_t rng;
Expand All @@ -45,7 +58,7 @@ struct common_setup
evolve_with_tree_sequences_options options;

common_setup()
: rng{42}, pop{100, 10.0}, mregions{{}, {}},
: rng{42}, pop{100, 10.0}, mregions{strong_positive_selection()},
//mregions{fwdpy11::MutationRegions::create(
// 0, std::vector<double>(), std::vector<double>(1.), {},
// std::vector<std::unique_ptr<fwdpy11::Sregion>>(
Expand Down Expand Up @@ -78,22 +91,13 @@ BOOST_FIXTURE_TEST_CASE(test_remove_fixations, common_setup)
= [](const fwdpy11::DiploidPopulation &, fwdpy11::SampleRecorder &) {

};
mregions.weights.emplace_back(1.);
mregions.regions.emplace_back(fwdpy11::ExpS(fwdpy11::Region(0., 10., 1.0, true, 0),
2.0, 0.025, fwdpy11::fixed_dominance(1.))
.clone());
auto nw = std::vector<double>();
auto nregions = std::vector<std::unique_ptr<fwdpy11::Sregion>>();
auto mr = fwdpy11::MutationRegions::create(
0., nw, mregions.weights,
nregions, mregions.regions);
BOOST_REQUIRE_EQUAL(mregions.weights.size(), mregions.regions.size());
BOOST_REQUIRE_EQUAL(mregions.weights.size(), 1);
options.track_mutation_counts_during_sim = true;
BOOST_REQUIRE_EQUAL(options.preserve_selected_fixations, false);
BOOST_REQUIRE_EQUAL(options.track_mutation_counts_during_sim, true);
evolve_with_tree_sequences(rng, pop, recorder, 10, forward_demes_graph, 1000, 0., 0.02,
mr, recregions, gvalue_ptrs,
evolve_with_tree_sequences(rng, pop, recorder, 10, forward_demes_graph, 1000, 0.,
0.02, mregions, recregions, gvalue_ptrs,
sample_recorder_callback, stopping_criterion,
post_simplification_recorder, options);
BOOST_REQUIRE_EQUAL(pop.generation, 1000);
Expand Down

0 comments on commit 96fada4

Please sign in to comment.