mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-30 15:01:35 +00:00
9abda40171
Frequently one needs to check if struct serializes/deserializes properly. This commit implements helpers for such cases including: 1. JSON 2. io.Serializable interface
32 lines
793 B
Go
32 lines
793 B
Go
package state
|
|
|
|
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/smartcontract"
|
|
"github.com/nspcc-dev/neo-go/pkg/vm"
|
|
)
|
|
|
|
func TestEncodeDecodeNotificationEvent(t *testing.T) {
|
|
event := &NotificationEvent{
|
|
ScriptHash: random.Uint160(),
|
|
Item: vm.NewBoolItem(true),
|
|
}
|
|
|
|
testserdes.EncodeDecodeBinary(t, event, new(NotificationEvent))
|
|
}
|
|
|
|
func TestEncodeDecodeAppExecResult(t *testing.T) {
|
|
appExecResult := &AppExecResult{
|
|
TxHash: random.Uint256(),
|
|
Trigger: 1,
|
|
VMState: "Hault",
|
|
GasConsumed: 10,
|
|
Stack: []smartcontract.Parameter{},
|
|
Events: []NotificationEvent{},
|
|
}
|
|
|
|
testserdes.EncodeDecodeBinary(t, appExecResult, new(AppExecResult))
|
|
}
|