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

Method testNodeTree_addAndChildren

tests/test_core.cpp:35–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 }
34
35 void testNodeTree_addAndChildren() {
36 rcx::NodeTree tree;
37 rcx::Node root;
38 root.kind = rcx::NodeKind::Struct;
39 root.name = "Root";
40 root.parentId = 0;
41 int ri = tree.addNode(root);
42 QCOMPARE(ri, 0);
43 uint64_t rootId = tree.nodes[ri].id;
44
45 rcx::Node child;
46 child.kind = rcx::NodeKind::Hex32;
47 child.name = "field";
48 child.parentId = rootId;
49 child.offset = 0;
50 tree.addNode(child);
51
52 auto children = tree.childrenOf(rootId);
53 QCOMPARE(children.size(), 1);
54 QCOMPARE(children[0], 1);
55
56 auto roots = tree.childrenOf(0);
57 QCOMPARE(roots.size(), 1);
58 QCOMPARE(roots[0], 0);
59 }
60
61 void testNodeTree_depth() {
62 rcx::NodeTree tree;

Callers

nothing calls this directly

Calls 3

childrenOfMethod · 0.80
addNodeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected