From 96fada47f8d4862d5fc44ddfcd5dc018bada5d27 Mon Sep 17 00:00:00 2001 From: "Kevin R. Thornton" Date: Tue, 16 Jul 2024 13:12:33 -0700 Subject: [PATCH] setup is nice now --- ...test_fixation_pruning_during_simulation.cc | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/cpptests/test_fixation_pruning_during_simulation.cc b/cpptests/test_fixation_pruning_during_simulation.cc index e2d82577c..2ce37003a 100644 --- a/cpptests/test_fixation_pruning_during_simulation.cc +++ b/cpptests/test_fixation_pruning_during_simulation.cc @@ -29,6 +29,19 @@ #include "fwdpy11/mutation_dominance/MutationDominance.hpp" #include "fwdpy11/regions/Sregion.hpp" +fwdpy11::MutationRegions +strong_positive_selection() +{ + auto nweights = std::vector(); + auto sweights = std::vector(1.); + std::vector> 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; @@ -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(), std::vector(1.), {}, // std::vector>( @@ -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(); - auto nregions = std::vector>(); - 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);