mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-30 05:56:54 -05:00
more tests on address
This commit is contained in:
parent
f9b31afa48
commit
80c5e1973c
@ -17,6 +17,7 @@ func TestIPv4Address(t *testing.T) {
|
|||||||
assert.Bool(addr.IsIPv4()).IsTrue()
|
assert.Bool(addr.IsIPv4()).IsTrue()
|
||||||
assert.Bytes(addr.IP).Equals(ip)
|
assert.Bytes(addr.IP).Equals(ip)
|
||||||
assert.Uint16(addr.Port).Equals(port)
|
assert.Uint16(addr.Port).Equals(port)
|
||||||
|
assert.String(addr.String()).Equals("1.2.3.4:80")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIPv6Address(t *testing.T) {
|
func TestIPv6Address(t *testing.T) {
|
||||||
@ -35,6 +36,7 @@ func TestIPv6Address(t *testing.T) {
|
|||||||
assert.Bool(addr.IsIPv6()).IsTrue()
|
assert.Bool(addr.IsIPv6()).IsTrue()
|
||||||
assert.Bytes(addr.IP).Equals(ip)
|
assert.Bytes(addr.IP).Equals(ip)
|
||||||
assert.Uint16(addr.Port).Equals(port)
|
assert.Uint16(addr.Port).Equals(port)
|
||||||
|
assert.String(addr.String()).Equals("[102:304:102:304:102:304:102:304]:443")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDomainAddress(t *testing.T) {
|
func TestDomainAddress(t *testing.T) {
|
||||||
@ -48,4 +50,5 @@ func TestDomainAddress(t *testing.T) {
|
|||||||
assert.Bool(addr.IsDomain()).IsTrue()
|
assert.Bool(addr.IsDomain()).IsTrue()
|
||||||
assert.String(addr.Domain).Equals(domain)
|
assert.String(addr.Domain).Equals(domain)
|
||||||
assert.Uint16(addr.Port).Equals(port)
|
assert.Uint16(addr.Port).Equals(port)
|
||||||
|
assert.String(addr.String()).Equals("v2ray.com:443")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user