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