| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 | package networkimport (	"testing")const (	testHex1 = "0x0a 0x0b 0x0c 0x0d"	testHex2 = "0a 0b 0c 0d")var (	testBytes = Bytes{0x0a, 0x0b, 0x0c, 0x0d})func TestHex2Bytes(t *testing.T) {	if b := String(testHex1).Hex(); b == nil {		t.Error("Hex2Bytes failed:", testHex1)		return	} else {		t.Logf("testHex1: %s === %v", testHex1, b)	}	if b := String(testHex2).Hex(); b == nil {		t.Error("Hex2Bytes failed:", testHex2)		return	} else {		t.Logf("testHex2: %s === %v", testHex2, b)	}}func TestRemake(t *testing.T) {	old := testBytes[:2] // question: len == 2, cap == 4	b := old.Remake()    // wants: len == 2, cap == 2	if len(b) != cap(b) {		t.Errorf("remake failed: len(%d), cap(%d)", len(b), cap(b))	}}func TestBytesEqual(t *testing.T) {	ok := Bytes{0xa, 0xb}.Equal(testBytes[:2])	if !ok {		t.Error("failed")	}}
 |