github.com/ava-labs/avalanchego@v1.11.11/vms/example/xsvm/genesis/genesis_test.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package genesis 5 6 import ( 7 "testing" 8 9 "github.com/stretchr/testify/require" 10 11 "github.com/ava-labs/avalanchego/ids" 12 ) 13 14 func TestGenesis(t *testing.T) { 15 require := require.New(t) 16 17 id, err := ids.ShortFromString("6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV") 18 require.NoError(err) 19 id2, err := ids.ShortFromString("LeKrndtsMxcLMzHz3w4uo1XtLDpfi66c") 20 require.NoError(err) 21 22 genesis := Genesis{ 23 Timestamp: 123, 24 Allocations: []Allocation{ 25 {Address: id, Balance: 1000000000}, 26 {Address: id2, Balance: 3000000000}, 27 }, 28 } 29 bytes, err := Codec.Marshal(CodecVersion, genesis) 30 require.NoError(err) 31 32 parsed, err := Parse(bytes) 33 require.NoError(err) 34 require.Equal(genesis, *parsed) 35 }