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

Method testPointerFields

tests/test_generator.cpp:271–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269 // ── Pointer fields ──
270
271 void testPointerFields() {
272 rcx::NodeTree tree;
273
274 // Target struct (separate root)
275 rcx::Node target;
276 target.kind = rcx::NodeKind::Struct;
277 target.name = "Target";
278 target.structTypeName = "TargetData";
279 target.parentId = 0;
280 target.offset = 0x100;
281 int ti = tree.addNode(target);
282 uint64_t targetId = tree.nodes[ti].id;
283
284 rcx::Node tf;
285 tf.kind = rcx::NodeKind::UInt32;
286 tf.name = "value";
287 tf.parentId = targetId;
288 tf.offset = 0;
289 tree.addNode(tf);
290
291 // Main struct with pointers
292 rcx::Node main;
293 main.kind = rcx::NodeKind::Struct;
294 main.name = "Main";
295 main.structTypeName = "MainStruct";
296 main.parentId = 0;
297 int mi = tree.addNode(main);
298 uint64_t mainId = tree.nodes[mi].id;
299
300 // ptr64 with reference
301 rcx::Node p64;
302 p64.kind = rcx::NodeKind::Pointer64;
303 p64.name = "pTarget";
304 p64.parentId = mainId;
305 p64.offset = 0;
306 p64.refId = targetId;
307 tree.addNode(p64);
308
309 // ptr64 without reference
310 rcx::Node p64n;
311 p64n.kind = rcx::NodeKind::Pointer64;
312 p64n.name = "pVoid";
313 p64n.parentId = mainId;
314 p64n.offset = 8;
315 tree.addNode(p64n);
316
317 // ptr32 with reference
318 rcx::Node p32;
319 p32.kind = rcx::NodeKind::Pointer32;
320 p32.name = "pTarget32";
321 p32.parentId = mainId;
322 p32.offset = 16;
323 p32.refId = targetId;
324 tree.addNode(p32);
325
326 QString result = rcx::renderCpp(tree, mainId);
327
328 // ptr64 with target → real C++ pointer

Callers

nothing calls this directly

Calls 2

renderCppFunction · 0.85
addNodeMethod · 0.45

Tested by

no test coverage detected