github.com/gagliardetto/solana-go@v1.11.0/programs/token/InitializeMint2_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  	ag_gofuzz "github.com/gagliardetto/gofuzz"
    20  	ag_require "github.com/stretchr/testify/require"
    21  	"strconv"
    22  	"testing"
    23  )
    24  
    25  func TestEncodeDecode_InitializeMint2(t *testing.T) {
    26  	fu := ag_gofuzz.New().NilChance(0)
    27  	for i := 0; i < 1; i++ {
    28  		t.Run("InitializeMint2"+strconv.Itoa(i), func(t *testing.T) {
    29  			{
    30  				params := new(InitializeMint2)
    31  				fu.Fuzz(params)
    32  				params.AccountMetaSlice = nil
    33  				buf := new(bytes.Buffer)
    34  				err := encodeT(*params, buf)
    35  				ag_require.NoError(t, err)
    36  				//
    37  				got := new(InitializeMint2)
    38  				err = decodeT(got, buf.Bytes())
    39  				got.AccountMetaSlice = nil
    40  				ag_require.NoError(t, err)
    41  				ag_require.Equal(t, params, got)
    42  			}
    43  		})
    44  	}
    45  }