github.com/MetalBlockchain/metalgo@v1.11.9/vms/secp256k1fx/mint_output_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 secp256k1fx 5 6 import ( 7 "testing" 8 9 "github.com/stretchr/testify/require" 10 11 "github.com/MetalBlockchain/metalgo/ids" 12 ) 13 14 func TestMintOutputVerify(t *testing.T) { 15 tests := []struct { 16 name string 17 out *MintOutput 18 expectedErr error 19 }{ 20 { 21 name: "nil", 22 out: nil, 23 expectedErr: ErrNilOutput, 24 }, 25 { 26 name: "invalid output owners", 27 out: &MintOutput{ 28 OutputOwners: OutputOwners{ 29 Threshold: 2, 30 Addrs: []ids.ShortID{ids.GenerateTestShortID()}, 31 }, 32 }, 33 expectedErr: ErrOutputUnspendable, 34 }, 35 { 36 name: "passes verification", 37 out: &MintOutput{ 38 OutputOwners: OutputOwners{ 39 Threshold: 1, 40 Addrs: []ids.ShortID{ids.GenerateTestShortID()}, 41 }, 42 }, 43 expectedErr: nil, 44 }, 45 } 46 47 for _, tt := range tests { 48 t.Run(tt.name, func(t *testing.T) { 49 require := require.New(t) 50 err := tt.out.Verify() 51 require.ErrorIs(err, tt.expectedErr) 52 }) 53 } 54 }