64-byte buffer with recognizable pattern
| 42 | |
| 43 | // 64-byte buffer with recognizable pattern |
| 44 | static QByteArray makeSmallBuffer() { |
| 45 | QByteArray data(64, '\0'); |
| 46 | // field_u32 at offset 0 = 0xDEADBEEF |
| 47 | uint32_t v32 = 0xDEADBEEF; |
| 48 | memcpy(data.data() + 0, &v32, 4); |
| 49 | // field_float at offset 4 = 3.14f |
| 50 | float vf = 3.14f; |
| 51 | memcpy(data.data() + 4, &vf, 4); |
| 52 | // field_u8 at offset 8 = 0x42 |
| 53 | data[8] = 0x42; |
| 54 | // pad0 at offset 9 = 0x00 0x00 0x00 |
| 55 | // field_hex at offset 12 = 0xCAFEBABE |
| 56 | uint32_t vhex = 0xCAFEBABE; |
| 57 | memcpy(data.data() + 12, &vhex, 4); |
| 58 | return data; |
| 59 | } |
| 60 | |
| 61 | class TestController : public QObject { |
| 62 | Q_OBJECT |