mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
0544dd1f8e
* cmd tests * deposit util tests * feature config tests * hashutil tests * htr util tests * interop tests * ip util tests
21 lines
489 B
Go
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))
|
|
}
|