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

Method testComputeStructAlignment

tests/test_compose.cpp:1924–1954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1922 }
1923
1924 void testComputeStructAlignment() {
1925 NodeTree tree;
1926 tree.baseAddress = 0;
1927
1928 Node root;
1929 root.kind = NodeKind::Struct;
1930 root.name = "Root";
1931 root.parentId = 0;
1932 int ri = tree.addNode(root);
1933 uint64_t rootId = tree.nodes[ri].id;
1934
1935 // Int32 has alignment 4
1936 Node f1;
1937 f1.kind = NodeKind::Int32;
1938 f1.name = "a";
1939 f1.parentId = rootId;
1940 f1.offset = 0;
1941 tree.addNode(f1);
1942
1943 QCOMPARE(tree.computeStructAlignment(rootId), 4);
1944
1945 // Add Hex64 (alignment 8) — max should become 8
1946 Node f2;
1947 f2.kind = NodeKind::Hex64;
1948 f2.name = "b";
1949 f2.parentId = rootId;
1950 f2.offset = 8;
1951 tree.addNode(f2);
1952
1953 QCOMPARE(tree.computeStructAlignment(rootId), 8);
1954 }
1955
1956 void testComputeStructAlignmentEmpty() {
1957 NodeTree tree;

Callers

nothing calls this directly

Calls 2

addNodeMethod · 0.45

Tested by

no test coverage detected