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

Function buildValidationTree

tests/test_validation.cpp:18–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16// ── Fixture: small tree with diverse field types ──
17
18static void buildValidationTree(NodeTree& tree) {
19 tree.baseAddress = 0x1000;
20
21 Node root;
22 root.kind = NodeKind::Struct;
23 root.structTypeName = "TestStruct";
24 root.name = "root";
25 root.parentId = 0;
26 root.offset = 0;
27 int ri = tree.addNode(root);
28 uint64_t rootId = tree.nodes[ri].id;
29
30 auto field = [&](int off, NodeKind k, const char* name) {
31 Node n;
32 n.kind = k; n.name = name;
33 n.parentId = rootId; n.offset = off;
34 tree.addNode(n);
35 };
36 auto fieldArr = [&](int off, NodeKind ek, int count, const char* name) {
37 Node n;
38 n.kind = NodeKind::Array; n.name = name;
39 n.parentId = rootId; n.offset = off;
40 n.arrayLen = count; n.elementKind = ek;
41 tree.addNode(n);
42 };
43
44 field(0, NodeKind::Int8, "field_i8");
45 field(1, NodeKind::UInt8, "field_u8");
46 field(2, NodeKind::Int16, "field_i16");
47 field(4, NodeKind::UInt16, "field_u16");
48 field(6, NodeKind::Int32, "field_i32");
49 field(10, NodeKind::UInt32, "field_u32");
50 field(14, NodeKind::Int64, "field_i64");
51 field(22, NodeKind::UInt64, "field_u64");
52 field(30, NodeKind::Float, "field_float");
53 field(34, NodeKind::Double, "field_dbl");
54 field(42, NodeKind::Bool, "field_bool");
55 field(43, NodeKind::Hex8, "field_h8");
56 field(44, NodeKind::Hex16, "field_h16");
57 field(46, NodeKind::Hex32, "field_h32");
58 field(50, NodeKind::Hex64, "field_h64");
59 field(58, NodeKind::Pointer64, "field_ptr");
60 field(66, NodeKind::Padding, "pad0");
61 tree.nodes.last().arrayLen = 6;
62 fieldArr(72, NodeKind::UInt32, 4, "field_arr");
63}
64
65static QByteArray makeValidationBuffer() {
66 QByteArray data(256, '\0');

Callers 1

initMethod · 0.85

Calls 1

addNodeMethod · 0.45

Tested by

no test coverage detected