| 25 | }; |
| 26 | |
| 27 | TEST(WakeUp, BasicTest) |
| 28 | { |
| 29 | static const char* xml_text = R"( |
| 30 | |
| 31 | <root BTCPP_format="4"> |
| 32 | <BehaviorTree ID="MainTree"> |
| 33 | <FastAction/> |
| 34 | </BehaviorTree> |
| 35 | </root> )"; |
| 36 | |
| 37 | BehaviorTreeFactory factory; |
| 38 | factory.registerNodeType<FastAction>("FastAction"); |
| 39 | |
| 40 | Tree tree = factory.createTreeFromText(xml_text); |
| 41 | |
| 42 | using namespace std::chrono; |
| 43 | |
| 44 | auto t1 = system_clock::now(); |
| 45 | tree.tickOnce(); |
| 46 | tree.sleep(milliseconds(200)); |
| 47 | auto t2 = system_clock::now(); |
| 48 | |
| 49 | auto dT = duration_cast<milliseconds>(t2 - t1).count(); |
| 50 | std::cout << "Woke up after msec: " << dT << std::endl; |
| 51 | |
| 52 | ASSERT_LT(dT, 25); |
| 53 | } |
nothing calls this directly
no test coverage detected