Skip to content

Commit

Permalink
- add test for stepsize
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed May 10, 2024
1 parent 859136b commit 3a635ee
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/copasijs_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,40 @@ TEST_CASE("Simulate SBML multiple times", "[copasijs][multiple]")

}


TEST_CASE("Test stepsize in multiple runs", "[copasijs][multiple]")
{
Instance instance;
std::string model = loadFromFile(getTestFile("../example_files/oscli.xml"));


nlohmann::ordered_json yaml;
yaml["problem"]["OutputStartTime"] = 0;
yaml["problem"]["Duration"] = 10;
yaml["problem"]["StepSize"] = 1;

auto data = simulateJSON(yaml);
CAPTURE(data);
CAPTURE(getTimeCourseSettings());
auto json = nlohmann::json::parse(data);
REQUIRE(json["recorded_steps"].get<int>() == 11);

yaml["problem"]["OutputStartTime"] = 10;
yaml["problem"]["Duration"] = 20;
data = simulateJSON(yaml);
CAPTURE(data);
CAPTURE(getTimeCourseSettings());
json = nlohmann::json::parse(data);
REQUIRE(json["recorded_steps"].get<int>() == 11);

yaml["problem"]["StepSize"] = 0.1;
data = simulateJSON(yaml);
CAPTURE(data);
CAPTURE(getTimeCourseSettings());
json = nlohmann::json::parse(data);
REQUIRE(json["recorded_steps"].get<int>() == 101);
}

TEST_CASE("Load SBML Model", "[copasijs][sbml]")
{
Instance instance;
Expand Down

0 comments on commit 3a635ee

Please sign in to comment.