diff --git a/tests/test_hsm.h b/tests/test_hsm.h index 43309b4..72a553e 100644 --- a/tests/test_hsm.h +++ b/tests/test_hsm.h @@ -60,7 +60,8 @@ TEST_CASE("[Modules][LimboAI] HSM") { hsm->add_transition(state_beta, state_alpha, "event_two"); hsm->set_initial_state(state_alpha); - hsm->initialize(agent); + Ref parent_scope = memnew(Blackboard); + hsm->initialize(agent, parent_scope); hsm->set_active(true); SUBCASE("Test get_root()") { @@ -172,6 +173,12 @@ TEST_CASE("[Modules][LimboAI] HSM") { CHECK(hsm->is_active()); CHECK(hsm->get_active_state() == state_alpha); } + SUBCASE("Check if parent scope is accessible") { + parent_scope->set_var("parent_var", 100); + CHECK(state_alpha->get_blackboard()->get_parent() == parent_scope); + CHECK(state_beta->get_blackboard()->get_parent() == parent_scope); + CHECK(state_alpha->get_blackboard()->get_var("parent_var", Variant()) == Variant(100)); + } memdelete(agent); memdelete(hsm);