Skip to content

Commit

Permalink
chore: add test cases for ValidateProof
Browse files Browse the repository at this point in the history
Signed-off-by: 170210 <j170210@icloud.com>
  • Loading branch information
170210 committed Mar 11, 2024
1 parent 6b7f777 commit 8ac1f7d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions crypto/ed25519/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,41 @@ func TestProofToHash(t *testing.T) {
}
}

func TestValidateProof(t *testing.T) {
cases := map[string]struct {
h []byte
valid bool
}{
"empty proof": {
h: []byte{},
valid: false,
},
"voi invalid proof": {
h: make([]byte, voivrf.ProofSize),
valid: true,
},
"r2ishiguro proof": {
h: make([]byte, r2vrf.ProofSize),
valid: true,
},
"invalid proof": {
h: make([]byte, 1),
valid: false,
},
}

for name, tc := range cases {
t.Run(name, func(t *testing.T) {
err := ed25519.ValidateProof(tc.h)
if !tc.valid {
require.Error(t, err)
return
}
require.NoError(t, err)
})
}
}

func TestVersionControl(t *testing.T) {
vrf := ed25519.NewVersionedVrfNoProve()

Expand Down

0 comments on commit 8ac1f7d

Please sign in to comment.