This commit is contained in:
Geoff Stuart 2022-12-14 15:26:58 -05:00
parent 442132be70
commit 3497b53b88
2 changed files with 8 additions and 6 deletions

View File

@ -9,12 +9,15 @@ import (
"github.com/stretchr/testify/require"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/types/ethtypes"
)
type TestCase struct {
Input interface{}
Output interface{}
}
func TestEncode(t *testing.T) {
testcases := []ethtypes.TestCase{
testcases := []TestCase{
{[]byte(""), mustDecodeHex("0x80")},
{mustDecodeHex("0x01"), mustDecodeHex("0x01")},
{mustDecodeHex("0xaa"), mustDecodeHex("0x81aa")},
@ -66,7 +69,7 @@ func TestEncode(t *testing.T) {
}
func TestDecodeString(t *testing.T) {
testcases := []ethtypes.TestCase{
testcases := []TestCase{
{"0x00", "0x00"},
{"0x80", "0x"},
{"0x0f", "0x0f"},
@ -98,7 +101,7 @@ func mustDecodeHex(s string) []byte {
}
func TestDecodeList(t *testing.T) {
testcases := []ethtypes.TestCase{
testcases := []TestCase{
{"0xc0", []interface{}{}},
{"0xc100", []interface{}{[]byte{0}}},
{"0xc3000102", []interface{}{[]byte{0}, []byte{1}, []byte{2}}},

View File

@ -1,4 +1,3 @@
// stm: #unit
package ethtypes
import (