MCPcopy Create free account
hub / github.com/google/gapid / TestConstantEncoderAlignment

Function TestConstantEncoderAlignment

gapis/replay/builder/constant_encoder_test.go:34–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func 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}

Callers

nothing calls this directly

Calls 6

newConstantEncoderFunction · 0.85
writeValuesMethod · 0.80
ThatMethod · 0.80
ForMethod · 0.80
U32Method · 0.45
DeepEqualsMethod · 0.45

Tested by

no test coverage detected