-
Notifications
You must be signed in to change notification settings - Fork 0
/
uint32.go
50 lines (42 loc) · 1022 Bytes
/
uint32.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 (v *Assert) Uint32(value uint32) *Uint32Subject {
return &Uint32Subject{
Subject: Subject{
a: v,
disp: serial.Uint32ToString(value),
},
value: value,
}
}
type Uint32Subject struct {
Subject
value uint32
}
func (subject *Uint32Subject) Equals(expectation uint32) {
if subject.value != expectation {
subject.Fail("is equal to", serial.Uint32ToString(expectation))
}
}
func (subject *Uint32Subject) GreaterThan(expectation uint32) {
if subject.value <= expectation {
subject.Fail("is greater than", serial.Uint32ToString(expectation))
}
}
func (subject *Uint32Subject) LessThan(expectation uint32) {
if subject.value >= expectation {
subject.Fail("is less than", serial.Uint32ToString(expectation))
}
}
func (subject *Uint32Subject) IsPositive() {
if subject.value <= 0 {
subject.Fail("is", "positive")
}
}
func (subject *Uint32Subject) IsNegative() {
if subject.value >= 0 {
subject.Fail("is not", "negative")
}
}