Update HSM unit tests

This commit is contained in:
Serhii Snitsaruk 2024-03-08 20:04:27 +01:00
parent 9957ef2ea7
commit b0e3753d76
1 changed files with 8 additions and 1 deletions

View File

@ -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<Blackboard> 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);