-
Notifications
You must be signed in to change notification settings - Fork 0
/
assert_generated.go
242 lines (201 loc) · 5.28 KB
/
assert_generated.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
// Code generated by generate_testing2.py. DO NOT EDIT.
package assert
import (
"errors"
"math"
"reflect"
"testing"
"golang.org/x/exp/constraints"
)
func True(t *testing.T, got bool) {
if !got {
t.Fatalf("got: %v, expected: %v", got, true)
}
}
func TrueMsg(t *testing.T, got bool, msg string) {
if !got {
t.Fatalf("%s: got: %v, expected: %v", msg, got, true)
}
}
func False(t *testing.T, got bool) {
if got {
t.Fatalf("got: %v, expected: %v", got, false)
}
}
func FalseMsg(t *testing.T, got bool, msg string) {
if got {
t.Fatalf("%s: got: %v, expected: %v", msg, got, false)
}
}
func Err(t *testing.T, got error) {
if got == nil {
t.Fatalf("got: %v, expected: %v", got, "non-nil")
}
}
func ErrMsg(t *testing.T, got error, msg string) {
if got == nil {
t.Fatalf("%s: got: %v, expected: %v", msg, got, "non-nil")
}
}
func NoErr(t *testing.T, got error) {
if got != nil {
t.Fatalf("got: %v, expected: %v", got, nil)
}
}
func NoErrMsg(t *testing.T, got error, msg string) {
if got != nil {
t.Fatalf("%s: got: %v, expected: %v", msg, got, nil)
}
}
func SpecificErr(t *testing.T, got, expected error) {
if !errors.Is(got, expected) {
t.Fatalf("got: %v, expected: %v", got, expected)
}
}
func SpecificErrMsg(t *testing.T, got, expected error, msg string) {
if !errors.Is(got, expected) {
t.Fatalf("%s: got: %v, expected: %v", msg, got, expected)
}
}
func DeepEq(t *testing.T, got, expected any) {
if !reflect.DeepEqual(got, expected) {
t.Fatalf("got: %v, expected: %v", got, expected)
}
}
func DeepEqMsg(t *testing.T, got, expected any, msg string) {
if !reflect.DeepEqual(got, expected) {
t.Fatalf("%s: got: %v, expected: %v", msg, got, expected)
}
}
func Eq[T comparable](t *testing.T, got, expected T) {
if !(got == expected) {
t.Fatalf("got: %v, expected: %v", got, expected)
}
}
func EqMsg[T comparable](t *testing.T, got, expected T, msg string) {
if !(got == expected) {
t.Fatalf("%s: got: %v, expected: %v", msg, got, expected)
}
}
func Ne[T comparable](t *testing.T, got, expected T) {
if !(got != expected) {
t.Fatalf("got: %v, expected: %v", got, expected)
}
}
func NeMsg[T comparable](t *testing.T, got, expected T, msg string) {
if !(got != expected) {
t.Fatalf("%s: got: %v, expected: %v", msg, got, expected)
}
}
func Lt[T constraints.Ordered](t *testing.T, a, b T) {
if !(a < b) {
t.Fatalf("expected: %v < %v", a, b)
}
}
func LtMsg[T constraints.Ordered](t *testing.T, a, b T, msg string) {
if !(a < b) {
t.Fatalf("%s: expected: %v < %v", msg, a, b)
}
}
func Le[T constraints.Ordered](t *testing.T, a, b T) {
if !(a <= b) {
t.Fatalf("expected: %v <= %v", a, b)
}
}
func LeMsg[T constraints.Ordered](t *testing.T, a, b T, msg string) {
if !(a <= b) {
t.Fatalf("%s: expected: %v <= %v", msg, a, b)
}
}
func Gt[T constraints.Ordered](t *testing.T, a, b T) {
if !(a > b) {
t.Fatalf("expected: %v > %v", a, b)
}
}
func GtMsg[T constraints.Ordered](t *testing.T, a, b T, msg string) {
if !(a > b) {
t.Fatalf("%s: expected: %v > %v", msg, a, b)
}
}
func Ge[T constraints.Ordered](t *testing.T, a, b T) {
if !(a >= b) {
t.Fatalf("expected: %v >= %v", a, b)
}
}
func GeMsg[T constraints.Ordered](t *testing.T, a, b T, msg string) {
if !(a >= b) {
t.Fatalf("%s: expected: %v >= %v", msg, a, b)
}
}
func Close(t *testing.T, a, b, delta float64) {
diff := math.Abs(b - a)
if diff > delta {
t.Fatalf("expected %v and %v to be within %v, got: %v", a, b, delta, diff)
}
}
func CloseMsg(t *testing.T, a, b, delta float64, msg string) {
diff := math.Abs(b - a)
if diff > delta {
t.Fatalf("%s: expected %v and %v to be within %v, got: %v", msg, a, b, delta, diff)
}
}
func NaN(t *testing.T, got float64) {
if !math.IsNaN(got) {
t.Fatalf("got: %v, expected: %v", got, "NaN")
}
}
func NaNMsg(t *testing.T, got float64, msg string) {
if !math.IsNaN(got) {
t.Fatalf("%s: got: %v, expected: %v", msg, got, "NaN")
}
}
func NotNaN(t *testing.T, got float64) {
if math.IsNaN(got) {
t.Fatalf("got: %v, expected: %v", got, "not-NaN")
}
}
func NotNaNMsg(t *testing.T, got float64, msg string) {
if math.IsNaN(got) {
t.Fatalf("%s: got: %v, expected: %v", msg, got, "not-NaN")
}
}
func Inf(t *testing.T, got float64) {
if !math.IsInf(got, 0) {
t.Fatalf("got: %v, expected: %v", got, "Inf")
}
}
func InfMsg(t *testing.T, got float64, msg string) {
if !math.IsInf(got, 0) {
t.Fatalf("%s: got: %v, expected: %v", msg, got, "Inf")
}
}
func NotInf(t *testing.T, got float64) {
if math.IsInf(got, 0) {
t.Fatalf("got: %v, expected: %v", got, "not-Inf")
}
}
func NotInfMsg(t *testing.T, got float64, msg string) {
if math.IsInf(got, 0) {
t.Fatalf("%s: got: %v, expected: %v", msg, got, "not-Inf")
}
}
func Normal(t *testing.T, got float64) {
if math.IsNaN(got) || math.IsInf(got, 0) {
t.Fatalf("got: %v, expected: %v", got, "NaN or Inf")
}
}
func NormalMsg(t *testing.T, got float64, msg string) {
if math.IsNaN(got) || math.IsInf(got, 0) {
t.Fatalf("%s: got: %v, expected: %v", msg, got, "NaN or Inf")
}
}
func NotNormal(t *testing.T, got float64) {
if !math.IsNaN(got) && !math.IsInf(got, 0) {
t.Fatalf("got: %v, expected: %v", got, "not NaN nor Inf")
}
}
func NotNormalMsg(t *testing.T, got float64, msg string) {
if !math.IsNaN(got) && !math.IsInf(got, 0) {
t.Fatalf("%s: got: %v, expected: %v", msg, got, "not NaN nor Inf")
}
}