-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
expect_uint32_gen.go
123 lines (109 loc) · 4.98 KB
/
expect_uint32_gen.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// +build !generate_numeric
package hit
import minitest "github.com/Eun/go-hit/internal/minitest"
// ⚠️⚠️⚠️ This file was autogenerated by generators/expect/numeric ⚠️⚠️⚠️ //
// IExpectUint32 provides assertions for the uint32 type.
type IExpectUint32 interface {
// Equal expects the uint32 to be equal to the specified value.
Equal(value uint32) IStep
// NotEqual expects the uint32 to be not equal to the specified value.
NotEqual(value ...uint32) IStep
// OneOf expects the uint32 to be equal to one of the specified values.
OneOf(values ...uint32) IStep
// NotOneOf expects the uint32 to be not equal to one of the specified values.
NotOneOf(values ...uint32) IStep
// GreaterThan expects the uint32 to be not greater than the specified value.
GreaterThan(value uint32) IStep
// LessThan expects the uint32 to be less than the specified value.
LessThan(value uint32) IStep
// GreaterOrEqualThan expects the uint32 to be greater or equal than the specified value.
GreaterOrEqualThan(value uint32) IStep
// LessOrEqualThan expects the uint32 to be less or equal than the specified value.
LessOrEqualThan(value uint32) IStep
// Between expects the uint32 to be between the specified min and max value (inclusive, min >= uint32 >= max).
Between(min, max uint32) IStep
// NotBetween expects the uint32 to be not between the specified min and max value (inclusive, min >= uint32 >= max).
NotBetween(min, max uint32) IStep
}
type expectUint32ValueCallback func(hit Hit) uint32
type expectUint32 struct {
cp callPath
valueCallback expectUint32ValueCallback
}
func newExpectUint32(cp callPath, valueCallback expectUint32ValueCallback) IExpectUint32 {
return &expectUint32{cp: cp, valueCallback: valueCallback}
}
func (v *expectUint32) Equal(value uint32) IStep {
return &hitStep{Trace: ett.Prepare(), When: ExpectStep, CallPath: v.cp.Push("Equal", []interface{}{value}), Exec: func(hit *hitImpl) error {
return minitest.Equal(v.valueCallback(hit), value)
}}
}
func (v *expectUint32) NotEqual(values ...uint32) IStep {
return &hitStep{Trace: ett.Prepare(), When: ExpectStep, CallPath: v.cp.Push("NotEqual", uint32SliceToInterfaceSlice(values)), Exec: func(hit *hitImpl) error {
return minitest.NotEqual(v.valueCallback(hit), uint32SliceToInterfaceSlice(values)...)
}}
}
func (v *expectUint32) OneOf(values ...uint32) IStep {
return &hitStep{Trace: ett.Prepare(), When: ExpectStep, CallPath: v.cp.Push("OneOf", uint32SliceToInterfaceSlice(values)), Exec: func(hit *hitImpl) error {
return minitest.OneOf(v.valueCallback(hit), uint32SliceToInterfaceSlice(values)...)
}}
}
func (v *expectUint32) NotOneOf(values ...uint32) IStep {
return &hitStep{Trace: ett.Prepare(), When: ExpectStep, CallPath: v.cp.Push("NotOneOf", uint32SliceToInterfaceSlice(values)), Exec: func(hit *hitImpl) error {
return minitest.NotOneOf(v.valueCallback(hit), uint32SliceToInterfaceSlice(values)...)
}}
}
func (v *expectUint32) GreaterThan(value uint32) IStep {
return &hitStep{Trace: ett.Prepare(), When: ExpectStep, CallPath: v.cp.Push("GreaterThan", []interface{}{value}), Exec: func(hit *hitImpl) error {
l := v.valueCallback(hit)
if l <= value {
return minitest.Errorf("expected %d to be greater than %d", l, value)
}
return nil
}}
}
func (v *expectUint32) LessThan(value uint32) IStep {
return &hitStep{Trace: ett.Prepare(), When: ExpectStep, CallPath: v.cp.Push("LessThan", []interface{}{value}), Exec: func(hit *hitImpl) error {
l := v.valueCallback(hit)
if l >= value {
return minitest.Errorf("expected %d to be less than %d", l, value)
}
return nil
}}
}
func (v *expectUint32) GreaterOrEqualThan(value uint32) IStep {
return &hitStep{Trace: ett.Prepare(), When: ExpectStep, CallPath: v.cp.Push("GreaterOrEqualThan", []interface{}{value}), Exec: func(hit *hitImpl) error {
l := v.valueCallback(hit)
if l < value {
return minitest.Errorf("expected %d to be greater or equal than %d", l, value)
}
return nil
}}
}
func (v *expectUint32) LessOrEqualThan(value uint32) IStep {
return &hitStep{Trace: ett.Prepare(), When: ExpectStep, CallPath: v.cp.Push("LessOrEqualThan", []interface{}{value}), Exec: func(hit *hitImpl) error {
l := v.valueCallback(hit)
if l > value {
return minitest.Errorf("expected %d to be less or equal than %d", l, value)
}
return nil
}}
}
func (v *expectUint32) Between(min, max uint32) IStep {
return &hitStep{Trace: ett.Prepare(), When: ExpectStep, CallPath: v.cp.Push("Between", []interface{}{min, max}), Exec: func(hit *hitImpl) error {
l := v.valueCallback(hit)
if l < min || l > max {
return minitest.Errorf("expected %d to be between %d and %d", l, min, max)
}
return nil
}}
}
func (v *expectUint32) NotBetween(min, max uint32) IStep {
return &hitStep{Trace: ett.Prepare(), When: ExpectStep, CallPath: v.cp.Push("NotBetween", []interface{}{min, max}), Exec: func(hit *hitImpl) error {
l := v.valueCallback(hit)
if l >= min && l <= max {
return minitest.Errorf("expected %d not to be between %d and %d", l, min, max)
}
return nil
}}
}