github.com/gagliardetto/solana-go@v1.11.0/programs/token/Transfer_test.go (about) 1 // Copyright 2021 github.com/gagliardetto 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package token 16 17 import ( 18 "bytes" 19 "strconv" 20 "testing" 21 22 ag_gofuzz "github.com/gagliardetto/gofuzz" 23 ag_require "github.com/stretchr/testify/require" 24 ) 25 26 func TestEncodeDecode_Transfer(t *testing.T) { 27 fu := ag_gofuzz.New().NilChance(0) 28 for i := 0; i < 1; i++ { 29 t.Run("Transfer"+strconv.Itoa(i), func(t *testing.T) { 30 { 31 params := new(Transfer) 32 fu.Fuzz(params) 33 params.Accounts = nil 34 params.Signers = nil 35 buf := new(bytes.Buffer) 36 err := encodeT(*params, buf) 37 ag_require.NoError(t, err) 38 // 39 got := new(Transfer) 40 err = decodeT(got, buf.Bytes()) 41 got.Accounts = nil 42 params.Signers = nil 43 ag_require.NoError(t, err) 44 ag_require.Equal(t, params, got) 45 } 46 }) 47 } 48 }