mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 04:57:17 +00:00
28 lines
436 B
Go
28 lines
436 B
Go
package hexutility
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
type marshalTest struct {
|
|
input interface{}
|
|
want string
|
|
}
|
|
|
|
var (
|
|
encodeBytesTests = []marshalTest{
|
|
{[]byte{}, "0x"},
|
|
{[]byte{0}, "0x00"},
|
|
{[]byte{0, 0, 1, 2}, "0x00000102"},
|
|
}
|
|
)
|
|
|
|
func TestEncode(t *testing.T) {
|
|
for _, test := range encodeBytesTests {
|
|
enc := Encode(test.input.([]byte))
|
|
if enc != test.want {
|
|
t.Errorf("input %x: wrong encoding %s", test.input, enc)
|
|
}
|
|
}
|
|
}
|