-
Notifications
You must be signed in to change notification settings - Fork 0
/
uint16.go
50 lines (42 loc) · 1 KB
/
uint16.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
39
40
41
42
43
44
45
46
47
48
49
50
package assert
import (
"v2ray.com/core/common/serial"
)
func (this *Assert) Uint16(value uint16) *Uint16Subject {
return &Uint16Subject{
Subject: Subject{
a: this,
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")
}
}