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

Method testStructArrayStillUsesChildren

tests/test_compose.cpp:1123–1171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1121 }
1122
1123 void testStructArrayStillUsesChildren() {
1124 // Struct array with manual children should still render child nodes, not synthesize
1125 NodeTree tree;
1126 tree.baseAddress = 0;
1127
1128 Node root;
1129 root.kind = NodeKind::Struct;
1130 root.name = "Root";
1131 root.parentId = 0;
1132 int ri = tree.addNode(root);
1133 uint64_t rootId = tree.nodes[ri].id;
1134
1135 Node arr;
1136 arr.kind = NodeKind::Array;
1137 arr.name = "items";
1138 arr.parentId = rootId;
1139 arr.offset = 0;
1140 arr.elementKind = NodeKind::Struct;
1141 arr.arrayLen = 1;
1142 int ai = tree.addNode(arr);
1143 uint64_t arrId = tree.nodes[ai].id;
1144
1145 // One struct child
1146 Node elem;
1147 elem.kind = NodeKind::Struct;
1148 elem.name = "Item";
1149 elem.parentId = arrId;
1150 elem.offset = 0;
1151 int ei = tree.addNode(elem);
1152 uint64_t elemId = tree.nodes[ei].id;
1153
1154 Node field;
1155 field.kind = NodeKind::UInt32;
1156 field.name = "val";
1157 field.parentId = elemId;
1158 field.offset = 0;
1159 tree.addNode(field);
1160
1161 NullProvider prov;
1162 ComposeResult result = compose(tree, prov);
1163
1164 // Should have the child struct's field rendered
1165 bool hasVal = false;
1166 QStringList lines = result.text.split('\n');
1167 for (int i = 0; i < lines.size(); i++) {
1168 if (lines[i].contains("val")) { hasVal = true; break; }
1169 }
1170 QVERIFY2(hasVal, "Struct array child field 'val' should be rendered");
1171 }
1172
1173 // ═════════════════════════════════════════════════════════════
1174 // Pointer tests

Callers

nothing calls this directly

Calls 3

composeFunction · 0.85
addNodeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected