cosmos-sdk/collections/values_test.go
Aaron Craelius b3c750ca27
feat(collections): genesis support (#14331)
Co-authored-by: testinginprod <testinginprod@somewhere.idk>
Co-authored-by: testinginprod <98415576+testinginprod@users.noreply.github.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Rafael Tenfen <rafaeltenfen.rt@gmail.com>
Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>
Co-authored-by: Jacob Gadikian <faddat@users.noreply.github.com>
Co-authored-by: samricotta <37125168+samricotta@users.noreply.github.com>
Co-authored-by: Noel Ukwa <noeluchechukwu@gmail.com>
Co-authored-by: JayT106 <JayT106@users.noreply.github.com>
Co-authored-by: Julián Toledano <JulianToledano@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Denver <aeharvlee@gmail.com>
Co-authored-by: Hyunwoo Lee <denver@Hyunwoos-MacBook-Pro-2.local>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com>
Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com>
Co-authored-by: cipherZ <dev@cipherz.com>
2023-01-17 11:25:10 +00:00

29 lines
582 B
Go

package collections
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestUint64Value(t *testing.T) {
t.Run("bijective", func(t *testing.T) {
checkValueCodec(t, Uint64Value, 555)
})
t.Run("invalid size", func(t *testing.T) {
_, err := Uint64Value.Decode([]byte{0x1, 0x2})
require.ErrorIs(t, err, ErrEncoding)
})
}
func TestUInt64JSON(t *testing.T) {
var x uint64 = 3076
bz, err := uint64EncodeJSON(x)
require.NoError(t, err)
require.Equal(t, []byte(`"3076"`), bz)
y, err := uint64DecodeJSON(bz)
require.NoError(t, err)
require.Equal(t, x, y)
}