From 3d5e2504287df505f362fe5324d2c695457f5593 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Wed, 25 Mar 2020 10:54:10 +0100
Subject: [PATCH] Update gtest_has_state_blocks.cpp

---
 test/gtest_has_state_blocks.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/test/gtest_has_state_blocks.cpp b/test/gtest_has_state_blocks.cpp
index 70a3a49ba..2d710f321 100644
--- a/test/gtest_has_state_blocks.cpp
+++ b/test/gtest_has_state_blocks.cpp
@@ -67,6 +67,9 @@ TEST_F(HasStateBlocksTest, Notifications_setKey)
 TEST_F(HasStateBlocksTest, Notifications_addStateBlock)
 {
     Notification n;
+
+    // First add SB, than make KF
+
     ASSERT_FALSE(problem->getStateBlockNotification(sbp0, n));
 
     F0->link(problem->getTrajectory());
@@ -86,6 +89,23 @@ TEST_F(HasStateBlocksTest, Notifications_addStateBlock)
 
     ASSERT_TRUE(problem->getStateBlockNotification(sbv0, n));
     ASSERT_EQ(n, ADD);
+
+    // first make KF, then add SB
+
+    F1->link(problem->getTrajectory());
+
+    F1->addStateBlock("P", sbp1);
+
+    F1->setKey();
+
+    ASSERT_TRUE(problem->getStateBlockNotification(sbp1, n));
+    ASSERT_FALSE(problem->getStateBlockNotification(sbv1, n));
+
+    F1->addStateBlock("V", sbv1);
+
+    ASSERT_TRUE(problem->getStateBlockNotification(sbv1, n));
+    ASSERT_EQ(n, ADD);
+
 }
 
 int main(int argc, char **argv)
-- 
GitLab