forked from petergtz/pegomock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
matcher_factories.go
276 lines (220 loc) · 5.71 KB
/
matcher_factories.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
package pegomock
import (
"reflect"
)
func EqBool(value bool) bool {
RegisterMatcher(&EqMatcher{Value: value})
return false
}
func AnyBool() bool {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((bool)(false))))
return false
}
func AnyBoolSlice() []bool {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((bool)(false)))))
return nil
}
func EqInt(value int) int {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyInt() int {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((int)(0))))
return 0
}
func AnyIntSlice() []int {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((int)(0)))))
return nil
}
func EqInt8(value int8) int8 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyInt8() int8 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((int8)(0))))
return 0
}
func AnyInt8Slice() []int8 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((int8)(0)))))
return nil
}
func EqInt16(value int16) int16 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyInt16() int16 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((int16)(0))))
return 0
}
func AnyInt16Slice() []int16 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((int16)(0)))))
return nil
}
func EqInt32(value int32) int32 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyInt32() int32 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((int32)(0))))
return 0
}
func AnyInt32Slice() []int32 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((int32)(0)))))
return nil
}
func EqInt64(value int64) int64 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyInt64() int64 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((int64)(0))))
return 0
}
func AnyInt64Slice() []int64 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((int64)(0)))))
return nil
}
func EqUint(value uint) uint {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyUint() uint {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((uint)(0))))
return 0
}
func AnyUintSlice() []uint {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((uint)(0)))))
return nil
}
func EqUint8(value uint8) uint8 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyUint8() uint8 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((uint8)(0))))
return 0
}
func AnyUint8Slice() []uint8 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((uint8)(0)))))
return nil
}
func EqUint16(value uint16) uint16 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyUint16() uint16 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((uint16)(0))))
return 0
}
func AnyUint16Slice() []uint16 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((uint16)(0)))))
return nil
}
func EqUint32(value uint32) uint32 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyUint32() uint32 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((uint32)(0))))
return 0
}
func AnyUint32Slice() []uint32 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((uint32)(0)))))
return nil
}
func EqUint64(value uint64) uint64 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyUint64() uint64 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((uint64)(0))))
return 0
}
func AnyUint64Slice() []uint64 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((uint64)(0)))))
return nil
}
func EqUintptr(value uintptr) uintptr {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyUintptr() uintptr {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((uintptr)(0))))
return 0
}
func AnyUintptrSlice() []uintptr {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((uintptr)(0)))))
return nil
}
func EqFloat32(value float32) float32 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyFloat32() float32 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((float32)(0))))
return 0
}
func AnyFloat32Slice() []float32 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((float32)(0)))))
return nil
}
func EqFloat64(value float64) float64 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyFloat64() float64 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((float64)(0))))
return 0
}
func AnyFloat64Slice() []float64 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((float64)(0)))))
return nil
}
func EqComplex64(value complex64) complex64 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyComplex64() complex64 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((complex64)(0))))
return 0
}
func AnyComplex64Slice() []complex64 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((complex64)(0)))))
return nil
}
func EqComplex128(value complex128) complex128 {
RegisterMatcher(&EqMatcher{Value: value})
return 0
}
func AnyComplex128() complex128 {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((complex128)(0))))
return 0
}
func AnyComplex128Slice() []complex128 {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((complex128)(0)))))
return nil
}
func EqString(value string) string {
RegisterMatcher(&EqMatcher{Value: value})
return ""
}
func AnyString() string {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((string)(""))))
return ""
}
func AnyStringSlice() []string {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((string)("")))))
return nil
}
func EqInterface(value interface{}) interface{} {
RegisterMatcher(&EqMatcher{Value: value})
return nil
}
func AnyInterface() interface{} {
RegisterMatcher(NewAnyMatcher(reflect.TypeOf((*(interface{}))(nil)).Elem()))
return nil
}
func AnyInterfaceSlice() []interface{} {
RegisterMatcher(NewAnyMatcher(reflect.SliceOf(reflect.TypeOf((*(interface{}))(nil)).Elem())))
return nil
}