Skip to content
Snippets Groups Projects
Commit 1d1ced2f authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Improve tests

parent 8c8b4dff
No related branches found
No related tags found
1 merge request!341Resolve "HasStateBlocks::addStateBlock() needs to register SB's"
Pipeline #4976 passed
......@@ -321,7 +321,7 @@ void FrameBase::setProblem(ProblemPtr _problem)
NodeBase::setProblem(_problem);
if (this->isKey())
registerNewStateBlocks(getProblem());
registerNewStateBlocks(_problem);
for (auto cap : capture_list_)
cap->setProblem(_problem);
......
......@@ -50,7 +50,7 @@ class HasStateBlocksTest : public testing::Test
};
TEST_F(HasStateBlocksTest, Notifications_setKey)
TEST_F(HasStateBlocksTest, Notifications_setKey_add)
{
Notification n;
ASSERT_FALSE(problem->getStateBlockNotification(sbp0, n));
......@@ -65,7 +65,7 @@ TEST_F(HasStateBlocksTest, Notifications_setKey)
ASSERT_EQ(n, ADD);
}
TEST_F(HasStateBlocksTest, Notifications_addStateBlock)
TEST_F(HasStateBlocksTest, Notifications_add_makeKF)
{
Notification n;
......@@ -91,15 +91,24 @@ TEST_F(HasStateBlocksTest, Notifications_addStateBlock)
ASSERT_TRUE(problem->getStateBlockNotification(sbv0, n));
ASSERT_EQ(n, ADD);
}
TEST_F(HasStateBlocksTest, Notifications_makeKF_add)
{
Notification n;
// first make KF, then add SB
F1->link(problem->getTrajectory());
F1->setKey();
F1->addStateBlock("P", sbp1);
F1->setKey();
ASSERT_TRUE(problem->getStateBlockNotification(sbp1, n));
ASSERT_EQ(n, ADD);
// add another SB
ASSERT_FALSE(problem->getStateBlockNotification(sbv1, n));
F1->addStateBlock("V", sbv1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment