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

Method testSubtreeCycleSafe

tests/test_core.cpp:174–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172 }
173
174 void testSubtreeCycleSafe() {
175 rcx::NodeTree tree;
176 rcx::Node a; a.kind = rcx::NodeKind::Struct; a.name = "A"; a.parentId = 0;
177 int ai = tree.addNode(a);
178 uint64_t aId = tree.nodes[ai].id;
179
180 // Create a child that points back to A's id as parent — not a cycle per se,
181 // but test that subtree collection terminates
182 rcx::Node b; b.kind = rcx::NodeKind::Hex8; b.name = "B"; b.parentId = aId;
183 tree.addNode(b);
184
185 // Should return both nodes without hanging
186 auto sub = tree.subtreeIndices(aId);
187 QCOMPARE(sub.size(), 2);
188 QVERIFY(sub.contains(0));
189 QVERIFY(sub.contains(1));
190 }
191
192 void testIsReadableOverflow() {
193 QByteArray data(16, '\0');

Callers

nothing calls this directly

Calls 3

subtreeIndicesMethod · 0.80
addNodeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected