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

Function checkData

gapis/memory/pool_test.go:45–60  ·  view source on GitHub ↗
(ctx context.Context, s Data, expected []byte)

Source from the content-addressed store, hash-verified

43}
44
45func checkData(ctx context.Context, s Data, expected []byte) {
46 assert.For(ctx, "size").That(s.Size()).Equals(uint64(len(expected)))
47
48 for _, offset := range []uint64{0, 1, s.Size() - 1, s.Size()} {
49 got := make([]byte, len(expected)-int(offset))
50 err := s.Get(ctx, offset, got)
51 assert.For(ctx, "err").ThatError(err).Succeeded()
52 assert.For(ctx, "got").ThatSlice(got).Equals(expected[offset:])
53 }
54
55 for _, maxReadSize := range []int{1, 2, 3, 512} {
56 got, err := readFully(s.NewReader(ctx), maxReadSize)
57 assert.For(ctx, "err").ThatError(err).Succeeded()
58 assert.For(ctx, "got").ThatSlice(got).Equals(expected)
59 }
60}
61
62func TestBlobSlice(t *testing.T) {
63 ctx := log.Testing(t)

Callers 5

TestBlobSliceFunction · 0.85
TestPoolBlobWriteReadFunction · 0.85
TestSliceNestingFunction · 0.85

Calls 10

readFullyFunction · 0.85
ThatMethod · 0.80
ForMethod · 0.80
SucceededMethod · 0.80
ThatErrorMethod · 0.80
ThatSliceMethod · 0.80
EqualsMethod · 0.65
SizeMethod · 0.65
GetMethod · 0.65
NewReaderMethod · 0.65

Tested by

no test coverage detected