MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / TEST

Function TEST

tests/gtest_sequence.cpp:422–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422TEST(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}

Callers

nothing calls this directly

Calls 3

RegisterTestTickFunction · 0.85
createTreeFromTextMethod · 0.80
tickOnceMethod · 0.80

Tested by

no test coverage detected