| 420 | } |
| 421 | |
| 422 | TEST(SequenceWithMemoryTest, Issue_636) |
| 423 | { |
| 424 | static const char* xml_text = R"( |
| 425 | |
| 426 | <root BTCPP_format="4" main_tree_to_execute="MainTree" > |
| 427 | |
| 428 | <BehaviorTree ID="MainTree"> |
| 429 | <SequenceWithMemory> |
| 430 | <Script code = " var := 0 " /> |
| 431 | <TestA/> |
| 432 | <ScriptCondition code = "var+=1; var >= 5" /> |
| 433 | <TestB/> |
| 434 | <TestC/> |
| 435 | </SequenceWithMemory> |
| 436 | </BehaviorTree> |
| 437 | </root> )"; |
| 438 | |
| 439 | BT::BehaviorTreeFactory factory; |
| 440 | |
| 441 | std::array<int, 3> counters{}; |
| 442 | RegisterTestTick(factory, "Test", counters); |
| 443 | |
| 444 | auto tree = factory.createTreeFromText(xml_text); |
| 445 | |
| 446 | auto res = tree.tickOnce(); |
| 447 | int tick_count = 1; |
| 448 | |
| 449 | while(res != BT::NodeStatus::SUCCESS) |
| 450 | { |
| 451 | res = tree.tickOnce(); |
| 452 | tick_count++; |
| 453 | } |
| 454 | |
| 455 | ASSERT_EQ(1, counters[0]); |
| 456 | ASSERT_EQ(1, counters[1]); |
| 457 | ASSERT_EQ(1, counters[2]); |
| 458 | |
| 459 | ASSERT_EQ(5, tick_count); |
| 460 | } |
nothing calls this directly
no test coverage detected