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

Method testFoldLevels

tests/test_compose.cpp:220–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218 }
219
220 void testFoldLevels() {
221 NodeTree tree;
222 tree.baseAddress = 0;
223
224 Node root;
225 root.kind = NodeKind::Struct;
226 root.name = "Root";
227 root.parentId = 0;
228 int ri = tree.addNode(root);
229 uint64_t rootId = tree.nodes[ri].id;
230
231 Node child;
232 child.kind = NodeKind::Struct;
233 child.name = "Child";
234 child.parentId = rootId;
235 child.offset = 0;
236 int ci = tree.addNode(child);
237 uint64_t childId = tree.nodes[ci].id;
238
239 Node leaf;
240 leaf.kind = NodeKind::Hex8;
241 leaf.name = "x";
242 leaf.parentId = childId;
243 leaf.offset = 0;
244 tree.addNode(leaf);
245
246 NullProvider prov;
247 ComposeResult result = compose(tree, prov);
248
249 // Child header (depth 1, fold head) — root header no longer emitted
250 QCOMPARE(result.meta[1].foldLevel, 0x401 | 0x2000);
251 QCOMPARE(result.meta[1].depth, 1);
252 QVERIFY(result.meta[1].foldHead);
253
254 // Leaf (depth 2, not head)
255 QCOMPARE(result.meta[2].foldLevel, 0x402);
256 QCOMPARE(result.meta[2].depth, 2);
257 }
258
259 void testNestedStruct() {
260 NodeTree tree;

Callers

nothing calls this directly

Calls 2

composeFunction · 0.85
addNodeMethod · 0.45

Tested by

no test coverage detected