mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-29 09:27:36 +00:00
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)
|
|
}
|