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

Function testCoderReconstructData

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

Source from the content-addressed store, hash-verified

177}
178
179func testCoderReconstructData(t *testing.T, newCoder func(int, int) (Coder, error)) {
180 data := makeTestData()
181 c, err := newCoder(5, 3)
182 require.NoError(t, err)
183 parity := c.GenerateParity(data)
184
185 corruptData := [][]byte{
186 nil,
187 data[1],
188 nil,
189 data[3],
190 nil,
191 }
192 dataToReconstruct := corruptData[:]
193 err = c.ReconstructData(dataToReconstruct, parity)
194 require.NoError(t, err)
195 require.Equal(t, data, dataToReconstruct)
196}
197
198func TestCoderReconstructData(t *testing.T) {
199 testCoder(t, testCoderReconstructData)

Callers

nothing calls this directly

Calls 3

makeTestDataFunction · 0.85
GenerateParityMethod · 0.80
ReconstructDataMethod · 0.80

Tested by

no test coverage detected