(t *testing.T)
| 32 | } |
| 33 | |
| 34 | func TestConstantEncoderAlignment(t *testing.T) { |
| 35 | assert := assert.To(t) |
| 36 | |
| 37 | c := newConstantEncoder(&device.MemoryLayout{ |
| 38 | Endian: device.LittleEndian, |
| 39 | Pointer: &device.DataTypeLayout{Size: 4, Alignment: 8}, |
| 40 | Integer: &device.DataTypeLayout{Size: 4, Alignment: 4}, |
| 41 | Size: &device.DataTypeLayout{Size: 4, Alignment: 4}, |
| 42 | Char: &device.DataTypeLayout{Size: 1, Alignment: 4}, |
| 43 | I64: &device.DataTypeLayout{Size: 8, Alignment: 8}, |
| 44 | I32: &device.DataTypeLayout{Size: 4, Alignment: 4}, |
| 45 | I16: &device.DataTypeLayout{Size: 2, Alignment: 2}, |
| 46 | I8: &device.DataTypeLayout{Size: 1, Alignment: 1}, |
| 47 | F64: &device.DataTypeLayout{Size: 8, Alignment: 8}, |
| 48 | F32: &device.DataTypeLayout{Size: 4, Alignment: 4}, |
| 49 | F16: &device.DataTypeLayout{Size: 2, Alignment: 2}, |
| 50 | }) |
| 51 | |
| 52 | c.writeValues(value.U32(0x1234)) |
| 53 | c.writeValues(value.S16(-1)) |
| 54 | |
| 55 | expected := []byte{ |
| 56 | 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 57 | 0xff, 0xff, |
| 58 | } |
| 59 | |
| 60 | assert.For("data").That(c.data).DeepEquals(expected) |
| 61 | } |
nothing calls this directly
no test coverage detected