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

Function TestSliceNesting

gapis/memory/pool_test.go:251–269  ·  view source on GitHub ↗

Write layout: innerPool: 0 1 2 ┌────┬────┬────┐ 0 │ 4 │ 55 │ 66 │ └────┴────┴────┘ │ │ │ midPool: │ │ │ 0 1 2 3 4 5 6 7 ┌────╔════╤════╤════╗────┬────┬────┬────┐ 0 │ ║ 4i │ 55i│ 66i║ │ │ │ │ └──

(t *testing.T)

Source from the content-addressed store, hash-verified

249// └────┴────┴────┴────╚════╧════╧════╧════╧════╧════╧════╝
250//
251func TestSliceNesting(t *testing.T) {
252 ctx := log.Testing(t)
253 ctx = database.Put(ctx, database.NewInMemory(ctx))
254
255 innerPool := Pool{}
256 innerPool.Write(0, Blob([]byte{4, 55, 66}))
257
258 midPool := Pool{}
259 midPool.Write(1, innerPool.Slice(Range{Size: 3}))
260 midPool.Write(2, Blob([]byte{5, 6, 7, 88}))
261 res, _ := database.Store(ctx, []byte{8, 9, 10})
262 midPool.Write(5, Resource(res, 3))
263
264 outerPool := Pool{}
265 outerPool.Write(1, Blob([]byte{1, 2, 3, 44}))
266 outerPool.Write(4, midPool.Slice(Range{Base: 1, Size: 7}))
267
268 checkData(ctx, outerPool.Slice(Range{Size: 11}), []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10})
269}

Callers

nothing calls this directly

Calls 7

WriteMethod · 0.95
SliceMethod · 0.95
checkDataFunction · 0.85
BlobFunction · 0.70
ResourceFunction · 0.70
StoreMethod · 0.65
PutMethod · 0.45

Tested by

no test coverage detected