neo-go/pkg/core/state/notification_event_test.go

34 lines
852 B
Go
Raw Normal View History

package state
2019-11-26 15:47:07 +00:00
import (
"testing"
"github.com/nspcc-dev/neo-go/pkg/internal/random"
"github.com/nspcc-dev/neo-go/pkg/internal/testserdes"
"github.com/nspcc-dev/neo-go/pkg/vm"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
2019-11-26 15:47:07 +00:00
)
func TestEncodeDecodeNotificationEvent(t *testing.T) {
event := &NotificationEvent{
ScriptHash: random.Uint160(),
Name: "Event",
Item: stackitem.NewArray([]stackitem.Item{stackitem.NewBool(true)}),
2019-11-26 15:47:07 +00:00
}
testserdes.EncodeDecodeBinary(t, event, new(NotificationEvent))
2019-11-26 15:47:07 +00:00
}
func TestEncodeDecodeAppExecResult(t *testing.T) {
appExecResult := &AppExecResult{
TxHash: random.Uint256(),
2019-11-26 15:47:07 +00:00
Trigger: 1,
VMState: vm.HaltState,
2019-11-26 15:47:07 +00:00
GasConsumed: 10,
Stack: []stackitem.Item{},
2019-11-26 15:47:07 +00:00
Events: []NotificationEvent{},
}
testserdes.EncodeDecodeBinary(t, appExecResult, new(AppExecResult))
2019-11-26 15:47:07 +00:00
}