MCPcopy Create free account
hub / github.com/IChooseYou/Reclass / testPointerDisplaysTargetName

Method testPointerDisplaysTargetName

tests/test_compose.cpp:1253–1316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1251 }
1252
1253 void testPointerDisplaysTargetName() {
1254 // Pointer64 with refId displays "TargetName*"
1255 NodeTree tree;
1256 tree.baseAddress = 0;
1257
1258 Node root;
1259 root.kind = NodeKind::Struct;
1260 root.name = "Root";
1261 root.parentId = 0;
1262 int ri = tree.addNode(root);
1263 uint64_t rootId = tree.nodes[ri].id;
1264
1265 // Target struct with a structTypeName
1266 Node target;
1267 target.kind = NodeKind::Struct;
1268 target.name = "PlayerData";
1269 target.structTypeName = "PlayerData";
1270 target.parentId = 0;
1271 target.offset = 200;
1272 int ti = tree.addNode(target);
1273 uint64_t targetId = tree.nodes[ti].id;
1274
1275 Node tf;
1276 tf.kind = NodeKind::UInt32;
1277 tf.name = "health";
1278 tf.parentId = targetId;
1279 tf.offset = 0;
1280 tree.addNode(tf);
1281
1282 // Pointer referencing the target (collapsed to prevent expansion)
1283 Node ptr;
1284 ptr.kind = NodeKind::Pointer64;
1285 ptr.name = "player";
1286 ptr.parentId = rootId;
1287 ptr.offset = 0;
1288 ptr.refId = targetId;
1289 ptr.collapsed = true;
1290 tree.addNode(ptr);
1291
1292 NullProvider prov;
1293 ComposeResult result = compose(tree, prov);
1294
1295 // Find the pointer line (root children at depth 0 due to root suppression)
1296 int ptrLine = -1;
1297 for (int i = 0; i < result.meta.size(); i++) {
1298 if (result.meta[i].nodeKind == NodeKind::Pointer64 &&
1299 result.meta[i].lineKind == LineKind::Field) {
1300 ptrLine = i;
1301 break;
1302 }
1303 }
1304 QVERIFY(ptrLine >= 0);
1305
1306 QStringList lines = result.text.split('\n');
1307 QVERIFY2(lines[ptrLine].contains("PlayerData*"),
1308 qPrintable("Should show 'PlayerData*': " + lines[ptrLine]));
1309
1310 // pointerTargetName metadata

Callers

nothing calls this directly

Calls 3

composeFunction · 0.85
addNodeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected