mirror of
https://github.com/luxfi/utxo.git
synced 2026-10-30 15:13:57 +00:00
48 lines
1.0 KiB
Go
48 lines
1.0 KiB
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package nftfx
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/utxo/secp256k1fx"
|
|
"github.com/luxfi/vm/components/verify"
|
|
)
|
|
|
|
func TestTransferOutputVerifyNil(t *testing.T) {
|
|
to := (*TransferOutput)(nil)
|
|
err := to.Verify()
|
|
require.ErrorIs(t, err, errNilTransferOutput)
|
|
}
|
|
|
|
func TestTransferOutputLargePayload(t *testing.T) {
|
|
to := TransferOutput{
|
|
Payload: make([]byte, MaxPayloadSize+1),
|
|
}
|
|
err := to.Verify()
|
|
require.ErrorIs(t, err, errPayloadTooLarge)
|
|
}
|
|
|
|
func TestTransferOutputInvalidSecp256k1Output(t *testing.T) {
|
|
to := TransferOutput{
|
|
OutputOwners: secp256k1fx.OutputOwners{
|
|
Addrs: []ids.ShortID{
|
|
ids.ShortEmpty,
|
|
ids.ShortEmpty,
|
|
},
|
|
},
|
|
}
|
|
err := to.Verify()
|
|
require.ErrorIs(t, err, secp256k1fx.ErrOutputUnoptimized)
|
|
}
|
|
|
|
func TestTransferOutputState(t *testing.T) {
|
|
intf := interface{}(&TransferOutput{})
|
|
_, ok := intf.(verify.State)
|
|
require.True(t, ok)
|
|
}
|