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

Method testArrayHeaderCharTypes

tests/test_compose.cpp:734–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

732 }
733
734 void testArrayHeaderCharTypes() {
735 // UInt8 array → "uint8_t[N]", UInt16 → "uint16_t[N]"
736 NodeTree tree;
737 tree.baseAddress = 0;
738
739 Node root;
740 root.kind = NodeKind::Struct;
741 root.name = "Root";
742 root.parentId = 0;
743 int ri = tree.addNode(root);
744 uint64_t rootId = tree.nodes[ri].id;
745
746 Node arr1;
747 arr1.kind = NodeKind::Array;
748 arr1.name = "str";
749 arr1.parentId = rootId;
750 arr1.offset = 0;
751 arr1.elementKind = NodeKind::UInt8;
752 arr1.arrayLen = 64;
753 tree.addNode(arr1);
754
755 Node arr2;
756 arr2.kind = NodeKind::Array;
757 arr2.name = "wstr";
758 arr2.parentId = rootId;
759 arr2.offset = 64;
760 arr2.elementKind = NodeKind::UInt16;
761 arr2.arrayLen = 32;
762 tree.addNode(arr2);
763
764 NullProvider prov;
765 ComposeResult result = compose(tree, prov);
766
767 QStringList lines = result.text.split('\n');
768 bool foundChar = false, foundWchar = false;
769 for (int i = 0; i < result.meta.size(); i++) {
770 if (!result.meta[i].isArrayHeader) continue;
771 QString text = lines[i];
772 if (text.contains("uint8_t[64]")) foundChar = true;
773 if (text.contains("uint16_t[32]")) foundWchar = true;
774 }
775 QVERIFY2(foundChar, "Should have 'uint8_t[64]' header");
776 QVERIFY2(foundWchar, "Should have 'uint16_t[32]' header");
777 }
778
779 void testArraySpansClickable() {
780 // Element type and count spans must cover the correct text regions

Callers

nothing calls this directly

Calls 3

composeFunction · 0.85
addNodeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected