diff --git a/test/gtest_has_state_blocks.cpp b/test/gtest_has_state_blocks.cpp index 4e3d610109e92b8fe6846b93050bc64af29a6f72..1369fd5a87dc31f4d0a7af14a929f0d23637b041 100644 --- a/test/gtest_has_state_blocks.cpp +++ b/test/gtest_has_state_blocks.cpp @@ -178,6 +178,46 @@ TEST_F(HasStateBlocksTest, stateBlockKey) ASSERT_TRUE(key == ""); } +TEST_F(HasStateBlocksTest, getState_structure) +{ + F0->addStateBlock("V", sbv0); // now KF0 is POV + + WOLF_DEBUG("Retrieving state from F0 with structure ", F0->getStructure()); + + auto state0 = F0->getState(); + WOLF_DEBUG("getState() = ", state0); + ASSERT_EQ(state0.size(), 3); + ASSERT_TRUE(state0.count("P")); + ASSERT_TRUE(state0.count("O")); + ASSERT_TRUE(state0.count("V")); + + state0 = F0->getState("PO"); + WOLF_DEBUG("getState(\"PO\") = ", state0); + ASSERT_EQ(state0.size(), 2); + ASSERT_TRUE(state0.count("P")); + ASSERT_TRUE(state0.count("O")); + ASSERT_FALSE(state0.count("V")); + + state0 = F0->getState("PV"); + WOLF_DEBUG("getState(\"PV\") = ", state0); + ASSERT_EQ(state0.size(), 2); + ASSERT_TRUE(state0.count("P")); + ASSERT_FALSE(state0.count("O")); + ASSERT_TRUE(state0.count("V")); + + state0 = F0->getState("OW"); // W does not exist + WOLF_DEBUG("getState(\"OW\") = ", state0); + ASSERT_EQ(state0.size(), 1); + ASSERT_FALSE(state0.count("P")); + ASSERT_TRUE(state0.count("O")); + ASSERT_FALSE(state0.count("V")); + ASSERT_FALSE(state0.count("W")); + + + + +} + int main(int argc, char **argv) {