Skip to content

Commit

Permalink
Merge pull request #1224 from sys-bio/make-random-test-more-random
Browse files Browse the repository at this point in the history
Changes test Set_Gillespie_Random_Seed to fail less.
  • Loading branch information
luciansmith authored May 22, 2024
2 parents 5fcb6cd + 1b72306 commit 0376d69
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/model_analysis/model_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1738,11 +1738,15 @@ TEST_F(ModelAnalysisTests, Set_Gillespie_Random_Seed) {
RoadRunner rr1((modelAnalysisModelsDir / "gillespie_random_seed.xml").string());
RoadRunner rr2((modelAnalysisModelsDir / "gillespie_random_seed.xml").string());
rr1.setIntegrator("gillespie");
rr1.getIntegrator()->setValue("variable_step_size", true);
rr1.setSeed(-1, false);
rr1.simulate(0, 10, 2);
const ls::DoubleMatrix* rr1_results = rr1.simulate(0, 10, 2);
rr2.setIntegrator("gillespie");
rr1.getIntegrator()->setValue("variable_step_size", true);
rr2.setSeed(-1, false);
rr2.simulate(0, 10, 2);
EXPECT_NE(rr1.getValue("S2"), rr2.getValue("S2"));
const ls::DoubleMatrix* rr2_results = rr2.simulate(0, 10, 2);
// With a variable step size, every time step is a random draw, which should be different.
EXPECT_NE(rr1_results->Element(1, 0), rr2_results->Element(1, 0));
//std::cout << rr1_results->Element(1, 0) << ", " << rr2_results->Element(1, 0) << std::endl;
}

0 comments on commit 0376d69

Please sign in to comment.