2019-11-28 16:06:09 +00:00
|
|
|
package state
|
2019-11-26 15:47:07 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/internal/random"
|
2020-03-26 14:43:24 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/internal/testserdes"
|
2020-07-27 14:57:53 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/vm"
|
2020-06-03 12:55:06 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
2019-11-26 15:47:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestEncodeDecodeNotificationEvent(t *testing.T) {
|
|
|
|
event := &NotificationEvent{
|
2019-12-04 12:24:49 +00:00
|
|
|
ScriptHash: random.Uint160(),
|
2020-06-29 08:25:32 +00:00
|
|
|
Name: "Event",
|
|
|
|
Item: stackitem.NewArray([]stackitem.Item{stackitem.NewBool(true)}),
|
2019-11-26 15:47:07 +00:00
|
|
|
}
|
|
|
|
|
2020-03-26 14:43:24 +00:00
|
|
|
testserdes.EncodeDecodeBinary(t, event, new(NotificationEvent))
|
2019-11-26 15:47:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestEncodeDecodeAppExecResult(t *testing.T) {
|
|
|
|
appExecResult := &AppExecResult{
|
2019-12-04 12:24:49 +00:00
|
|
|
TxHash: random.Uint256(),
|
2019-11-26 15:47:07 +00:00
|
|
|
Trigger: 1,
|
2020-07-27 14:57:53 +00:00
|
|
|
VMState: vm.HaltState,
|
2019-11-26 15:47:07 +00:00
|
|
|
GasConsumed: 10,
|
2020-07-31 12:48:35 +00:00
|
|
|
Stack: []stackitem.Item{},
|
2019-11-26 15:47:07 +00:00
|
|
|
Events: []NotificationEvent{},
|
|
|
|
}
|
|
|
|
|
2020-03-26 14:43:24 +00:00
|
|
|
testserdes.EncodeDecodeBinary(t, appExecResult, new(AppExecResult))
|
2019-11-26 15:47:07 +00:00
|
|
|
}
|