MCPcopy Create free account
hub / github.com/akalin/gopar / testCoderReconstructDataNotEnough

Function testCoderReconstructDataNotEnough

rsec16/coder_test.go:231–262  ·  view source on GitHub ↗
(t *testing.T, newCoder func(int, int) (Coder, error))

Source from the content-addressed store, hash-verified

229}
230
231func 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
264func TestCoderReconstructDataNotEnough(t *testing.T) {
265 testCoder(t, testCoderReconstructDataNotEnough)

Callers

nothing calls this directly

Calls 3

makeTestDataFunction · 0.85
GenerateParityMethod · 0.80
ReconstructDataMethod · 0.80

Tested by

no test coverage detected