1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-04 09:17:32 -05:00

more tests on address

This commit is contained in:
V2Ray 2015-09-16 22:24:04 +02:00
parent f9b31afa48
commit 80c5e1973c

View File

@ -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")
} }