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

Method testComputeOffsetCycle

tests/test_core.cpp:241–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239 }
240
241 void testComputeOffsetCycle() {
242 rcx::NodeTree tree;
243 rcx::Node a; a.kind = rcx::NodeKind::Struct; a.name = "A"; a.parentId = 0; a.offset = 10;
244 int ai = tree.addNode(a);
245 uint64_t aId = tree.nodes[ai].id;
246
247 rcx::Node b; b.kind = rcx::NodeKind::Struct; b.name = "B"; b.parentId = aId; b.offset = 20;
248 int bi = tree.addNode(b);
249 uint64_t bId = tree.nodes[bi].id;
250
251 // Create cycle: A → B → A
252 tree.nodes[ai].parentId = bId;
253 tree.invalidateIdCache();
254
255 // Should not hang
256 int off = tree.computeOffset(ai);
257 Q_UNUSED(off);
258 QVERIFY(true); // reaching here means no hang
259 }
260
261 void testProviderWrite() {
262 QByteArray data(16, '\0');

Callers

nothing calls this directly

Calls 3

invalidateIdCacheMethod · 0.80
computeOffsetMethod · 0.80
addNodeMethod · 0.45

Tested by

no test coverage detected