1 #include <gtest/gtest.h>
11 <root BTCPP_format="4" >
12 <BehaviorTree ID="Check">
16 <WasEntryUpdated entry="A"/>
20 <SkipUnlessUpdated entry="A">
28 TEST(EntryUpdates, NoEntry)
31 std::array<int, 2> counters;
35 <root BTCPP_format="4" >
36 <BehaviorTree ID="Main">
38 <SubTree ID="Check" _autoremap="true"/>
48 EXPECT_EQ(1, counters[0]);
49 EXPECT_EQ(0, counters[1]);
52 TEST(EntryUpdates, Initialized)
55 std::array<int, 2> counters;
59 <root BTCPP_format="4" >
60 <BehaviorTree ID="Main">
62 <Script code="A:=1;B:=1"/>
63 <SubTree ID="Check" _autoremap="true"/>
73 EXPECT_EQ(0, counters[0]);
74 EXPECT_EQ(1, counters[1]);
77 TEST(EntryUpdates, UpdateOnce)
80 std::array<int, 2> counters;
84 <root BTCPP_format="4" >
85 <BehaviorTree ID="Main">
88 <Repeat num_cycles="2" >
89 <SubTree ID="Check" _autoremap="true"/>
100 EXPECT_EQ(1, counters[0]);
101 EXPECT_EQ(1, counters[1]);
104 TEST(EntryUpdates, UpdateTwice)
107 std::array<int, 2> counters;
111 <root BTCPP_format="4" >
112 <BehaviorTree ID="Main">
113 <Repeat num_cycles="2" >
115 <Script code="A:=1"/>
116 <SubTree ID="Check" _autoremap="true"/>
127 EXPECT_EQ(0, counters[0]);
128 EXPECT_EQ(2, counters[1]);