| 644 | } |
| 645 | |
| 646 | void testLineMetaHasNodeId() { |
| 647 | using namespace rcx; |
| 648 | NodeTree tree; |
| 649 | tree.baseAddress = 0; |
| 650 | Node root; root.kind = NodeKind::Struct; root.name = "Root"; root.parentId = 0; |
| 651 | int ri = tree.addNode(root); |
| 652 | uint64_t rootId = tree.nodes[ri].id; |
| 653 | |
| 654 | Node f; f.kind = NodeKind::Hex32; f.name = "x"; f.parentId = rootId; f.offset = 0; |
| 655 | tree.addNode(f); |
| 656 | |
| 657 | NullProvider prov; |
| 658 | ComposeResult result = compose(tree, prov); |
| 659 | |
| 660 | for (int i = 0; i < result.meta.size(); i++) { |
| 661 | // Skip CommandRow (synthetic line with sentinel nodeId) |
| 662 | if (result.meta[i].lineKind == LineKind::CommandRow) { |
| 663 | QCOMPARE(result.meta[i].nodeId, kCommandRowId); |
| 664 | QCOMPARE(result.meta[i].nodeIdx, -1); |
| 665 | continue; |
| 666 | } |
| 667 | QVERIFY2(result.meta[i].nodeId != 0, |
| 668 | qPrintable(QString("Line %1 has nodeId=0").arg(i))); |
| 669 | int ni = result.meta[i].nodeIdx; |
| 670 | QVERIFY(ni >= 0 && ni < tree.nodes.size()); |
| 671 | QCOMPARE(result.meta[i].nodeId, tree.nodes[ni].id); |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | // ═════════════════════════════════════════════════════════════ |
| 676 | // Array tests |