From 12dce75f43b7ec4dbca132051187c666f24de975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Vallv=C3=A9=20Navarro?= <jvallve@iri.upc.edu> Date: Tue, 4 Jun 2019 13:12:08 +0200 Subject: [PATCH] gtest solver manager more complete --- test/gtest_solver_manager.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/gtest_solver_manager.cpp b/test/gtest_solver_manager.cpp index f7b5e25c0..de653851d 100644 --- a/test/gtest_solver_manager.cpp +++ b/test/gtest_solver_manager.cpp @@ -465,12 +465,17 @@ TEST(SolverManager, AddUpdatedStateBlock) // Fix --> FLAG sb_ptr->unfix(); + // Check flag has been set true + ASSERT_TRUE(sb_ptr->fixUpdated()); ASSERT_EQ(P->getStateBlockNotificationMapSize(),1); // No new notifications (fix and set state are flags in sb) // == consume empties the notification map == solver_manager_ptr->update(); // it calls P->consumeStateBlockNotificationMap(); ASSERT_EQ(P->getStateBlockNotificationMapSize(),0); + // Check flags have been reset + ASSERT_FALSE(sb_ptr->fixUpdated()); + ASSERT_FALSE(sb_ptr->stateUpdated()); // == When an REMOVE is notified: a REMOVE notification should be stored == @@ -481,10 +486,9 @@ TEST(SolverManager, AddUpdatedStateBlock) ASSERT_TRUE(P->getStateBlockNotification(sb_ptr, notif)); ASSERT_EQ(notif, REMOVE); - // == ADD + REMOVE: notification map should be empty == + // == REMOVE + ADD: notification map should be empty == P->notifyStateBlock(sb_ptr,ADD); - P->notifyStateBlock(sb_ptr,REMOVE); - ASSERT_TRUE(P->getStateBlockNotificationMapSize() == 0); + ASSERT_EQ(P->getStateBlockNotificationMapSize(),0); // == UPDATES should clear the list of notifications == // add state_block @@ -494,6 +498,11 @@ TEST(SolverManager, AddUpdatedStateBlock) solver_manager_ptr->update(); ASSERT_EQ(P->getStateBlockNotificationMapSize(),0); // After solver_manager->update, notifications should be empty + + // == ADD + REMOVE: notification map should be empty == + P->notifyStateBlock(sb_ptr,ADD); + P->notifyStateBlock(sb_ptr,REMOVE); + ASSERT_EQ(P->getStateBlockNotificationMapSize(),0); } TEST(SolverManager, AddFactor) -- GitLab