forked from TrueCloudLab/neoneo-go
aab18c3083
We have a lot of native contract types that are converted to stack items before serialization, then deserialized as stack items and converted back to regular structures. stackitem.Convertible allows to remove a lot of repetitive io.Serializable code. This also introduces to/from converter in testserdes which unfortunately required to change util tests to avoid circular references.
17 lines
302 B
Go
17 lines
302 B
Go
package native
|
|
|
|
import (
|
|
"math/big"
|
|
"testing"
|
|
|
|
"github.com/nspcc-dev/neo-go/internal/testserdes"
|
|
)
|
|
|
|
func TestCandidate_Bytes(t *testing.T) {
|
|
expected := &candidate{
|
|
Registered: true,
|
|
Votes: *big.NewInt(0x0F),
|
|
}
|
|
actual := new(candidate)
|
|
testserdes.ToFromStackItem(t, expected, actual)
|
|
}
|