1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00
v2fly/testing/assert/byte.go
2016-11-27 21:39:09 +01:00

39 lines
780 B
Go

package assert
import (
"v2ray.com/core/common/serial"
)
func (v *Assert) Byte(value byte) *ByteSubject {
return &ByteSubject{
Subject: Subject{
disp: serial.ByteToHexString(value),
a: v,
},
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))
}
}