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

Function testCoderReconstructDataMissingParity

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

Source from the content-addressed store, hash-verified

200}
201
202func 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
227func TestCoderReconstructDataMissingParity(t *testing.T) {
228 testCoder(t, testCoderReconstructDataMissingParity)

Callers

nothing calls this directly

Calls 3

makeTestDataFunction · 0.85
GenerateParityMethod · 0.80
ReconstructDataMethod · 0.80

Tested by

no test coverage detected