prysm-pulse/shared/iputils/external_ip_test.go
terence tsao 0544dd1f8e
Applies assertion funcs to shared tests (#6643)
* cmd tests
* deposit util tests
* feature config tests
* hashutil tests
* htr util tests
* interop tests
* ip util tests
2020-07-19 21:08:29 +00:00

21 lines
489 B
Go

package iputils_test
import (
"regexp"
"testing"
"github.com/prysmaticlabs/prysm/shared/iputils"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
func TestExternalIPv4(t *testing.T) {
// Regular expression format for IPv4
IPv4Format := `\.\d{1,3}\.\d{1,3}\b`
test, err := iputils.ExternalIPv4()
require.NoError(t, err)
valid := regexp.MustCompile(IPv4Format)
assert.Equal(t, true, valid.MatchString(test))
}