File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -89,3 +89,34 @@ TEST(Enums, StrintToEnum)
89
89
}
90
90
}
91
91
92
+ TEST (Enums, SwitchNodeWithEnum)
93
+ {
94
+ const std::string xml_txt = R"(
95
+ <root BTCPP_format="4" >
96
+ <BehaviorTree ID="Main">
97
+ <Sequence>
98
+ <Script code=" my_color := Blue "/>
99
+ <Switch4 variable="{my_color}"
100
+ case_1="{Red}"
101
+ case_2="{Blue}"
102
+ case_3="{Green}"
103
+ case_4="{Undefined}">
104
+ <AlwaysFailure name="case_red" />
105
+ <AlwaysSuccess name="case_blue" />
106
+ <AlwaysFailure name="case_green" />
107
+ <AlwaysFailure name="case_undefined" />
108
+ <AlwaysFailure name="default_case" />
109
+ </Switch4>
110
+ </Sequence>
111
+ </BehaviorTree>
112
+ </root>)" ;
113
+
114
+ BehaviorTreeFactory factory;
115
+ factory.registerScriptingEnums <Color>();
116
+
117
+ auto tree = factory.createTreeFromText (xml_txt);
118
+
119
+ NodeStatus status = tree.tickWhileRunning ();
120
+
121
+ ASSERT_EQ (status, NodeStatus::SUCCESS);
122
+ }
You can’t perform that action at this time.
0 commit comments