You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/testing/assert/destination.go

59 lines
1.2 KiB

9 years ago
package assert
import (
v2net "v2ray.com/core/common/net"
9 years ago
)
9 years ago
func (this *Assert) Destination(value v2net.Destination) *DestinationSubject {
return &DestinationSubject{
Subject: Subject{
disp: value.String(),
a: this,
},
value: value,
}
9 years ago
}
type DestinationSubject struct {
Subject
9 years ago
value v2net.Destination
}
func (this *DestinationSubject) IsTCP() {
if this.value.Network != v2net.Network_TCP {
9 years ago
this.Fail("is", "a TCP destination")
9 years ago
}
}
func (this *DestinationSubject) IsNotTCP() {
if this.value.Network == v2net.Network_TCP {
9 years ago
this.Fail("is not", "a TCP destination")
9 years ago
}
}
func (this *DestinationSubject) IsUDP() {
if this.value.Network != v2net.Network_UDP {
9 years ago
this.Fail("is", "a UDP destination")
9 years ago
}
}
func (this *DestinationSubject) IsNotUDP() {
if this.value.Network == v2net.Network_UDP {
9 years ago
this.Fail("is not", "a UDP destination")
}
}
func (this *DestinationSubject) EqualsString(another string) {
if this.value.String() != another {
this.Fail("not equals to string", another)
9 years ago
}
}
9 years ago
func (this *DestinationSubject) HasAddress() *AddressSubject {
return this.a.Address(this.value.Address)
9 years ago
}
func (this *DestinationSubject) HasPort() *PortSubject {
return this.a.Port(this.value.Port)
9 years ago
}