@@ -920,6 +920,65 @@ TEST_F(HTPSTest, TestAddToKilled) {
920920 EXPECT_TRUE (proof_samples_tactics.empty ());
921921}
922922
923+ /* If the last child of a node is killed, the corresponding parent should be killed too.
924+ */
925+ TEST_F (HTPSTest, TestKilledRecursively) {
926+ htps_instance->theorems_to_expand ();
927+
928+ TheoremPointer child1 = static_pointer_cast<htps::theorem>(std::make_shared<DummyTheorem>(" B1" ));
929+ std::vector<std::shared_ptr<htps::env_effect>> effects;
930+ auto effect = std::make_shared<htps::env_effect>();
931+ effect->goal = root;
932+ effect->tac = dummyTac;
933+ effect->children = {child1};
934+ effects.push_back (effect);
935+
936+ std::vector<std::shared_ptr<htps::tactic>> tactics = {dummyTac};
937+ std::vector<std::vector<htps::TheoremPointer>> childrenForTactic = {{child1}};
938+ std::vector<double > priors = {1.0 };
939+ std::vector<size_t > envDurations = {1 };
940+
941+ htps::env_expansion expansion (root, 1 , 1 , envDurations, effects, 0.0 , tactics, childrenForTactic, priors);
942+ std::vector<std::shared_ptr<htps::env_expansion>> expansions = {std::make_shared<htps::env_expansion>(expansion)};
943+
944+ htps_instance->expand_and_backup (expansions);
945+ expansions.clear ();
946+
947+ auto theorems = htps_instance->theorems_to_expand ();
948+ EXPECT_TRUE (theorems[0 ] == child1 && theorems.size () == 1 );
949+
950+ TheoremPointer child2 = static_pointer_cast<htps::theorem>(std::make_shared<DummyTheorem>(" B2" ));
951+ effects.clear ();
952+ effect = std::make_shared<htps::env_effect>();
953+ effect->goal = root;
954+ effect->tac = dummyTac2;
955+ effect->children = {child2};
956+ effects.push_back (effect);
957+
958+ tactics = {dummyTac2};
959+ childrenForTactic = {{child2}};
960+ priors = {1.0 };
961+ envDurations = {1 };
962+ expansion = {child1, 1 , 1 , envDurations, effects, 0.0 , tactics, childrenForTactic, priors};
963+ expansions = {std::make_shared<htps::env_expansion>(expansion)};
964+ htps_instance->expand_and_backup (expansions);
965+ expansions.clear ();
966+
967+ theorems = htps_instance->theorems_to_expand ();
968+ EXPECT_TRUE (theorems[0 ] == child2 && theorems.size () == 1 );
969+
970+ envDurations = {1 , 1 , 1 };
971+ std::string error = " This is broken!" ;
972+ expansion = {child2, 1 , 1 , envDurations, error};
973+ expansions = {std::make_shared<htps::env_expansion>(expansion)};
974+ htps_instance->expand_and_backup (expansions);
975+
976+ htps_instance->theorems_to_expand ();
977+ EXPECT_TRUE (htps_instance->is_done ());
978+ EXPECT_FALSE (htps_instance->is_proven ());
979+ EXPECT_TRUE (htps_instance->dead_root ());
980+ }
981+
923982/* Two tactics leading to the same children from the same starting node.
924983 */
925984TEST_F (HTPSTest, TestMultipleSame) {
0 commit comments