Skip to content

Commit c5144e7

Browse files
committed
Tests: make sure that our failing simulation test passes.
1 parent bc8c99f commit c5144e7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/sed/sedinstance.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ SedInstance::Impl::Impl(const SedDocumentPtr &pDocument)
7474

7575
double SedInstance::Impl::run()
7676
{
77+
// Reset iourselves.
78+
79+
removeAllIssues();
80+
7781
// Run all the tasks associated with this instance unless they have some issues.
7882

7983
auto res = 0.0;
@@ -84,6 +88,10 @@ double SedInstance::Impl::run()
8488

8589
if (task->hasIssues()) {
8690
addIssues(task);
91+
92+
// Reset the issues of the task so that they are not reported again should the instance be run again.
93+
94+
task->pimpl()->removeAllIssues();
8795
}
8896
}
8997
}

tests/misc/failingsimulationtests.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ TEST(FailingSimulationTest, basic)
2626
auto document = libOpenCOR::SedDocument::create(file);
2727
auto instance = document->instantiate();
2828

29-
instance->run();
30-
29+
EXPECT_NE(instance->run(), 0.0);
3130
EXPECT_FALSE(instance->hasIssues());
3231

3332
// Set the value of `membrane.test` to zero and rerun the simulation.
@@ -36,15 +35,13 @@ TEST(FailingSimulationTest, basic)
3635

3736
model->addChange(libOpenCOR::SedChangeAttribute::create("membrane", "test", "0.0"));
3837

39-
instance->run();
40-
38+
EXPECT_EQ(instance->run(), 0.0);
4139
EXPECT_TRUE(instance->hasIssues());
4240

4341
// Remove all changes and rerun the simulation.
4442

4543
model->removeAllChanges();
4644

47-
instance->run();
48-
45+
EXPECT_NE(instance->run(), 0.0);
4946
EXPECT_FALSE(instance->hasIssues());
5047
}

0 commit comments

Comments
 (0)