Skip to content

Commit 3a635ee

Browse files
committed
- add test for stepsize
1 parent 859136b commit 3a635ee

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test/copasijs_test.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,40 @@ TEST_CASE("Simulate SBML multiple times", "[copasijs][multiple]")
124124

125125
}
126126

127+
128+
TEST_CASE("Test stepsize in multiple runs", "[copasijs][multiple]")
129+
{
130+
Instance instance;
131+
std::string model = loadFromFile(getTestFile("../example_files/oscli.xml"));
132+
133+
134+
nlohmann::ordered_json yaml;
135+
yaml["problem"]["OutputStartTime"] = 0;
136+
yaml["problem"]["Duration"] = 10;
137+
yaml["problem"]["StepSize"] = 1;
138+
139+
auto data = simulateJSON(yaml);
140+
CAPTURE(data);
141+
CAPTURE(getTimeCourseSettings());
142+
auto json = nlohmann::json::parse(data);
143+
REQUIRE(json["recorded_steps"].get<int>() == 11);
144+
145+
yaml["problem"]["OutputStartTime"] = 10;
146+
yaml["problem"]["Duration"] = 20;
147+
data = simulateJSON(yaml);
148+
CAPTURE(data);
149+
CAPTURE(getTimeCourseSettings());
150+
json = nlohmann::json::parse(data);
151+
REQUIRE(json["recorded_steps"].get<int>() == 11);
152+
153+
yaml["problem"]["StepSize"] = 0.1;
154+
data = simulateJSON(yaml);
155+
CAPTURE(data);
156+
CAPTURE(getTimeCourseSettings());
157+
json = nlohmann::json::parse(data);
158+
REQUIRE(json["recorded_steps"].get<int>() == 101);
159+
}
160+
127161
TEST_CASE("Load SBML Model", "[copasijs][sbml]")
128162
{
129163
Instance instance;

0 commit comments

Comments
 (0)