You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
624 B

package types
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/bits"
)
func TestCopy(t *testing.T) {
t.Run("VerifyShallowCopy", func(t *testing.T) {
prsOne := PeerRoundState{}
prsOne.Prevotes = bits.NewBitArray(12)
prsTwo := prsOne
prsOne.Prevotes.SetIndex(1, true)
require.Equal(t, prsOne.Prevotes, prsTwo.Prevotes)
})
t.Run("DeepCopy", func(t *testing.T) {
prsOne := PeerRoundState{}
prsOne.Prevotes = bits.NewBitArray(12)
prsTwo := prsOne.Copy()
prsOne.Prevotes.SetIndex(1, true)
require.NotEqual(t, prsOne.Prevotes, prsTwo.Prevotes)
})
}