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

Method testTailPadding

tests/test_generator.cpp:111–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109 // ── Tail padding ──
110
111 void testTailPadding() {
112 rcx::NodeTree tree;
113 rcx::Node root;
114 root.kind = rcx::NodeKind::Struct;
115 root.name = "TailPad";
116 root.structTypeName = "TailPad";
117 root.parentId = 0;
118 int ri = tree.addNode(root);
119 uint64_t rootId = tree.nodes[ri].id;
120
121 // Only field at offset 0, size 1
122 rcx::Node f1;
123 f1.kind = rcx::NodeKind::UInt8;
124 f1.name = "flag";
125 f1.parentId = rootId;
126 f1.offset = 0;
127 tree.addNode(f1);
128
129 // Add another field at offset 16 to make struct bigger
130 rcx::Node f2;
131 f2.kind = rcx::NodeKind::UInt8;
132 f2.name = "end";
133 f2.parentId = rootId;
134 f2.offset = 16;
135 tree.addNode(f2);
136
137 QString result = rcx::renderCpp(tree, rootId);
138
139 // Gap between offset 1 and 16 = 15 bytes padding
140 QVERIFY(result.contains("[0xF]"));
141 // Total size = 17
142 QVERIFY(result.contains("static_assert(sizeof(TailPad) == 0x11"));
143 }
144
145 // ── Overlap warning ──
146

Callers

nothing calls this directly

Calls 2

renderCppFunction · 0.85
addNodeMethod · 0.45

Tested by

no test coverage detected