-
Notifications
You must be signed in to change notification settings - Fork 0
/
byte.go
38 lines (32 loc) · 799 Bytes
/
byte.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package assert
import (
"github.com/v2ray/v2ray-core/common/serial"
)
func (this *Assert) Byte(value byte) *ByteSubject {
return &ByteSubject{
Subject: Subject{
disp: serial.ByteToHexString(value),
a: this,
},
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))
}
}