From 32fa5cbd5bcfdf6e97010fe127ee76011d51c143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Sat, 13 Jun 2020 18:53:08 +0200 Subject: [PATCH] New test HasStateBlocks::getState(structure) --- test/gtest_has_state_blocks.cpp | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/gtest_has_state_blocks.cpp b/test/gtest_has_state_blocks.cpp index 4e3d61010..1369fd5a8 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) { -- GitLab