mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-05 09:14:28 +00:00
34 lines
811 B
Go
34 lines
811 B
Go
|
package bls
|
||
|
|
||
|
import (
|
||
|
"encoding/hex"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/ghodss/yaml"
|
||
|
"github.com/prysmaticlabs/prysm/crypto/bls"
|
||
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||
|
"github.com/prysmaticlabs/prysm/testing/bls/utils"
|
||
|
)
|
||
|
|
||
|
func TestDeserializationG2(t *testing.T) {
|
||
|
t.Run("blst", testDeserializationG2)
|
||
|
}
|
||
|
|
||
|
func testDeserializationG2(t *testing.T) {
|
||
|
fNames, fContent := utils.RetrieveFiles("deserialization_G2", t)
|
||
|
|
||
|
for i, file := range fNames {
|
||
|
content := fContent[i]
|
||
|
t.Run(file, func(t *testing.T) {
|
||
|
test := &DeserializationG2Test{}
|
||
|
require.NoError(t, yaml.Unmarshal(content, test))
|
||
|
rawKey, err := hex.DecodeString(test.Input.Signature)
|
||
|
require.NoError(t, err)
|
||
|
|
||
|
_, err = bls.SignatureFromBytes(rawKey)
|
||
|
require.Equal(t, test.Output, err == nil)
|
||
|
t.Log("Success")
|
||
|
})
|
||
|
}
|
||
|
}
|