fix: rename test suite

This commit is contained in:
Richard Ramos 2022-07-06 11:12:31 -04:00
parent 7497b77073
commit f6ea3a73ab
No known key found for this signature in database
GPG Key ID: BD36D48BC9FFC88C
1 changed files with 16 additions and 16 deletions

View File

@ -10,17 +10,17 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
) )
func TestWakuRLNRelaySuite(t *testing.T) { func TestRLNSuite(t *testing.T) {
suite.Run(t, new(WakuRLNRelaySuite)) suite.Run(t, new(RLNSuite))
} }
type WakuRLNRelaySuite struct { type RLNSuite struct {
suite.Suite suite.Suite
parameters []byte parameters []byte
} }
func (s *WakuRLNRelaySuite) SetupTest() { func (s *RLNSuite) SetupTest() {
// parameters.key contains the prover and verifier keys // parameters.key contains the prover and verifier keys
// to generate this file, clone this repo https://github.com/kilic/rln // to generate this file, clone this repo https://github.com/kilic/rln
// and run the following command in the root directory of the cloned project // and run the following command in the root directory of the cloned project
@ -38,7 +38,7 @@ func (s *WakuRLNRelaySuite) SetupTest() {
s.parameters = params s.parameters = params
} }
func (s *WakuRLNRelaySuite) TestMembershipKeyGen() { func (s *RLNSuite) TestMembershipKeyGen() {
rln, err := NewRLNWithDepth(32, s.parameters) rln, err := NewRLNWithDepth(32, s.parameters)
s.NoError(err) s.NoError(err)
@ -52,7 +52,7 @@ func (s *WakuRLNRelaySuite) TestMembershipKeyGen() {
s.False(bytes.Equal(key.IDKey[:], make([]byte, 32))) s.False(bytes.Equal(key.IDKey[:], make([]byte, 32)))
} }
func (s *WakuRLNRelaySuite) TestGetMerkleRoot() { func (s *RLNSuite) TestGetMerkleRoot() {
rln, err := NewRLNWithDepth(32, s.parameters) rln, err := NewRLNWithDepth(32, s.parameters)
s.NoError(err) s.NoError(err)
@ -67,7 +67,7 @@ func (s *WakuRLNRelaySuite) TestGetMerkleRoot() {
s.Equal(root1, root2) s.Equal(root1, root2)
} }
func (s *WakuRLNRelaySuite) TestInsertMember() { func (s *RLNSuite) TestInsertMember() {
rln, err := NewRLNWithDepth(32, s.parameters) rln, err := NewRLNWithDepth(32, s.parameters)
s.NoError(err) s.NoError(err)
@ -78,7 +78,7 @@ func (s *WakuRLNRelaySuite) TestInsertMember() {
s.True(inserted) s.True(inserted)
} }
func (s *WakuRLNRelaySuite) TestRemoveMember() { func (s *RLNSuite) TestRemoveMember() {
rln, err := NewRLNWithDepth(32, s.parameters) rln, err := NewRLNWithDepth(32, s.parameters)
s.NoError(err) s.NoError(err)
@ -86,7 +86,7 @@ func (s *WakuRLNRelaySuite) TestRemoveMember() {
s.True(deleted) s.True(deleted)
} }
func (s *WakuRLNRelaySuite) TestMerkleTreeConsistenceBetweenDeletionAndInsertion() { func (s *RLNSuite) TestMerkleTreeConsistenceBetweenDeletionAndInsertion() {
rln, err := NewRLNWithDepth(32, s.parameters) rln, err := NewRLNWithDepth(32, s.parameters)
s.NoError(err) s.NoError(err)
@ -123,7 +123,7 @@ func (s *WakuRLNRelaySuite) TestMerkleTreeConsistenceBetweenDeletionAndInsertion
s.Equal(root1, root3) s.Equal(root1, root3)
} }
func (s *WakuRLNRelaySuite) TestHash() { func (s *RLNSuite) TestHash() {
rln, err := NewRLNWithDepth(32, s.parameters) rln, err := NewRLNWithDepth(32, s.parameters)
s.NoError(err) s.NoError(err)
@ -137,7 +137,7 @@ func (s *WakuRLNRelaySuite) TestHash() {
s.Equal(expectedHash, hash[:]) s.Equal(expectedHash, hash[:])
} }
func (s *WakuRLNRelaySuite) TestCreateListMembershipKeysAndCreateMerkleTreeFromList() { func (s *RLNSuite) TestCreateListMembershipKeysAndCreateMerkleTreeFromList() {
groupSize := 100 groupSize := 100
list, root, err := CreateMembershipList(groupSize, s.parameters) list, root, err := CreateMembershipList(groupSize, s.parameters)
s.NoError(err) s.NoError(err)
@ -145,7 +145,7 @@ func (s *WakuRLNRelaySuite) TestCreateListMembershipKeysAndCreateMerkleTreeFromL
s.Len(root, HASH_HEX_SIZE) // check the size of the calculated tree root s.Len(root, HASH_HEX_SIZE) // check the size of the calculated tree root
} }
func (s *WakuRLNRelaySuite) TestCheckCorrectness() { func (s *RLNSuite) TestCheckCorrectness() {
groupKeys := STATIC_GROUP_KEYS groupKeys := STATIC_GROUP_KEYS
// create a set of MembershipKeyPair objects from groupKeys // create a set of MembershipKeyPair objects from groupKeys
@ -168,7 +168,7 @@ func (s *WakuRLNRelaySuite) TestCheckCorrectness() {
s.Equal(expectedRoot, root[:]) s.Equal(expectedRoot, root[:])
} }
func (s *WakuRLNRelaySuite) TestValidProof() { func (s *RLNSuite) TestValidProof() {
rln, err := NewRLN(s.parameters) rln, err := NewRLN(s.parameters)
s.NoError(err) s.NoError(err)
@ -210,7 +210,7 @@ func (s *WakuRLNRelaySuite) TestValidProof() {
s.True(verified) s.True(verified)
} }
func (s *WakuRLNRelaySuite) TestInvalidProof() { func (s *RLNSuite) TestInvalidProof() {
rln, err := NewRLN(s.parameters) rln, err := NewRLN(s.parameters)
s.NoError(err) s.NoError(err)
@ -254,7 +254,7 @@ func (s *WakuRLNRelaySuite) TestInvalidProof() {
s.False(verified) s.False(verified)
} }
func (s *WakuRLNRelaySuite) TestEpochConsistency() { func (s *RLNSuite) TestEpochConsistency() {
// check edge cases // check edge cases
var epoch uint64 = math.MaxUint64 var epoch uint64 = math.MaxUint64
epochBytes := ToEpoch(epoch) epochBytes := ToEpoch(epoch)
@ -263,7 +263,7 @@ func (s *WakuRLNRelaySuite) TestEpochConsistency() {
s.Equal(epoch, decodedEpoch) s.Equal(epoch, decodedEpoch)
} }
func (s *WakuRLNRelaySuite) TestEpochComparison() { func (s *RLNSuite) TestEpochComparison() {
// check edge cases // check edge cases
var time1 uint64 = math.MaxUint64 var time1 uint64 = math.MaxUint64
var time2 uint64 = math.MaxUint64 - 1 var time2 uint64 = math.MaxUint64 - 1