mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
5a66807989
* First take at updating everything to v5 * Patch gRPC gateway to use prysm v5 Fix patch * Update go ssz --------- Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
30 lines
748 B
Go
30 lines
748 B
Go
package bytesutil_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
|
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
|
)
|
|
|
|
func TestIsHex(t *testing.T) {
|
|
tests := []struct {
|
|
a []byte
|
|
b bool
|
|
}{
|
|
{nil, false},
|
|
{[]byte(""), false},
|
|
{[]byte("0x"), false},
|
|
{[]byte("0x0"), true},
|
|
{[]byte("foo"), false},
|
|
{[]byte("1234567890abcDEF"), false},
|
|
{[]byte("XYZ4567890abcDEF1234567890abcDEF1234567890abcDEF1234567890abcDEF"), false},
|
|
{[]byte("0x1234567890abcDEF1234567890abcDEF1234567890abcDEF1234567890abcDEF"), true},
|
|
{[]byte("1234567890abcDEF1234567890abcDEF1234567890abcDEF1234567890abcDEF"), false},
|
|
}
|
|
for _, tt := range tests {
|
|
isHex := bytesutil.IsHex(tt.a)
|
|
assert.Equal(t, tt.b, isHex)
|
|
}
|
|
}
|