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

39 lines
780 B

9 years ago
package assert
import (
"v2ray.com/core/common/serial"
9 years ago
)
8 years ago
func (v *Assert) Byte(value byte) *ByteSubject {
9 years ago
return &ByteSubject{
Subject: Subject{
disp: serial.ByteToHexString(value),
8 years ago
a: v,
9 years ago
},
value: value,
}
}
type ByteSubject struct {
Subject
value byte
}
func (subject *ByteSubject) Equals(expectation byte) {
if subject.value != expectation {
subject.Fail("is equal to", serial.ByteToHexString(expectation))
}
}
func (subject *ByteSubject) GreaterThan(expectation byte) {
if subject.value <= expectation {
subject.Fail("is greater than", serial.ByteToHexString(expectation))
}
}
func (subject *ByteSubject) LessThan(expectation byte) {
if subject.value >= expectation {
subject.Fail("is less than", serial.ByteToHexString(expectation))
}
}