Run each reference test individually in Go (#180)
* Run each reference test individually in Go * Fix other merge conflict issues
This commit is contained in:
parent
9e72862198
commit
db2fa8dcdb
|
@ -129,7 +129,7 @@ func TestBlobToKZGCommitment(t *testing.T) {
|
|||
tests, err := filepath.Glob(blobToKZGCommitmentTests)
|
||||
require.NoError(t, err)
|
||||
for _, testPath := range tests {
|
||||
t.Log(testPath)
|
||||
t.Run(testPath, func(t *testing.T) {
|
||||
testFile, err := os.Open(testPath)
|
||||
require.NoError(t, err)
|
||||
test := Test{}
|
||||
|
@ -141,7 +141,7 @@ func TestBlobToKZGCommitment(t *testing.T) {
|
|||
err = blob.UnmarshalText([]byte(test.Input.Blob))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
commitment, ret := BlobToKZGCommitment(blob)
|
||||
|
@ -151,6 +151,7 @@ func TestBlobToKZGCommitment(t *testing.T) {
|
|||
} else {
|
||||
require.Nil(t, test.Output)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +167,7 @@ func TestComputeKZGProof(t *testing.T) {
|
|||
tests, err := filepath.Glob(computeKZGProofTests)
|
||||
require.NoError(t, err)
|
||||
for _, testPath := range tests {
|
||||
t.Log(testPath)
|
||||
t.Run(testPath, func(t *testing.T) {
|
||||
testFile, err := os.Open(testPath)
|
||||
require.NoError(t, err)
|
||||
test := Test{}
|
||||
|
@ -178,14 +179,14 @@ func TestComputeKZGProof(t *testing.T) {
|
|||
err = blob.UnmarshalText([]byte(test.Input.Blob))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
var z Bytes32
|
||||
err = z.UnmarshalText([]byte(test.Input.Z))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
proof, y, ret := ComputeKZGProof(blob, z)
|
||||
|
@ -202,6 +203,7 @@ func TestComputeKZGProof(t *testing.T) {
|
|||
} else {
|
||||
require.Nil(t, test.Output)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +219,7 @@ func TestComputeBlobKZGProof(t *testing.T) {
|
|||
tests, err := filepath.Glob(computeBlobKZGProofTests)
|
||||
require.NoError(t, err)
|
||||
for _, testPath := range tests {
|
||||
t.Log(testPath)
|
||||
t.Run(testPath, func(t *testing.T) {
|
||||
testFile, err := os.Open(testPath)
|
||||
require.NoError(t, err)
|
||||
test := Test{}
|
||||
|
@ -229,14 +231,14 @@ func TestComputeBlobKZGProof(t *testing.T) {
|
|||
err = blob.UnmarshalText([]byte(test.Input.Blob))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
var commitment Bytes48
|
||||
err = commitment.UnmarshalText([]byte(test.Input.Commitment))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
proof, ret := ComputeBlobKZGProof(blob, commitment)
|
||||
|
@ -246,6 +248,7 @@ func TestComputeBlobKZGProof(t *testing.T) {
|
|||
} else {
|
||||
require.Nil(t, test.Output)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,7 +266,7 @@ func TestVerifyKZGProof(t *testing.T) {
|
|||
tests, err := filepath.Glob(verifyKZGProofTests)
|
||||
require.NoError(t, err)
|
||||
for _, testPath := range tests {
|
||||
t.Log(testPath)
|
||||
t.Run(testPath, func(t *testing.T) {
|
||||
testFile, err := os.Open(testPath)
|
||||
require.NoError(t, err)
|
||||
test := Test{}
|
||||
|
@ -275,28 +278,28 @@ func TestVerifyKZGProof(t *testing.T) {
|
|||
err = commitment.UnmarshalText([]byte(test.Input.Commitment))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
var z Bytes32
|
||||
err = z.UnmarshalText([]byte(test.Input.Z))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
var y Bytes32
|
||||
err = y.UnmarshalText([]byte(test.Input.Y))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
var proof Bytes48
|
||||
err = proof.UnmarshalText([]byte(test.Input.Proof))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
valid, ret := VerifyKZGProof(commitment, z, y, proof)
|
||||
|
@ -306,6 +309,7 @@ func TestVerifyKZGProof(t *testing.T) {
|
|||
} else {
|
||||
require.Nil(t, test.Output)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,7 +326,7 @@ func TestVerifyBlobKZGProof(t *testing.T) {
|
|||
tests, err := filepath.Glob(verifyBlobKZGProofTests)
|
||||
require.NoError(t, err)
|
||||
for _, testPath := range tests {
|
||||
t.Log(testPath)
|
||||
t.Run(testPath, func(t *testing.T) {
|
||||
testFile, err := os.Open(testPath)
|
||||
require.NoError(t, err)
|
||||
test := Test{}
|
||||
|
@ -334,21 +338,21 @@ func TestVerifyBlobKZGProof(t *testing.T) {
|
|||
err = blob.UnmarshalText([]byte(test.Input.Blob))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
var commitment Bytes48
|
||||
err = commitment.UnmarshalText([]byte(test.Input.Commitment))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
var proof Bytes48
|
||||
err = proof.UnmarshalText([]byte(test.Input.Proof))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
valid, ret := VerifyBlobKZGProof(blob, commitment, proof)
|
||||
|
@ -358,6 +362,7 @@ func TestVerifyBlobKZGProof(t *testing.T) {
|
|||
} else {
|
||||
require.Nil(t, test.Output)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,7 +379,7 @@ func TestVerifyBlobKZGProofBatch(t *testing.T) {
|
|||
tests, err := filepath.Glob(verifyBlobKZGProofBatchTests)
|
||||
require.NoError(t, err)
|
||||
for _, testPath := range tests {
|
||||
t.Log(testPath)
|
||||
t.Run(testPath, func(t *testing.T) {
|
||||
testFile, err := os.Open(testPath)
|
||||
require.NoError(t, err)
|
||||
test := Test{}
|
||||
|
@ -388,7 +393,7 @@ func TestVerifyBlobKZGProofBatch(t *testing.T) {
|
|||
err = blob.UnmarshalText([]byte(b))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
blobs = append(blobs, blob)
|
||||
}
|
||||
|
@ -399,7 +404,7 @@ func TestVerifyBlobKZGProofBatch(t *testing.T) {
|
|||
err = commitment.UnmarshalText([]byte(c))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
commitments = append(commitments, commitment)
|
||||
}
|
||||
|
@ -410,7 +415,7 @@ func TestVerifyBlobKZGProofBatch(t *testing.T) {
|
|||
err = proof.UnmarshalText([]byte(p))
|
||||
if err != nil {
|
||||
require.Nil(t, test.Output)
|
||||
continue
|
||||
return
|
||||
}
|
||||
proofs = append(proofs, proof)
|
||||
}
|
||||
|
@ -422,6 +427,7 @@ func TestVerifyBlobKZGProofBatch(t *testing.T) {
|
|||
} else {
|
||||
require.Nil(t, test.Output)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue