neoneo-go/pkg/smartcontract/trigger/trigger_type_test.go
Anna Shaleva 7d46404e2d smartcontract: turn trigger types into Type
1) Turn trigger types from byte constants into Type
2) Add auto-generated stringer for future purposes
2020-03-02 17:25:27 +03:00

43 lines
782 B
Go

package trigger
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestStringer(t *testing.T) {
tests := map[Type]string{
Application: "Application",
ApplicationR: "ApplicationR",
Verification: "Verification",
VerificationR: "VerificationR",
}
for o, s := range tests {
assert.Equal(t, s, o.String())
}
}
func TestEncodeBynary(t *testing.T) {
tests := map[Type]byte{
Verification: 0x00,
VerificationR: 0x01,
Application: 0x10,
ApplicationR: 0x11,
}
for o, b := range tests {
assert.Equal(t, b, byte(o))
}
}
func TestDecodeBynary(t *testing.T) {
tests := map[Type]byte{
Verification: 0x00,
VerificationR: 0x01,
Application: 0x10,
ApplicationR: 0x11,
}
for o, b := range tests {
assert.Equal(t, o, Type(b))
}
}