(t *testing.T, newCoder func(int, int) (Coder, error))
| 229 | } |
| 230 | |
| 231 | func testCoderReconstructDataNotEnough(t *testing.T, newCoder func(int, int) (Coder, error)) { |
| 232 | data := makeTestData() |
| 233 | c, err := newCoder(5, 3) |
| 234 | require.NoError(t, err) |
| 235 | parity := c.GenerateParity(data) |
| 236 | |
| 237 | corruptData := [][]byte{ |
| 238 | data[0], |
| 239 | nil, |
| 240 | nil, |
| 241 | nil, |
| 242 | nil, |
| 243 | } |
| 244 | expectedErr := NotEnoughParityShardsError{} |
| 245 | err = c.ReconstructData(corruptData, parity) |
| 246 | require.Equal(t, expectedErr, err) |
| 247 | |
| 248 | corruptData = [][]byte{ |
| 249 | data[0], |
| 250 | data[1], |
| 251 | nil, |
| 252 | nil, |
| 253 | nil, |
| 254 | } |
| 255 | corruptParity := [][]byte{ |
| 256 | nil, |
| 257 | parity[1], |
| 258 | parity[2], |
| 259 | } |
| 260 | err = c.ReconstructData(corruptData, corruptParity) |
| 261 | require.Equal(t, expectedErr, err) |
| 262 | } |
| 263 | |
| 264 | func TestCoderReconstructDataNotEnough(t *testing.T) { |
| 265 | testCoder(t, testCoderReconstructDataNotEnough) |
nothing calls this directly
no test coverage detected