(t *testing.T, newCoder func(int, int) (Coder, error))
| 200 | } |
| 201 | |
| 202 | func testCoderReconstructDataMissingParity(t *testing.T, newCoder func(int, int) (Coder, error)) { |
| 203 | data := makeTestData() |
| 204 | c, err := newCoder(5, 3) |
| 205 | require.NoError(t, err) |
| 206 | parity := c.GenerateParity(data) |
| 207 | |
| 208 | corruptData := [][]byte{ |
| 209 | data[0], |
| 210 | nil, |
| 211 | data[2], |
| 212 | data[3], |
| 213 | nil, |
| 214 | } |
| 215 | corruptParity := [][]byte{ |
| 216 | nil, |
| 217 | parity[1], |
| 218 | parity[2], |
| 219 | } |
| 220 | |
| 221 | dataToReconstruct := corruptData[:] |
| 222 | err = c.ReconstructData(dataToReconstruct, corruptParity) |
| 223 | require.NoError(t, err) |
| 224 | require.Equal(t, data, dataToReconstruct) |
| 225 | } |
| 226 | |
| 227 | func TestCoderReconstructDataMissingParity(t *testing.T) { |
| 228 | testCoder(t, testCoderReconstructDataMissingParity) |
nothing calls this directly
no test coverage detected