mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-03 15:55:20 -05:00
test cases for Equals()
This commit is contained in:
@@ -26,3 +26,35 @@ func TestUDPDestination(t *testing.T) {
|
||||
v2netassert.Destination(dest).IsUDP()
|
||||
assert.String(dest).Equals("udp:[2001:4860:4860::8888]:53")
|
||||
}
|
||||
|
||||
func TestTCPDestinationEquals(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
|
||||
dest := v2net.TCPDestination(v2net.IPAddress([]byte{1, 2, 3, 4}), 80)
|
||||
assert.Bool(dest.Equals(nil)).IsFalse()
|
||||
|
||||
dest2 := v2net.TCPDestination(v2net.IPAddress([]byte{1, 2, 3, 4}), 80)
|
||||
assert.Bool(dest.Equals(dest2)).IsTrue()
|
||||
|
||||
dest3 := v2net.UDPDestination(v2net.IPAddress([]byte{1, 2, 3, 4}), 80)
|
||||
assert.Bool(dest.Equals(dest3)).IsFalse()
|
||||
|
||||
dest4 := v2net.TCPDestination(v2net.DomainAddress("v2ray.com"), 80)
|
||||
assert.Bool(dest.Equals(dest4)).IsFalse()
|
||||
}
|
||||
|
||||
func TestUDPDestinationEquals(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
|
||||
dest := v2net.UDPDestination(v2net.IPAddress([]byte{1, 2, 3, 4}), 80)
|
||||
assert.Bool(dest.Equals(nil)).IsFalse()
|
||||
|
||||
dest2 := v2net.UDPDestination(v2net.IPAddress([]byte{1, 2, 3, 4}), 80)
|
||||
assert.Bool(dest.Equals(dest2)).IsTrue()
|
||||
|
||||
dest3 := v2net.TCPDestination(v2net.IPAddress([]byte{1, 2, 3, 4}), 80)
|
||||
assert.Bool(dest.Equals(dest3)).IsFalse()
|
||||
|
||||
dest4 := v2net.UDPDestination(v2net.DomainAddress("v2ray.com"), 80)
|
||||
assert.Bool(dest.Equals(dest4)).IsFalse()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user