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)
| 249 | // └────┴────┴────┴────╚════╧════╧════╧════╧════╧════╧════╝ |
| 250 | // |
| 251 | func 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 | } |