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/uint16.go

51 lines
1022 B

9 years ago
package assert
import (
"v2ray.com/core/common/serial"
9 years ago
)
8 years ago
func (v *Assert) Uint16(value uint16) *Uint16Subject {
9 years ago
return &Uint16Subject{
Subject: Subject{
8 years ago
a: v,
9 years ago
disp: serial.Uint16ToString(value),
},
value: value,
}
}
type Uint16Subject struct {
Subject
value uint16
}
func (subject *Uint16Subject) Equals(expectation uint16) {
if subject.value != expectation {
subject.Fail("is equal to", serial.Uint16ToString(expectation))
}
}
func (subject *Uint16Subject) GreaterThan(expectation uint16) {
if subject.value <= expectation {
subject.Fail("is greater than", serial.Uint16ToString(expectation))
}
}
func (subject *Uint16Subject) LessThan(expectation uint16) {
if subject.value >= expectation {
subject.Fail("is less than", serial.Uint16ToString(expectation))
}
}
func (subject *Uint16Subject) IsPositive() {
if subject.value <= 0 {
subject.Fail("is", "positive")
}
}
func (subject *Uint16Subject) IsNegative() {
if subject.value >= 0 {
subject.Fail("is not", "negative")
}
}