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

Method testArrayWithStructChildren

tests/test_compose.cpp:829–907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

827 }
828
829 void testArrayWithStructChildren() {
830 // Array with struct children renders separators and child fields
831 NodeTree tree;
832 tree.baseAddress = 0;
833
834 Node root;
835 root.kind = NodeKind::Struct;
836 root.name = "Root";
837 root.parentId = 0;
838 int ri = tree.addNode(root);
839 uint64_t rootId = tree.nodes[ri].id;
840
841 // Array container
842 Node arr;
843 arr.kind = NodeKind::Array;
844 arr.name = "items";
845 arr.parentId = rootId;
846 arr.offset = 0;
847 arr.elementKind = NodeKind::Int32;
848 arr.arrayLen = 2;
849 int ai = tree.addNode(arr);
850 uint64_t arrId = tree.nodes[ai].id;
851
852 // Two struct children inside the array (representing elements)
853 Node elem0;
854 elem0.kind = NodeKind::Struct;
855 elem0.name = "Item";
856 elem0.parentId = arrId;
857 elem0.offset = 0;
858 int e0i = tree.addNode(elem0);
859 uint64_t elem0Id = tree.nodes[e0i].id;
860
861 Node f0;
862 f0.kind = NodeKind::UInt32;
863 f0.name = "value";
864 f0.parentId = elem0Id;
865 f0.offset = 0;
866 tree.addNode(f0);
867
868 Node elem1;
869 elem1.kind = NodeKind::Struct;
870 elem1.name = "Item";
871 elem1.parentId = arrId;
872 elem1.offset = 4;
873 int e1i = tree.addNode(elem1);
874 uint64_t elem1Id = tree.nodes[e1i].id;
875
876 Node f1;
877 f1.kind = NodeKind::UInt32;
878 f1.name = "value";
879 f1.parentId = elem1Id;
880 f1.offset = 0;
881 tree.addNode(f1);
882
883 NullProvider prov;
884 ComposeResult result = compose(tree, prov);
885
886 // Must have content between header and footer (not empty!)

Callers

nothing calls this directly

Calls 3

composeFunction · 0.85
addNodeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected