(t *testing.T)
| 118 | } |
| 119 | |
| 120 | func TestChunkQueue_Add_ChunkErrors(t *testing.T) { |
| 121 | testcases := map[string]struct { |
| 122 | chunk *chunk |
| 123 | }{ |
| 124 | "nil chunk": {nil}, |
| 125 | "nil body": {&chunk{Height: 3, Format: 1, Index: 0, Chunk: nil}}, |
| 126 | "wrong height": {&chunk{Height: 9, Format: 1, Index: 0, Chunk: []byte{3, 1, 0}}}, |
| 127 | "wrong format": {&chunk{Height: 3, Format: 9, Index: 0, Chunk: []byte{3, 1, 0}}}, |
| 128 | "invalid index": {&chunk{Height: 3, Format: 1, Index: 5, Chunk: []byte{3, 1, 0}}}, |
| 129 | } |
| 130 | for name, tc := range testcases { |
| 131 | tc := tc |
| 132 | t.Run(name, func(t *testing.T) { |
| 133 | queue, teardown := setupChunkQueue(t) |
| 134 | defer teardown() |
| 135 | _, err := queue.Add(tc.chunk) |
| 136 | require.Error(t, err) |
| 137 | }) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func TestChunkQueue_Allocate(t *testing.T) { |
| 142 | queue, teardown := setupChunkQueue(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…