18#include "../AIGraphPlugin_BT/BTNodeRegistry.h"
19#include "../AIGraphPlugin_BT/BTGraphValidator.h"
20#include "../AIGraphPlugin_BT/BTGraphCompiler.h"
21#include "../AIGraphPlugin_BT/BTNodePalette.h"
22#include "../../NodeGraphCore/GraphDocument.h"../
23#include "../BehaviorTree.h"
38 std::cout <<
"[PASS] " <<
testName << std::endl;
41 std::cout <<
"[FAIL] " <<
testName << std::endl;
65 (
info->category == BTNodeCategory::Composite) &&
66 (
info->minChildren == 1) &&
67 (
info->maxChildren == -1);
78 doc.graphKind =
"BehaviorTree";
96 if (
msgIt->severity == BTValidationSeverity::Error) {
110 doc.graphKind =
"BehaviorTree";
112 doc.CreateNode(
"BT_Selector", Vector2(0, 0));
113 doc.CreateNode(
"BT_Sequence", Vector2(100, 0));
120 if (
msgIt->message.find(
"Multiple root") != std::string::npos) {
134 doc.graphKind =
"BehaviorTree";
136 NodeId a =
doc.CreateNode(
"BT_Selector", Vector2(0, 0));
137 NodeId b =
doc.CreateNode(
"BT_Sequence", Vector2(0, 100));
138 NodeId c =
doc.CreateNode(
"BT_Selector", Vector2(0, 200));
146 nodeA->children.push_back(
b);
147 nodeB->children.push_back(
c);
148 nodeC->children.push_back(
a);
157 if (
msgIt->message.find(
"Cycle") != std::string::npos) {
171 doc.graphKind =
"BehaviorTree";
188 (
asset.nodes.size() == 2) &&
200 doc.graphKind =
"BehaviorTree";
202 doc.CreateNode(
"INVALID_TYPE", Vector2(0, 0));
208 bool passed = !success && (
error.find(
"Unknown node type") != std::string::npos);
219 doc.graphKind =
"BehaviorTree";
229 if (
msgIt->message.find(
"Too few children") != std::string::npos) {
246 ReportTest(
"Test 9: Palette Instantiation",
false);
258 auto conditions =
registry.GetNodeTypesByCategory(BTNodeCategory::Condition);
259 auto actions =
registry.GetNodeTypesByCategory(BTNodeCategory::Action);
263 (conditions.size() >= 4) &&
264 (actions.size() >= 8);
273 std::cout <<
"========================================" << std::endl;
274 std::cout <<
"AIGraphPlugin_BT Test Suite (Phase 1.2)" << std::endl;
275 std::cout <<
"========================================" << std::endl;
276 std::cout << std::endl;
289 std::cout << std::endl;
290 std::cout <<
"========================================" << std::endl;
292 std::cout <<
"========================================" << std::endl;
ComponentTypeID GetComponentTypeID_Static()
void Test7_CompilationInvalidNodeType()
void Test9_PaletteInstantiation()
void Test2_NodeTypeQuery()
void Test10_RegistryCategoryQuery()
void Test5_ValidationCycle()
void Test4_ValidationMultipleRoots()
void Test3_ValidationValidRoot()
void Test6_CompilationSimpleBT()
void Test1_RegistryInitialization()
void ReportTest(const std::string &testName, bool passed)
void Test8_ValidationChildrenCount()
static bool Compile(const NodeGraph::GraphDocument *graph, BehaviorTreeAsset &outAsset, std::string &errorMsg)
Compile GraphDocument to BehaviorTreeAsset.
static std::vector< BTValidationMessage > ValidateGraph(const NodeGraph::GraphDocument *graph)
Validate a complete BT graph.
UI palette for BT node selection.
bool IsDragging() const
Check if a drag operation is in progress.
static BTNodeRegistry & Get()
Get singleton instance.
Main document class for a node graph.
Metadata for a behavior tree node type.