Skip to content

Commit

Permalink
okay, failing test in place
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Jul 16, 2024
1 parent 96fada4 commit 021d037
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions cpptests/test_fixation_pruning_during_simulation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ strong_positive_selection()
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());
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);
}

Expand Down Expand Up @@ -87,10 +87,35 @@ BOOST_AUTO_TEST_SUITE(test_remove_fixations_multiplicative)

BOOST_FIXTURE_TEST_CASE(test_remove_fixations, common_setup)
{
const auto sample_recorder_callback
= [](const fwdpy11::DiploidPopulation &, fwdpy11::SampleRecorder &) {

};
const auto sample_recorder_callback = [](const fwdpy11::DiploidPopulation &pop,
fwdpy11::SampleRecorder &) {
for (const auto diploid : pop.diploids)
{
for (const auto m : pop.haploid_genomes[diploid.first].smutations)
{
if (pop.mcounts[m] == 2 * pop.N)
{
for (std::size_t i = 0; i < pop.fixations.size(); ++i)
{
if (pop.fixations[i].g == pop.mutations[m].g
&& pop.fixations[i].pos
== pop.mutations[m].pos
&& pop.fixations[i].s == pop.mutations[m].s)
{
if (pop.fixation_times[i]
!= pop.generation)
{
throw std::runtime_error(
"fixation found in genome "
"that did not occur this "
"generation");
}
}
}
}
}
}
};
BOOST_REQUIRE_EQUAL(mregions.weights.size(), mregions.regions.size());
BOOST_REQUIRE_EQUAL(mregions.weights.size(), 1);
options.track_mutation_counts_during_sim = true;
Expand Down

0 comments on commit 021d037

Please sign in to comment.