// Tests erasure decoding functionality for various types of inputs.
funcTestErasureDecode(t*testing.T){
data:=[]byte("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.")
// List of decoding cases
// - validates bad encoded data.
// - validates good encoded data.
// - validates insufficient data.
testDecodeCases:=[]struct{
enFnfunc([]byte,int,int)[][]byte
shouldPassbool
}{
// Generates bad encoded data.
{
enFn:getBadEncodedData,
shouldPass:false,
},
// Generates good encoded data.
{
enFn:getGoodEncodedData,
shouldPass:true,
},
// Generates missing data.
{
enFn:getMissingData,
shouldPass:false,
},
// Generates short data.
{
enFn:getInsufficientData,
shouldPass:false,
},
}
// Validates all decode tests.
fori,testCase:=rangetestDecodeCases{
for_,encodingMatrix:=rangeencodingMatrices{
// Encoding matrix.
dataBlocks:=encodingMatrix.dataBlocks
parityBlocks:=encodingMatrix.parityBlocks
// Data block size.
blockSize:=len(data)
// Generates encoded data based on type of testCase function.