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-03-23 12:03:37 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
2020-03-26 14:43:24 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/vm"
|
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-03-26 14:43:24 +00:00
|
|
|
Item: vm.NewBoolItem(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,
|
|
|
|
VMState: "Hault",
|
|
|
|
GasConsumed: 10,
|
2020-03-23 12:03:37 +00:00
|
|
|
Stack: []smartcontract.Parameter{},
|
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
|
|
|
}
|