| 1 |
// Copyright (c) 2018-2026, Maxime Soulé |
| 2 |
// All rights reserved. |
| 3 |
// |
| 4 |
// This source code is licensed under the BSD-style license found in the |
| 5 |
// LICENSE file in the root directory of this source tree. |
| 6 |
// |
| 7 |
// DO NOT EDIT!!! AUTOMATICALLY GENERATED!!! |
| 8 |
|
| 9 |
package td |
| 10 |
|
| 11 |
import ( |
| 12 |
"time" |
| 13 |
) |
| 14 |
|
| 15 |
// allOperators lists the 70 operators. |
| 16 |
// nil means not usable in JSON(). |
| 17 |
var allOperators = map[string]any{ |
| 18 |
"All": All, |
| 19 |
"Any": Any, |
| 20 |
"Array": nil, |
| 21 |
"ArrayEach": ArrayEach, |
| 22 |
"Bag": Bag, |
| 23 |
"Between": Between, |
| 24 |
"Cap": nil, |
| 25 |
"Catch": nil, |
| 26 |
"Code": nil, |
| 27 |
"Contains": Contains, |
| 28 |
"ContainsKey": ContainsKey, |
| 29 |
"Delay": nil, |
| 30 |
"Empty": Empty, |
| 31 |
"ErrorIs": nil, |
| 32 |
"First": First, |
| 33 |
"Grep": Grep, |
| 34 |
"Gt": Gt, |
| 35 |
"Gte": Gte, |
| 36 |
"HasPrefix": HasPrefix, |
| 37 |
"HasSuffix": HasSuffix, |
| 38 |
"Ignore": Ignore, |
| 39 |
"Isa": nil, |
| 40 |
"JSON": nil, |
| 41 |
"JSONPointer": JSONPointer, |
| 42 |
"Keys": Keys, |
| 43 |
"Last": Last, |
| 44 |
"Lax": nil, |
| 45 |
"Len": Len, |
| 46 |
"List": nil, |
| 47 |
"Lt": Lt, |
| 48 |
"Lte": Lte, |
| 49 |
"Map": nil, |
| 50 |
"MapEach": MapEach, |
| 51 |
"N": N, |
| 52 |
"NaN": NaN, |
| 53 |
"Nil": Nil, |
| 54 |
"None": None, |
| 55 |
"Not": Not, |
| 56 |
"NotAny": NotAny, |
| 57 |
"NotEmpty": NotEmpty, |
| 58 |
"NotNaN": NotNaN, |
| 59 |
"NotNil": NotNil, |
| 60 |
"NotZero": NotZero, |
| 61 |
"PPtr": nil, |
| 62 |
"Ptr": nil, |
| 63 |
"Re": Re, |
| 64 |
"ReAll": ReAll, |
| 65 |
"Recv": nil, |
| 66 |
"SStruct": nil, |
| 67 |
"Set": Set, |
| 68 |
"Shallow": nil, |
| 69 |
"Slice": nil, |
| 70 |
"Smuggle": nil, |
| 71 |
"Sort": Sort, |
| 72 |
"Sorted": Sorted, |
| 73 |
"String": nil, |
| 74 |
"Struct": nil, |
| 75 |
"SubBagOf": SubBagOf, |
| 76 |
"SubJSONOf": nil, |
| 77 |
"SubMapOf": SubMapOf, |
| 78 |
"SubSetOf": SubSetOf, |
| 79 |
"SuperBagOf": SuperBagOf, |
| 80 |
"SuperJSONOf": nil, |
| 81 |
"SuperMapOf": SuperMapOf, |
| 82 |
"SuperSetOf": SuperSetOf, |
| 83 |
"SuperSliceOf": nil, |
| 84 |
"Tag": nil, |
| 85 |
"TruncTime": nil, |
| 86 |
"Values": Values, |
| 87 |
"Zero": Zero, |
| 88 |
} |
| 89 |
|
| 90 |
// CmpAll is a shortcut for: |
| 91 |
// |
| 92 |
// td.Cmp(t, got, td.All(expectedValues...), args...) |
| 93 |
// |
| 94 |
// See [All] for details. |
| 95 |
// |
| 96 |
// Returns true if the test is OK, false if it fails. |
| 97 |
// |
| 98 |
// If t is a [*T] then its Config field is inherited. |
| 99 |
// |
| 100 |
// args... are optional and allow to name the test. This name is |
| 101 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 102 |
// the first item of args is a string and contains a '%' rune then |
| 103 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 104 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 105 |
// reason of a potential failure. |
| 106 |
func CmpAll(t TestingT, got any, expectedValues []any, args ...any) bool { |
| 107 |
t.Helper() |
| 108 |
return Cmp(t, got, All(expectedValues...), args...) |
| 109 |
} |
| 110 |
|
| 111 |
// CmpAny is a shortcut for: |
| 112 |
// |
| 113 |
// td.Cmp(t, got, td.Any(expectedValues...), args...) |
| 114 |
// |
| 115 |
// See [Any] for details. |
| 116 |
// |
| 117 |
// Returns true if the test is OK, false if it fails. |
| 118 |
// |
| 119 |
// If t is a [*T] then its Config field is inherited. |
| 120 |
// |
| 121 |
// args... are optional and allow to name the test. This name is |
| 122 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 123 |
// the first item of args is a string and contains a '%' rune then |
| 124 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 125 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 126 |
// reason of a potential failure. |
| 127 |
func CmpAny(t TestingT, got any, expectedValues []any, args ...any) bool { |
| 128 |
t.Helper() |
| 129 |
return Cmp(t, got, Any(expectedValues...), args...) |
| 130 |
} |
| 131 |
|
| 132 |
// CmpArray is a shortcut for: |
| 133 |
// |
| 134 |
// td.Cmp(t, got, td.Array(model, expectedEntries), args...) |
| 135 |
// |
| 136 |
// See [Array] for details. |
| 137 |
// |
| 138 |
// [Array] optional parameter expectedEntries is here mandatory. |
| 139 |
// nil value should be passed to mimic its absence in |
| 140 |
// original [Array] call. |
| 141 |
// |
| 142 |
// Returns true if the test is OK, false if it fails. |
| 143 |
// |
| 144 |
// If t is a [*T] then its Config field is inherited. |
| 145 |
// |
| 146 |
// args... are optional and allow to name the test. This name is |
| 147 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 148 |
// the first item of args is a string and contains a '%' rune then |
| 149 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 150 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 151 |
// reason of a potential failure. |
| 152 |
func CmpArray(t TestingT, got, model any, expectedEntries ArrayEntries, args ...any) bool { |
| 153 |
t.Helper() |
| 154 |
return Cmp(t, got, Array(model, expectedEntries), args...) |
| 155 |
} |
| 156 |
|
| 157 |
// CmpArrayEach is a shortcut for: |
| 158 |
// |
| 159 |
// td.Cmp(t, got, td.ArrayEach(expectedValue), args...) |
| 160 |
// |
| 161 |
// See [ArrayEach] for details. |
| 162 |
// |
| 163 |
// Returns true if the test is OK, false if it fails. |
| 164 |
// |
| 165 |
// If t is a [*T] then its Config field is inherited. |
| 166 |
// |
| 167 |
// args... are optional and allow to name the test. This name is |
| 168 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 169 |
// the first item of args is a string and contains a '%' rune then |
| 170 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 171 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 172 |
// reason of a potential failure. |
| 173 |
func CmpArrayEach(t TestingT, got, expectedValue any, args ...any) bool { |
| 174 |
t.Helper() |
| 175 |
return Cmp(t, got, ArrayEach(expectedValue), args...) |
| 176 |
} |
| 177 |
|
| 178 |
// CmpBag is a shortcut for: |
| 179 |
// |
| 180 |
// td.Cmp(t, got, td.Bag(expectedItems...), args...) |
| 181 |
// |
| 182 |
// See [Bag] for details. |
| 183 |
// |
| 184 |
// Returns true if the test is OK, false if it fails. |
| 185 |
// |
| 186 |
// If t is a [*T] then its Config field is inherited. |
| 187 |
// |
| 188 |
// args... are optional and allow to name the test. This name is |
| 189 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 190 |
// the first item of args is a string and contains a '%' rune then |
| 191 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 192 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 193 |
// reason of a potential failure. |
| 194 |
func CmpBag(t TestingT, got any, expectedItems []any, args ...any) bool { |
| 195 |
t.Helper() |
| 196 |
return Cmp(t, got, Bag(expectedItems...), args...) |
| 197 |
} |
| 198 |
|
| 199 |
// CmpBetween is a shortcut for: |
| 200 |
// |
| 201 |
// td.Cmp(t, got, td.Between(from, to, bounds), args...) |
| 202 |
// |
| 203 |
// See [Between] for details. |
| 204 |
// |
| 205 |
// [Between] optional parameter bounds is here mandatory. |
| 206 |
// [BoundsInIn] value should be passed to mimic its absence in |
| 207 |
// original [Between] call. |
| 208 |
// |
| 209 |
// Returns true if the test is OK, false if it fails. |
| 210 |
// |
| 211 |
// If t is a [*T] then its Config field is inherited. |
| 212 |
// |
| 213 |
// args... are optional and allow to name the test. This name is |
| 214 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 215 |
// the first item of args is a string and contains a '%' rune then |
| 216 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 217 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 218 |
// reason of a potential failure. |
| 219 |
func CmpBetween(t TestingT, got, from, to any, bounds BoundsKind, args ...any) bool { |
| 220 |
t.Helper() |
| 221 |
return Cmp(t, got, Between(from, to, bounds), args...) |
| 222 |
} |
| 223 |
|
| 224 |
// CmpCap is a shortcut for: |
| 225 |
// |
| 226 |
// td.Cmp(t, got, td.Cap(expectedCap), args...) |
| 227 |
// |
| 228 |
// See [Cap] for details. |
| 229 |
// |
| 230 |
// Returns true if the test is OK, false if it fails. |
| 231 |
// |
| 232 |
// If t is a [*T] then its Config field is inherited. |
| 233 |
// |
| 234 |
// args... are optional and allow to name the test. This name is |
| 235 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 236 |
// the first item of args is a string and contains a '%' rune then |
| 237 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 238 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 239 |
// reason of a potential failure. |
| 240 |
func CmpCap(t TestingT, got, expectedCap any, args ...any) bool { |
| 241 |
t.Helper() |
| 242 |
return Cmp(t, got, Cap(expectedCap), args...) |
| 243 |
} |
| 244 |
|
| 245 |
// CmpCode is a shortcut for: |
| 246 |
// |
| 247 |
// td.Cmp(t, got, td.Code(fn), args...) |
| 248 |
// |
| 249 |
// See [Code] for details. |
| 250 |
// |
| 251 |
// Returns true if the test is OK, false if it fails. |
| 252 |
// |
| 253 |
// If t is a [*T] then its Config field is inherited. |
| 254 |
// |
| 255 |
// args... are optional and allow to name the test. This name is |
| 256 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 257 |
// the first item of args is a string and contains a '%' rune then |
| 258 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 259 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 260 |
// reason of a potential failure. |
| 261 |
func CmpCode(t TestingT, got, fn any, args ...any) bool { |
| 262 |
t.Helper() |
| 263 |
return Cmp(t, got, Code(fn), args...) |
| 264 |
} |
| 265 |
|
| 266 |
// CmpContains is a shortcut for: |
| 267 |
// |
| 268 |
// td.Cmp(t, got, td.Contains(expectedValue), args...) |
| 269 |
// |
| 270 |
// See [Contains] for details. |
| 271 |
// |
| 272 |
// Returns true if the test is OK, false if it fails. |
| 273 |
// |
| 274 |
// If t is a [*T] then its Config field is inherited. |
| 275 |
// |
| 276 |
// args... are optional and allow to name the test. This name is |
| 277 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 278 |
// the first item of args is a string and contains a '%' rune then |
| 279 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 280 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 281 |
// reason of a potential failure. |
| 282 |
func CmpContains(t TestingT, got, expectedValue any, args ...any) bool { |
| 283 |
t.Helper() |
| 284 |
return Cmp(t, got, Contains(expectedValue), args...) |
| 285 |
} |
| 286 |
|
| 287 |
// CmpContainsKey is a shortcut for: |
| 288 |
// |
| 289 |
// td.Cmp(t, got, td.ContainsKey(expectedValue), args...) |
| 290 |
// |
| 291 |
// See [ContainsKey] for details. |
| 292 |
// |
| 293 |
// Returns true if the test is OK, false if it fails. |
| 294 |
// |
| 295 |
// If t is a [*T] then its Config field is inherited. |
| 296 |
// |
| 297 |
// args... are optional and allow to name the test. This name is |
| 298 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 299 |
// the first item of args is a string and contains a '%' rune then |
| 300 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 301 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 302 |
// reason of a potential failure. |
| 303 |
func CmpContainsKey(t TestingT, got, expectedValue any, args ...any) bool { |
| 304 |
t.Helper() |
| 305 |
return Cmp(t, got, ContainsKey(expectedValue), args...) |
| 306 |
} |
| 307 |
|
| 308 |
// CmpEmpty is a shortcut for: |
| 309 |
// |
| 310 |
// td.Cmp(t, got, td.Empty(), args...) |
| 311 |
// |
| 312 |
// See [Empty] for details. |
| 313 |
// |
| 314 |
// Returns true if the test is OK, false if it fails. |
| 315 |
// |
| 316 |
// If t is a [*T] then its Config field is inherited. |
| 317 |
// |
| 318 |
// args... are optional and allow to name the test. This name is |
| 319 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 320 |
// the first item of args is a string and contains a '%' rune then |
| 321 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 322 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 323 |
// reason of a potential failure. |
| 324 |
func CmpEmpty(t TestingT, got any, args ...any) bool { |
| 325 |
t.Helper() |
| 326 |
return Cmp(t, got, Empty(), args...) |
| 327 |
} |
| 328 |
|
| 329 |
// CmpErrorIs is a shortcut for: |
| 330 |
// |
| 331 |
// td.Cmp(t, got, td.ErrorIs(expectedError), args...) |
| 332 |
// |
| 333 |
// See [ErrorIs] for details. |
| 334 |
// |
| 335 |
// Returns true if the test is OK, false if it fails. |
| 336 |
// |
| 337 |
// If t is a [*T] then its Config field is inherited. |
| 338 |
// |
| 339 |
// args... are optional and allow to name the test. This name is |
| 340 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 341 |
// the first item of args is a string and contains a '%' rune then |
| 342 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 343 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 344 |
// reason of a potential failure. |
| 345 |
func CmpErrorIs(t TestingT, got, expectedError any, args ...any) bool { |
| 346 |
t.Helper() |
| 347 |
return Cmp(t, got, ErrorIs(expectedError), args...) |
| 348 |
} |
| 349 |
|
| 350 |
// CmpFirst is a shortcut for: |
| 351 |
// |
| 352 |
// td.Cmp(t, got, td.First(filter, expectedValue), args...) |
| 353 |
// |
| 354 |
// See [First] for details. |
| 355 |
// |
| 356 |
// Returns true if the test is OK, false if it fails. |
| 357 |
// |
| 358 |
// If t is a [*T] then its Config field is inherited. |
| 359 |
// |
| 360 |
// args... are optional and allow to name the test. This name is |
| 361 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 362 |
// the first item of args is a string and contains a '%' rune then |
| 363 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 364 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 365 |
// reason of a potential failure. |
| 366 |
func CmpFirst(t TestingT, got, filter, expectedValue any, args ...any) bool { |
| 367 |
t.Helper() |
| 368 |
return Cmp(t, got, First(filter, expectedValue), args...) |
| 369 |
} |
| 370 |
|
| 371 |
// CmpGrep is a shortcut for: |
| 372 |
// |
| 373 |
// td.Cmp(t, got, td.Grep(filter, expectedValue), args...) |
| 374 |
// |
| 375 |
// See [Grep] for details. |
| 376 |
// |
| 377 |
// Returns true if the test is OK, false if it fails. |
| 378 |
// |
| 379 |
// If t is a [*T] then its Config field is inherited. |
| 380 |
// |
| 381 |
// args... are optional and allow to name the test. This name is |
| 382 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 383 |
// the first item of args is a string and contains a '%' rune then |
| 384 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 385 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 386 |
// reason of a potential failure. |
| 387 |
func CmpGrep(t TestingT, got, filter, expectedValue any, args ...any) bool { |
| 388 |
t.Helper() |
| 389 |
return Cmp(t, got, Grep(filter, expectedValue), args...) |
| 390 |
} |
| 391 |
|
| 392 |
// CmpGt is a shortcut for: |
| 393 |
// |
| 394 |
// td.Cmp(t, got, td.Gt(minExpectedValue), args...) |
| 395 |
// |
| 396 |
// See [Gt] for details. |
| 397 |
// |
| 398 |
// Returns true if the test is OK, false if it fails. |
| 399 |
// |
| 400 |
// If t is a [*T] then its Config field is inherited. |
| 401 |
// |
| 402 |
// args... are optional and allow to name the test. This name is |
| 403 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 404 |
// the first item of args is a string and contains a '%' rune then |
| 405 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 406 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 407 |
// reason of a potential failure. |
| 408 |
func CmpGt(t TestingT, got, minExpectedValue any, args ...any) bool { |
| 409 |
t.Helper() |
| 410 |
return Cmp(t, got, Gt(minExpectedValue), args...) |
| 411 |
} |
| 412 |
|
| 413 |
// CmpGte is a shortcut for: |
| 414 |
// |
| 415 |
// td.Cmp(t, got, td.Gte(minExpectedValue), args...) |
| 416 |
// |
| 417 |
// See [Gte] for details. |
| 418 |
// |
| 419 |
// Returns true if the test is OK, false if it fails. |
| 420 |
// |
| 421 |
// If t is a [*T] then its Config field is inherited. |
| 422 |
// |
| 423 |
// args... are optional and allow to name the test. This name is |
| 424 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 425 |
// the first item of args is a string and contains a '%' rune then |
| 426 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 427 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 428 |
// reason of a potential failure. |
| 429 |
func CmpGte(t TestingT, got, minExpectedValue any, args ...any) bool { |
| 430 |
t.Helper() |
| 431 |
return Cmp(t, got, Gte(minExpectedValue), args...) |
| 432 |
} |
| 433 |
|
| 434 |
// CmpHasPrefix is a shortcut for: |
| 435 |
// |
| 436 |
// td.Cmp(t, got, td.HasPrefix(expected), args...) |
| 437 |
// |
| 438 |
// See [HasPrefix] for details. |
| 439 |
// |
| 440 |
// Returns true if the test is OK, false if it fails. |
| 441 |
// |
| 442 |
// If t is a [*T] then its Config field is inherited. |
| 443 |
// |
| 444 |
// args... are optional and allow to name the test. This name is |
| 445 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 446 |
// the first item of args is a string and contains a '%' rune then |
| 447 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 448 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 449 |
// reason of a potential failure. |
| 450 |
func CmpHasPrefix(t TestingT, got any, expected string, args ...any) bool { |
| 451 |
t.Helper() |
| 452 |
return Cmp(t, got, HasPrefix(expected), args...) |
| 453 |
} |
| 454 |
|
| 455 |
// CmpHasSuffix is a shortcut for: |
| 456 |
// |
| 457 |
// td.Cmp(t, got, td.HasSuffix(expected), args...) |
| 458 |
// |
| 459 |
// See [HasSuffix] for details. |
| 460 |
// |
| 461 |
// Returns true if the test is OK, false if it fails. |
| 462 |
// |
| 463 |
// If t is a [*T] then its Config field is inherited. |
| 464 |
// |
| 465 |
// args... are optional and allow to name the test. This name is |
| 466 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 467 |
// the first item of args is a string and contains a '%' rune then |
| 468 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 469 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 470 |
// reason of a potential failure. |
| 471 |
func CmpHasSuffix(t TestingT, got any, expected string, args ...any) bool { |
| 472 |
t.Helper() |
| 473 |
return Cmp(t, got, HasSuffix(expected), args...) |
| 474 |
} |
| 475 |
|
| 476 |
// CmpIsa is a shortcut for: |
| 477 |
// |
| 478 |
// td.Cmp(t, got, td.Isa(model), args...) |
| 479 |
// |
| 480 |
// See [Isa] for details. |
| 481 |
// |
| 482 |
// Returns true if the test is OK, false if it fails. |
| 483 |
// |
| 484 |
// If t is a [*T] then its Config field is inherited. |
| 485 |
// |
| 486 |
// args... are optional and allow to name the test. This name is |
| 487 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 488 |
// the first item of args is a string and contains a '%' rune then |
| 489 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 490 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 491 |
// reason of a potential failure. |
| 492 |
func CmpIsa(t TestingT, got, model any, args ...any) bool { |
| 493 |
t.Helper() |
| 494 |
return Cmp(t, got, Isa(model), args...) |
| 495 |
} |
| 496 |
|
| 497 |
// CmpJSON is a shortcut for: |
| 498 |
// |
| 499 |
// td.Cmp(t, got, td.JSON(expectedJSON, params...), args...) |
| 500 |
// |
| 501 |
// See [JSON] for details. |
| 502 |
// |
| 503 |
// Returns true if the test is OK, false if it fails. |
| 504 |
// |
| 505 |
// If t is a [*T] then its Config field is inherited. |
| 506 |
// |
| 507 |
// args... are optional and allow to name the test. This name is |
| 508 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 509 |
// the first item of args is a string and contains a '%' rune then |
| 510 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 511 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 512 |
// reason of a potential failure. |
| 513 |
func CmpJSON(t TestingT, got, expectedJSON any, params []any, args ...any) bool { |
| 514 |
t.Helper() |
| 515 |
return Cmp(t, got, JSON(expectedJSON, params...), args...) |
| 516 |
} |
| 517 |
|
| 518 |
// CmpJSONPointer is a shortcut for: |
| 519 |
// |
| 520 |
// td.Cmp(t, got, td.JSONPointer(ptr, expectedValue), args...) |
| 521 |
// |
| 522 |
// See [JSONPointer] for details. |
| 523 |
// |
| 524 |
// Returns true if the test is OK, false if it fails. |
| 525 |
// |
| 526 |
// If t is a [*T] then its Config field is inherited. |
| 527 |
// |
| 528 |
// args... are optional and allow to name the test. This name is |
| 529 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 530 |
// the first item of args is a string and contains a '%' rune then |
| 531 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 532 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 533 |
// reason of a potential failure. |
| 534 |
func CmpJSONPointer(t TestingT, got any, ptr string, expectedValue any, args ...any) bool { |
| 535 |
t.Helper() |
| 536 |
return Cmp(t, got, JSONPointer(ptr, expectedValue), args...) |
| 537 |
} |
| 538 |
|
| 539 |
// CmpKeys is a shortcut for: |
| 540 |
// |
| 541 |
// td.Cmp(t, got, td.Keys(val), args...) |
| 542 |
// |
| 543 |
// See [Keys] for details. |
| 544 |
// |
| 545 |
// Returns true if the test is OK, false if it fails. |
| 546 |
// |
| 547 |
// If t is a [*T] then its Config field is inherited. |
| 548 |
// |
| 549 |
// args... are optional and allow to name the test. This name is |
| 550 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 551 |
// the first item of args is a string and contains a '%' rune then |
| 552 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 553 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 554 |
// reason of a potential failure. |
| 555 |
func CmpKeys(t TestingT, got, val any, args ...any) bool { |
| 556 |
t.Helper() |
| 557 |
return Cmp(t, got, Keys(val), args...) |
| 558 |
} |
| 559 |
|
| 560 |
// CmpLast is a shortcut for: |
| 561 |
// |
| 562 |
// td.Cmp(t, got, td.Last(filter, expectedValue), args...) |
| 563 |
// |
| 564 |
// See [Last] for details. |
| 565 |
// |
| 566 |
// Returns true if the test is OK, false if it fails. |
| 567 |
// |
| 568 |
// If t is a [*T] then its Config field is inherited. |
| 569 |
// |
| 570 |
// args... are optional and allow to name the test. This name is |
| 571 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 572 |
// the first item of args is a string and contains a '%' rune then |
| 573 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 574 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 575 |
// reason of a potential failure. |
| 576 |
func CmpLast(t TestingT, got, filter, expectedValue any, args ...any) bool { |
| 577 |
t.Helper() |
| 578 |
return Cmp(t, got, Last(filter, expectedValue), args...) |
| 579 |
} |
| 580 |
|
| 581 |
// CmpLax is a shortcut for: |
| 582 |
// |
| 583 |
// td.Cmp(t, got, td.Lax(expectedValue), args...) |
| 584 |
// |
| 585 |
// See [Lax] for details. |
| 586 |
// |
| 587 |
// Returns true if the test is OK, false if it fails. |
| 588 |
// |
| 589 |
// If t is a [*T] then its Config field is inherited. |
| 590 |
// |
| 591 |
// args... are optional and allow to name the test. This name is |
| 592 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 593 |
// the first item of args is a string and contains a '%' rune then |
| 594 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 595 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 596 |
// reason of a potential failure. |
| 597 |
func CmpLax(t TestingT, got, expectedValue any, args ...any) bool { |
| 598 |
t.Helper() |
| 599 |
return Cmp(t, got, Lax(expectedValue), args...) |
| 600 |
} |
| 601 |
|
| 602 |
// CmpLen is a shortcut for: |
| 603 |
// |
| 604 |
// td.Cmp(t, got, td.Len(expectedLen), args...) |
| 605 |
// |
| 606 |
// See [Len] for details. |
| 607 |
// |
| 608 |
// Returns true if the test is OK, false if it fails. |
| 609 |
// |
| 610 |
// If t is a [*T] then its Config field is inherited. |
| 611 |
// |
| 612 |
// args... are optional and allow to name the test. This name is |
| 613 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 614 |
// the first item of args is a string and contains a '%' rune then |
| 615 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 616 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 617 |
// reason of a potential failure. |
| 618 |
func CmpLen(t TestingT, got, expectedLen any, args ...any) bool { |
| 619 |
t.Helper() |
| 620 |
return Cmp(t, got, Len(expectedLen), args...) |
| 621 |
} |
| 622 |
|
| 623 |
// CmpList is a shortcut for: |
| 624 |
// |
| 625 |
// td.Cmp(t, got, td.List(expectedValues...), args...) |
| 626 |
// |
| 627 |
// See [List] for details. |
| 628 |
// |
| 629 |
// Returns true if the test is OK, false if it fails. |
| 630 |
// |
| 631 |
// If t is a [*T] then its Config field is inherited. |
| 632 |
// |
| 633 |
// args... are optional and allow to name the test. This name is |
| 634 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 635 |
// the first item of args is a string and contains a '%' rune then |
| 636 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 637 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 638 |
// reason of a potential failure. |
| 639 |
func CmpList(t TestingT, got any, expectedValues []any, args ...any) bool { |
| 640 |
t.Helper() |
| 641 |
return Cmp(t, got, List(expectedValues...), args...) |
| 642 |
} |
| 643 |
|
| 644 |
// CmpLt is a shortcut for: |
| 645 |
// |
| 646 |
// td.Cmp(t, got, td.Lt(maxExpectedValue), args...) |
| 647 |
// |
| 648 |
// See [Lt] for details. |
| 649 |
// |
| 650 |
// Returns true if the test is OK, false if it fails. |
| 651 |
// |
| 652 |
// If t is a [*T] then its Config field is inherited. |
| 653 |
// |
| 654 |
// args... are optional and allow to name the test. This name is |
| 655 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 656 |
// the first item of args is a string and contains a '%' rune then |
| 657 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 658 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 659 |
// reason of a potential failure. |
| 660 |
func CmpLt(t TestingT, got, maxExpectedValue any, args ...any) bool { |
| 661 |
t.Helper() |
| 662 |
return Cmp(t, got, Lt(maxExpectedValue), args...) |
| 663 |
} |
| 664 |
|
| 665 |
// CmpLte is a shortcut for: |
| 666 |
// |
| 667 |
// td.Cmp(t, got, td.Lte(maxExpectedValue), args...) |
| 668 |
// |
| 669 |
// See [Lte] for details. |
| 670 |
// |
| 671 |
// Returns true if the test is OK, false if it fails. |
| 672 |
// |
| 673 |
// If t is a [*T] then its Config field is inherited. |
| 674 |
// |
| 675 |
// args... are optional and allow to name the test. This name is |
| 676 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 677 |
// the first item of args is a string and contains a '%' rune then |
| 678 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 679 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 680 |
// reason of a potential failure. |
| 681 |
func CmpLte(t TestingT, got, maxExpectedValue any, args ...any) bool { |
| 682 |
t.Helper() |
| 683 |
return Cmp(t, got, Lte(maxExpectedValue), args...) |
| 684 |
} |
| 685 |
|
| 686 |
// CmpMap is a shortcut for: |
| 687 |
// |
| 688 |
// td.Cmp(t, got, td.Map(model, expectedEntries), args...) |
| 689 |
// |
| 690 |
// See [Map] for details. |
| 691 |
// |
| 692 |
// [Map] optional parameter expectedEntries is here mandatory. |
| 693 |
// nil value should be passed to mimic its absence in |
| 694 |
// original [Map] call. |
| 695 |
// |
| 696 |
// Returns true if the test is OK, false if it fails. |
| 697 |
// |
| 698 |
// If t is a [*T] then its Config field is inherited. |
| 699 |
// |
| 700 |
// args... are optional and allow to name the test. This name is |
| 701 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 702 |
// the first item of args is a string and contains a '%' rune then |
| 703 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 704 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 705 |
// reason of a potential failure. |
| 706 |
func CmpMap(t TestingT, got, model any, expectedEntries MapEntries, args ...any) bool { |
| 707 |
t.Helper() |
| 708 |
return Cmp(t, got, Map(model, expectedEntries), args...) |
| 709 |
} |
| 710 |
|
| 711 |
// CmpMapEach is a shortcut for: |
| 712 |
// |
| 713 |
// td.Cmp(t, got, td.MapEach(expectedValue), args...) |
| 714 |
// |
| 715 |
// See [MapEach] for details. |
| 716 |
// |
| 717 |
// Returns true if the test is OK, false if it fails. |
| 718 |
// |
| 719 |
// If t is a [*T] then its Config field is inherited. |
| 720 |
// |
| 721 |
// args... are optional and allow to name the test. This name is |
| 722 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 723 |
// the first item of args is a string and contains a '%' rune then |
| 724 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 725 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 726 |
// reason of a potential failure. |
| 727 |
func CmpMapEach(t TestingT, got, expectedValue any, args ...any) bool { |
| 728 |
t.Helper() |
| 729 |
return Cmp(t, got, MapEach(expectedValue), args...) |
| 730 |
} |
| 731 |
|
| 732 |
// CmpN is a shortcut for: |
| 733 |
// |
| 734 |
// td.Cmp(t, got, td.N(num, tolerance), args...) |
| 735 |
// |
| 736 |
// See [N] for details. |
| 737 |
// |
| 738 |
// [N] optional parameter tolerance is here mandatory. |
| 739 |
// 0 value should be passed to mimic its absence in |
| 740 |
// original [N] call. |
| 741 |
// |
| 742 |
// Returns true if the test is OK, false if it fails. |
| 743 |
// |
| 744 |
// If t is a [*T] then its Config field is inherited. |
| 745 |
// |
| 746 |
// args... are optional and allow to name the test. This name is |
| 747 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 748 |
// the first item of args is a string and contains a '%' rune then |
| 749 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 750 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 751 |
// reason of a potential failure. |
| 752 |
func CmpN(t TestingT, got, num, tolerance any, args ...any) bool { |
| 753 |
t.Helper() |
| 754 |
return Cmp(t, got, N(num, tolerance), args...) |
| 755 |
} |
| 756 |
|
| 757 |
// CmpNaN is a shortcut for: |
| 758 |
// |
| 759 |
// td.Cmp(t, got, td.NaN(), args...) |
| 760 |
// |
| 761 |
// See [NaN] for details. |
| 762 |
// |
| 763 |
// Returns true if the test is OK, false if it fails. |
| 764 |
// |
| 765 |
// If t is a [*T] then its Config field is inherited. |
| 766 |
// |
| 767 |
// args... are optional and allow to name the test. This name is |
| 768 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 769 |
// the first item of args is a string and contains a '%' rune then |
| 770 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 771 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 772 |
// reason of a potential failure. |
| 773 |
func CmpNaN(t TestingT, got any, args ...any) bool { |
| 774 |
t.Helper() |
| 775 |
return Cmp(t, got, NaN(), args...) |
| 776 |
} |
| 777 |
|
| 778 |
// CmpNil is a shortcut for: |
| 779 |
// |
| 780 |
// td.Cmp(t, got, td.Nil(), args...) |
| 781 |
// |
| 782 |
// See [Nil] for details. |
| 783 |
// |
| 784 |
// Returns true if the test is OK, false if it fails. |
| 785 |
// |
| 786 |
// If t is a [*T] then its Config field is inherited. |
| 787 |
// |
| 788 |
// args... are optional and allow to name the test. This name is |
| 789 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 790 |
// the first item of args is a string and contains a '%' rune then |
| 791 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 792 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 793 |
// reason of a potential failure. |
| 794 |
func CmpNil(t TestingT, got any, args ...any) bool { |
| 795 |
t.Helper() |
| 796 |
return Cmp(t, got, Nil(), args...) |
| 797 |
} |
| 798 |
|
| 799 |
// CmpNone is a shortcut for: |
| 800 |
// |
| 801 |
// td.Cmp(t, got, td.None(notExpectedValues...), args...) |
| 802 |
// |
| 803 |
// See [None] for details. |
| 804 |
// |
| 805 |
// Returns true if the test is OK, false if it fails. |
| 806 |
// |
| 807 |
// If t is a [*T] then its Config field is inherited. |
| 808 |
// |
| 809 |
// args... are optional and allow to name the test. This name is |
| 810 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 811 |
// the first item of args is a string and contains a '%' rune then |
| 812 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 813 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 814 |
// reason of a potential failure. |
| 815 |
func CmpNone(t TestingT, got any, notExpectedValues []any, args ...any) bool { |
| 816 |
t.Helper() |
| 817 |
return Cmp(t, got, None(notExpectedValues...), args...) |
| 818 |
} |
| 819 |
|
| 820 |
// CmpNot is a shortcut for: |
| 821 |
// |
| 822 |
// td.Cmp(t, got, td.Not(notExpected), args...) |
| 823 |
// |
| 824 |
// See [Not] for details. |
| 825 |
// |
| 826 |
// Returns true if the test is OK, false if it fails. |
| 827 |
// |
| 828 |
// If t is a [*T] then its Config field is inherited. |
| 829 |
// |
| 830 |
// args... are optional and allow to name the test. This name is |
| 831 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 832 |
// the first item of args is a string and contains a '%' rune then |
| 833 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 834 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 835 |
// reason of a potential failure. |
| 836 |
func CmpNot(t TestingT, got, notExpected any, args ...any) bool { |
| 837 |
t.Helper() |
| 838 |
return Cmp(t, got, Not(notExpected), args...) |
| 839 |
} |
| 840 |
|
| 841 |
// CmpNotAny is a shortcut for: |
| 842 |
// |
| 843 |
// td.Cmp(t, got, td.NotAny(notExpectedItems...), args...) |
| 844 |
// |
| 845 |
// See [NotAny] for details. |
| 846 |
// |
| 847 |
// Returns true if the test is OK, false if it fails. |
| 848 |
// |
| 849 |
// If t is a [*T] then its Config field is inherited. |
| 850 |
// |
| 851 |
// args... are optional and allow to name the test. This name is |
| 852 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 853 |
// the first item of args is a string and contains a '%' rune then |
| 854 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 855 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 856 |
// reason of a potential failure. |
| 857 |
func CmpNotAny(t TestingT, got any, notExpectedItems []any, args ...any) bool { |
| 858 |
t.Helper() |
| 859 |
return Cmp(t, got, NotAny(notExpectedItems...), args...) |
| 860 |
} |
| 861 |
|
| 862 |
// CmpNotEmpty is a shortcut for: |
| 863 |
// |
| 864 |
// td.Cmp(t, got, td.NotEmpty(), args...) |
| 865 |
// |
| 866 |
// See [NotEmpty] for details. |
| 867 |
// |
| 868 |
// Returns true if the test is OK, false if it fails. |
| 869 |
// |
| 870 |
// If t is a [*T] then its Config field is inherited. |
| 871 |
// |
| 872 |
// args... are optional and allow to name the test. This name is |
| 873 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 874 |
// the first item of args is a string and contains a '%' rune then |
| 875 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 876 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 877 |
// reason of a potential failure. |
| 878 |
func CmpNotEmpty(t TestingT, got any, args ...any) bool { |
| 879 |
t.Helper() |
| 880 |
return Cmp(t, got, NotEmpty(), args...) |
| 881 |
} |
| 882 |
|
| 883 |
// CmpNotNaN is a shortcut for: |
| 884 |
// |
| 885 |
// td.Cmp(t, got, td.NotNaN(), args...) |
| 886 |
// |
| 887 |
// See [NotNaN] for details. |
| 888 |
// |
| 889 |
// Returns true if the test is OK, false if it fails. |
| 890 |
// |
| 891 |
// If t is a [*T] then its Config field is inherited. |
| 892 |
// |
| 893 |
// args... are optional and allow to name the test. This name is |
| 894 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 895 |
// the first item of args is a string and contains a '%' rune then |
| 896 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 897 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 898 |
// reason of a potential failure. |
| 899 |
func CmpNotNaN(t TestingT, got any, args ...any) bool { |
| 900 |
t.Helper() |
| 901 |
return Cmp(t, got, NotNaN(), args...) |
| 902 |
} |
| 903 |
|
| 904 |
// CmpNotNil is a shortcut for: |
| 905 |
// |
| 906 |
// td.Cmp(t, got, td.NotNil(), args...) |
| 907 |
// |
| 908 |
// See [NotNil] for details. |
| 909 |
// |
| 910 |
// Returns true if the test is OK, false if it fails. |
| 911 |
// |
| 912 |
// If t is a [*T] then its Config field is inherited. |
| 913 |
// |
| 914 |
// args... are optional and allow to name the test. This name is |
| 915 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 916 |
// the first item of args is a string and contains a '%' rune then |
| 917 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 918 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 919 |
// reason of a potential failure. |
| 920 |
func CmpNotNil(t TestingT, got any, args ...any) bool { |
| 921 |
t.Helper() |
| 922 |
return Cmp(t, got, NotNil(), args...) |
| 923 |
} |
| 924 |
|
| 925 |
// CmpNotZero is a shortcut for: |
| 926 |
// |
| 927 |
// td.Cmp(t, got, td.NotZero(), args...) |
| 928 |
// |
| 929 |
// See [NotZero] for details. |
| 930 |
// |
| 931 |
// Returns true if the test is OK, false if it fails. |
| 932 |
// |
| 933 |
// If t is a [*T] then its Config field is inherited. |
| 934 |
// |
| 935 |
// args... are optional and allow to name the test. This name is |
| 936 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 937 |
// the first item of args is a string and contains a '%' rune then |
| 938 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 939 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 940 |
// reason of a potential failure. |
| 941 |
func CmpNotZero(t TestingT, got any, args ...any) bool { |
| 942 |
t.Helper() |
| 943 |
return Cmp(t, got, NotZero(), args...) |
| 944 |
} |
| 945 |
|
| 946 |
// CmpPPtr is a shortcut for: |
| 947 |
// |
| 948 |
// td.Cmp(t, got, td.PPtr(val), args...) |
| 949 |
// |
| 950 |
// See [PPtr] for details. |
| 951 |
// |
| 952 |
// Returns true if the test is OK, false if it fails. |
| 953 |
// |
| 954 |
// If t is a [*T] then its Config field is inherited. |
| 955 |
// |
| 956 |
// args... are optional and allow to name the test. This name is |
| 957 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 958 |
// the first item of args is a string and contains a '%' rune then |
| 959 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 960 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 961 |
// reason of a potential failure. |
| 962 |
func CmpPPtr(t TestingT, got, val any, args ...any) bool { |
| 963 |
t.Helper() |
| 964 |
return Cmp(t, got, PPtr(val), args...) |
| 965 |
} |
| 966 |
|
| 967 |
// CmpPtr is a shortcut for: |
| 968 |
// |
| 969 |
// td.Cmp(t, got, td.Ptr(val), args...) |
| 970 |
// |
| 971 |
// See [Ptr] for details. |
| 972 |
// |
| 973 |
// Returns true if the test is OK, false if it fails. |
| 974 |
// |
| 975 |
// If t is a [*T] then its Config field is inherited. |
| 976 |
// |
| 977 |
// args... are optional and allow to name the test. This name is |
| 978 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 979 |
// the first item of args is a string and contains a '%' rune then |
| 980 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 981 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 982 |
// reason of a potential failure. |
| 983 |
func CmpPtr(t TestingT, got, val any, args ...any) bool { |
| 984 |
t.Helper() |
| 985 |
return Cmp(t, got, Ptr(val), args...) |
| 986 |
} |
| 987 |
|
| 988 |
// CmpRe is a shortcut for: |
| 989 |
// |
| 990 |
// td.Cmp(t, got, td.Re(reg, capture), args...) |
| 991 |
// |
| 992 |
// See [Re] for details. |
| 993 |
// |
| 994 |
// [Re] optional parameter capture is here mandatory. |
| 995 |
// nil value should be passed to mimic its absence in |
| 996 |
// original [Re] call. |
| 997 |
// |
| 998 |
// Returns true if the test is OK, false if it fails. |
| 999 |
// |
| 1000 |
// If t is a [*T] then its Config field is inherited. |
| 1001 |
// |
| 1002 |
// args... are optional and allow to name the test. This name is |
| 1003 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1004 |
// the first item of args is a string and contains a '%' rune then |
| 1005 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1006 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1007 |
// reason of a potential failure. |
| 1008 |
func CmpRe(t TestingT, got, reg, capture any, args ...any) bool { |
| 1009 |
t.Helper() |
| 1010 |
return Cmp(t, got, Re(reg, capture), args...) |
| 1011 |
} |
| 1012 |
|
| 1013 |
// CmpReAll is a shortcut for: |
| 1014 |
// |
| 1015 |
// td.Cmp(t, got, td.ReAll(reg, capture), args...) |
| 1016 |
// |
| 1017 |
// See [ReAll] for details. |
| 1018 |
// |
| 1019 |
// Returns true if the test is OK, false if it fails. |
| 1020 |
// |
| 1021 |
// If t is a [*T] then its Config field is inherited. |
| 1022 |
// |
| 1023 |
// args... are optional and allow to name the test. This name is |
| 1024 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1025 |
// the first item of args is a string and contains a '%' rune then |
| 1026 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1027 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1028 |
// reason of a potential failure. |
| 1029 |
func CmpReAll(t TestingT, got, reg, capture any, args ...any) bool { |
| 1030 |
t.Helper() |
| 1031 |
return Cmp(t, got, ReAll(reg, capture), args...) |
| 1032 |
} |
| 1033 |
|
| 1034 |
// CmpRecv is a shortcut for: |
| 1035 |
// |
| 1036 |
// td.Cmp(t, got, td.Recv(expectedValue, timeout), args...) |
| 1037 |
// |
| 1038 |
// See [Recv] for details. |
| 1039 |
// |
| 1040 |
// [Recv] optional parameter timeout is here mandatory. |
| 1041 |
// 0 value should be passed to mimic its absence in |
| 1042 |
// original [Recv] call. |
| 1043 |
// |
| 1044 |
// Returns true if the test is OK, false if it fails. |
| 1045 |
// |
| 1046 |
// If t is a [*T] then its Config field is inherited. |
| 1047 |
// |
| 1048 |
// args... are optional and allow to name the test. This name is |
| 1049 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1050 |
// the first item of args is a string and contains a '%' rune then |
| 1051 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1052 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1053 |
// reason of a potential failure. |
| 1054 |
func CmpRecv(t TestingT, got, expectedValue any, timeout time.Duration, args ...any) bool { |
| 1055 |
t.Helper() |
| 1056 |
return Cmp(t, got, Recv(expectedValue, timeout), args...) |
| 1057 |
} |
| 1058 |
|
| 1059 |
// CmpSet is a shortcut for: |
| 1060 |
// |
| 1061 |
// td.Cmp(t, got, td.Set(expectedItems...), args...) |
| 1062 |
// |
| 1063 |
// See [Set] for details. |
| 1064 |
// |
| 1065 |
// Returns true if the test is OK, false if it fails. |
| 1066 |
// |
| 1067 |
// If t is a [*T] then its Config field is inherited. |
| 1068 |
// |
| 1069 |
// args... are optional and allow to name the test. This name is |
| 1070 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1071 |
// the first item of args is a string and contains a '%' rune then |
| 1072 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1073 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1074 |
// reason of a potential failure. |
| 1075 |
func CmpSet(t TestingT, got any, expectedItems []any, args ...any) bool { |
| 1076 |
t.Helper() |
| 1077 |
return Cmp(t, got, Set(expectedItems...), args...) |
| 1078 |
} |
| 1079 |
|
| 1080 |
// CmpShallow is a shortcut for: |
| 1081 |
// |
| 1082 |
// td.Cmp(t, got, td.Shallow(expectedPtr), args...) |
| 1083 |
// |
| 1084 |
// See [Shallow] for details. |
| 1085 |
// |
| 1086 |
// Returns true if the test is OK, false if it fails. |
| 1087 |
// |
| 1088 |
// If t is a [*T] then its Config field is inherited. |
| 1089 |
// |
| 1090 |
// args... are optional and allow to name the test. This name is |
| 1091 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1092 |
// the first item of args is a string and contains a '%' rune then |
| 1093 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1094 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1095 |
// reason of a potential failure. |
| 1096 |
func CmpShallow(t TestingT, got, expectedPtr any, args ...any) bool { |
| 1097 |
t.Helper() |
| 1098 |
return Cmp(t, got, Shallow(expectedPtr), args...) |
| 1099 |
} |
| 1100 |
|
| 1101 |
// CmpSlice is a shortcut for: |
| 1102 |
// |
| 1103 |
// td.Cmp(t, got, td.Slice(model, expectedEntries), args...) |
| 1104 |
// |
| 1105 |
// See [Slice] for details. |
| 1106 |
// |
| 1107 |
// [Slice] optional parameter expectedEntries is here mandatory. |
| 1108 |
// nil value should be passed to mimic its absence in |
| 1109 |
// original [Slice] call. |
| 1110 |
// |
| 1111 |
// Returns true if the test is OK, false if it fails. |
| 1112 |
// |
| 1113 |
// If t is a [*T] then its Config field is inherited. |
| 1114 |
// |
| 1115 |
// args... are optional and allow to name the test. This name is |
| 1116 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1117 |
// the first item of args is a string and contains a '%' rune then |
| 1118 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1119 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1120 |
// reason of a potential failure. |
| 1121 |
func CmpSlice(t TestingT, got, model any, expectedEntries ArrayEntries, args ...any) bool { |
| 1122 |
t.Helper() |
| 1123 |
return Cmp(t, got, Slice(model, expectedEntries), args...) |
| 1124 |
} |
| 1125 |
|
| 1126 |
// CmpSmuggle is a shortcut for: |
| 1127 |
// |
| 1128 |
// td.Cmp(t, got, td.Smuggle(fn, expectedValue), args...) |
| 1129 |
// |
| 1130 |
// See [Smuggle] for details. |
| 1131 |
// |
| 1132 |
// Returns true if the test is OK, false if it fails. |
| 1133 |
// |
| 1134 |
// If t is a [*T] then its Config field is inherited. |
| 1135 |
// |
| 1136 |
// args... are optional and allow to name the test. This name is |
| 1137 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1138 |
// the first item of args is a string and contains a '%' rune then |
| 1139 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1140 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1141 |
// reason of a potential failure. |
| 1142 |
func CmpSmuggle(t TestingT, got, fn, expectedValue any, args ...any) bool { |
| 1143 |
t.Helper() |
| 1144 |
return Cmp(t, got, Smuggle(fn, expectedValue), args...) |
| 1145 |
} |
| 1146 |
|
| 1147 |
// CmpSort is a shortcut for: |
| 1148 |
// |
| 1149 |
// td.Cmp(t, got, td.Sort(how, expectedValue), args...) |
| 1150 |
// |
| 1151 |
// See [Sort] for details. |
| 1152 |
// |
| 1153 |
// Returns true if the test is OK, false if it fails. |
| 1154 |
// |
| 1155 |
// If t is a [*T] then its Config field is inherited. |
| 1156 |
// |
| 1157 |
// args... are optional and allow to name the test. This name is |
| 1158 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1159 |
// the first item of args is a string and contains a '%' rune then |
| 1160 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1161 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1162 |
// reason of a potential failure. |
| 1163 |
func CmpSort(t TestingT, got, how, expectedValue any, args ...any) bool { |
| 1164 |
t.Helper() |
| 1165 |
return Cmp(t, got, Sort(how, expectedValue), args...) |
| 1166 |
} |
| 1167 |
|
| 1168 |
// CmpSorted is a shortcut for: |
| 1169 |
// |
| 1170 |
// td.Cmp(t, got, td.Sorted(how), args...) |
| 1171 |
// |
| 1172 |
// See [Sorted] for details. |
| 1173 |
// |
| 1174 |
// [Sorted] optional parameter how is here mandatory. |
| 1175 |
// nil value should be passed to mimic its absence in |
| 1176 |
// original [Sorted] call. |
| 1177 |
// |
| 1178 |
// Returns true if the test is OK, false if it fails. |
| 1179 |
// |
| 1180 |
// If t is a [*T] then its Config field is inherited. |
| 1181 |
// |
| 1182 |
// args... are optional and allow to name the test. This name is |
| 1183 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1184 |
// the first item of args is a string and contains a '%' rune then |
| 1185 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1186 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1187 |
// reason of a potential failure. |
| 1188 |
func CmpSorted(t TestingT, got, how any, args ...any) bool { |
| 1189 |
t.Helper() |
| 1190 |
return Cmp(t, got, Sorted(how), args...) |
| 1191 |
} |
| 1192 |
|
| 1193 |
// CmpSStruct is a shortcut for: |
| 1194 |
// |
| 1195 |
// td.Cmp(t, got, td.SStruct(model, expectedFields), args...) |
| 1196 |
// |
| 1197 |
// See [SStruct] for details. |
| 1198 |
// |
| 1199 |
// [SStruct] optional parameter expectedFields is here mandatory. |
| 1200 |
// nil value should be passed to mimic its absence in |
| 1201 |
// original [SStruct] call. |
| 1202 |
// |
| 1203 |
// Returns true if the test is OK, false if it fails. |
| 1204 |
// |
| 1205 |
// If t is a [*T] then its Config field is inherited. |
| 1206 |
// |
| 1207 |
// args... are optional and allow to name the test. This name is |
| 1208 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1209 |
// the first item of args is a string and contains a '%' rune then |
| 1210 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1211 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1212 |
// reason of a potential failure. |
| 1213 |
func CmpSStruct(t TestingT, got, model any, expectedFields StructFields, args ...any) bool { |
| 1214 |
t.Helper() |
| 1215 |
return Cmp(t, got, SStruct(model, expectedFields), args...) |
| 1216 |
} |
| 1217 |
|
| 1218 |
// CmpString is a shortcut for: |
| 1219 |
// |
| 1220 |
// td.Cmp(t, got, td.String(expected), args...) |
| 1221 |
// |
| 1222 |
// See [String] for details. |
| 1223 |
// |
| 1224 |
// Returns true if the test is OK, false if it fails. |
| 1225 |
// |
| 1226 |
// If t is a [*T] then its Config field is inherited. |
| 1227 |
// |
| 1228 |
// args... are optional and allow to name the test. This name is |
| 1229 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1230 |
// the first item of args is a string and contains a '%' rune then |
| 1231 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1232 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1233 |
// reason of a potential failure. |
| 1234 |
func CmpString(t TestingT, got any, expected string, args ...any) bool { |
| 1235 |
t.Helper() |
| 1236 |
return Cmp(t, got, String(expected), args...) |
| 1237 |
} |
| 1238 |
|
| 1239 |
// CmpStruct is a shortcut for: |
| 1240 |
// |
| 1241 |
// td.Cmp(t, got, td.Struct(model, expectedFields), args...) |
| 1242 |
// |
| 1243 |
// See [Struct] for details. |
| 1244 |
// |
| 1245 |
// [Struct] optional parameter expectedFields is here mandatory. |
| 1246 |
// nil value should be passed to mimic its absence in |
| 1247 |
// original [Struct] call. |
| 1248 |
// |
| 1249 |
// Returns true if the test is OK, false if it fails. |
| 1250 |
// |
| 1251 |
// If t is a [*T] then its Config field is inherited. |
| 1252 |
// |
| 1253 |
// args... are optional and allow to name the test. This name is |
| 1254 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1255 |
// the first item of args is a string and contains a '%' rune then |
| 1256 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1257 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1258 |
// reason of a potential failure. |
| 1259 |
func CmpStruct(t TestingT, got, model any, expectedFields StructFields, args ...any) bool { |
| 1260 |
t.Helper() |
| 1261 |
return Cmp(t, got, Struct(model, expectedFields), args...) |
| 1262 |
} |
| 1263 |
|
| 1264 |
// CmpSubBagOf is a shortcut for: |
| 1265 |
// |
| 1266 |
// td.Cmp(t, got, td.SubBagOf(expectedItems...), args...) |
| 1267 |
// |
| 1268 |
// See [SubBagOf] for details. |
| 1269 |
// |
| 1270 |
// Returns true if the test is OK, false if it fails. |
| 1271 |
// |
| 1272 |
// If t is a [*T] then its Config field is inherited. |
| 1273 |
// |
| 1274 |
// args... are optional and allow to name the test. This name is |
| 1275 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1276 |
// the first item of args is a string and contains a '%' rune then |
| 1277 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1278 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1279 |
// reason of a potential failure. |
| 1280 |
func CmpSubBagOf(t TestingT, got any, expectedItems []any, args ...any) bool { |
| 1281 |
t.Helper() |
| 1282 |
return Cmp(t, got, SubBagOf(expectedItems...), args...) |
| 1283 |
} |
| 1284 |
|
| 1285 |
// CmpSubJSONOf is a shortcut for: |
| 1286 |
// |
| 1287 |
// td.Cmp(t, got, td.SubJSONOf(expectedJSON, params...), args...) |
| 1288 |
// |
| 1289 |
// See [SubJSONOf] for details. |
| 1290 |
// |
| 1291 |
// Returns true if the test is OK, false if it fails. |
| 1292 |
// |
| 1293 |
// If t is a [*T] then its Config field is inherited. |
| 1294 |
// |
| 1295 |
// args... are optional and allow to name the test. This name is |
| 1296 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1297 |
// the first item of args is a string and contains a '%' rune then |
| 1298 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1299 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1300 |
// reason of a potential failure. |
| 1301 |
func CmpSubJSONOf(t TestingT, got, expectedJSON any, params []any, args ...any) bool { |
| 1302 |
t.Helper() |
| 1303 |
return Cmp(t, got, SubJSONOf(expectedJSON, params...), args...) |
| 1304 |
} |
| 1305 |
|
| 1306 |
// CmpSubMapOf is a shortcut for: |
| 1307 |
// |
| 1308 |
// td.Cmp(t, got, td.SubMapOf(model, expectedEntries), args...) |
| 1309 |
// |
| 1310 |
// See [SubMapOf] for details. |
| 1311 |
// |
| 1312 |
// [SubMapOf] optional parameter expectedEntries is here mandatory. |
| 1313 |
// nil value should be passed to mimic its absence in |
| 1314 |
// original [SubMapOf] call. |
| 1315 |
// |
| 1316 |
// Returns true if the test is OK, false if it fails. |
| 1317 |
// |
| 1318 |
// If t is a [*T] then its Config field is inherited. |
| 1319 |
// |
| 1320 |
// args... are optional and allow to name the test. This name is |
| 1321 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1322 |
// the first item of args is a string and contains a '%' rune then |
| 1323 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1324 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1325 |
// reason of a potential failure. |
| 1326 |
func CmpSubMapOf(t TestingT, got, model any, expectedEntries MapEntries, args ...any) bool { |
| 1327 |
t.Helper() |
| 1328 |
return Cmp(t, got, SubMapOf(model, expectedEntries), args...) |
| 1329 |
} |
| 1330 |
|
| 1331 |
// CmpSubSetOf is a shortcut for: |
| 1332 |
// |
| 1333 |
// td.Cmp(t, got, td.SubSetOf(expectedItems...), args...) |
| 1334 |
// |
| 1335 |
// See [SubSetOf] for details. |
| 1336 |
// |
| 1337 |
// Returns true if the test is OK, false if it fails. |
| 1338 |
// |
| 1339 |
// If t is a [*T] then its Config field is inherited. |
| 1340 |
// |
| 1341 |
// args... are optional and allow to name the test. This name is |
| 1342 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1343 |
// the first item of args is a string and contains a '%' rune then |
| 1344 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1345 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1346 |
// reason of a potential failure. |
| 1347 |
func CmpSubSetOf(t TestingT, got any, expectedItems []any, args ...any) bool { |
| 1348 |
t.Helper() |
| 1349 |
return Cmp(t, got, SubSetOf(expectedItems...), args...) |
| 1350 |
} |
| 1351 |
|
| 1352 |
// CmpSuperBagOf is a shortcut for: |
| 1353 |
// |
| 1354 |
// td.Cmp(t, got, td.SuperBagOf(expectedItems...), args...) |
| 1355 |
// |
| 1356 |
// See [SuperBagOf] for details. |
| 1357 |
// |
| 1358 |
// Returns true if the test is OK, false if it fails. |
| 1359 |
// |
| 1360 |
// If t is a [*T] then its Config field is inherited. |
| 1361 |
// |
| 1362 |
// args... are optional and allow to name the test. This name is |
| 1363 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1364 |
// the first item of args is a string and contains a '%' rune then |
| 1365 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1366 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1367 |
// reason of a potential failure. |
| 1368 |
func CmpSuperBagOf(t TestingT, got any, expectedItems []any, args ...any) bool { |
| 1369 |
t.Helper() |
| 1370 |
return Cmp(t, got, SuperBagOf(expectedItems...), args...) |
| 1371 |
} |
| 1372 |
|
| 1373 |
// CmpSuperJSONOf is a shortcut for: |
| 1374 |
// |
| 1375 |
// td.Cmp(t, got, td.SuperJSONOf(expectedJSON, params...), args...) |
| 1376 |
// |
| 1377 |
// See [SuperJSONOf] for details. |
| 1378 |
// |
| 1379 |
// Returns true if the test is OK, false if it fails. |
| 1380 |
// |
| 1381 |
// If t is a [*T] then its Config field is inherited. |
| 1382 |
// |
| 1383 |
// args... are optional and allow to name the test. This name is |
| 1384 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1385 |
// the first item of args is a string and contains a '%' rune then |
| 1386 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1387 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1388 |
// reason of a potential failure. |
| 1389 |
func CmpSuperJSONOf(t TestingT, got, expectedJSON any, params []any, args ...any) bool { |
| 1390 |
t.Helper() |
| 1391 |
return Cmp(t, got, SuperJSONOf(expectedJSON, params...), args...) |
| 1392 |
} |
| 1393 |
|
| 1394 |
// CmpSuperMapOf is a shortcut for: |
| 1395 |
// |
| 1396 |
// td.Cmp(t, got, td.SuperMapOf(model, expectedEntries), args...) |
| 1397 |
// |
| 1398 |
// See [SuperMapOf] for details. |
| 1399 |
// |
| 1400 |
// [SuperMapOf] optional parameter expectedEntries is here mandatory. |
| 1401 |
// nil value should be passed to mimic its absence in |
| 1402 |
// original [SuperMapOf] call. |
| 1403 |
// |
| 1404 |
// Returns true if the test is OK, false if it fails. |
| 1405 |
// |
| 1406 |
// If t is a [*T] then its Config field is inherited. |
| 1407 |
// |
| 1408 |
// args... are optional and allow to name the test. This name is |
| 1409 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1410 |
// the first item of args is a string and contains a '%' rune then |
| 1411 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1412 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1413 |
// reason of a potential failure. |
| 1414 |
func CmpSuperMapOf(t TestingT, got, model any, expectedEntries MapEntries, args ...any) bool { |
| 1415 |
t.Helper() |
| 1416 |
return Cmp(t, got, SuperMapOf(model, expectedEntries), args...) |
| 1417 |
} |
| 1418 |
|
| 1419 |
// CmpSuperSetOf is a shortcut for: |
| 1420 |
// |
| 1421 |
// td.Cmp(t, got, td.SuperSetOf(expectedItems...), args...) |
| 1422 |
// |
| 1423 |
// See [SuperSetOf] for details. |
| 1424 |
// |
| 1425 |
// Returns true if the test is OK, false if it fails. |
| 1426 |
// |
| 1427 |
// If t is a [*T] then its Config field is inherited. |
| 1428 |
// |
| 1429 |
// args... are optional and allow to name the test. This name is |
| 1430 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1431 |
// the first item of args is a string and contains a '%' rune then |
| 1432 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1433 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1434 |
// reason of a potential failure. |
| 1435 |
func CmpSuperSetOf(t TestingT, got any, expectedItems []any, args ...any) bool { |
| 1436 |
t.Helper() |
| 1437 |
return Cmp(t, got, SuperSetOf(expectedItems...), args...) |
| 1438 |
} |
| 1439 |
|
| 1440 |
// CmpSuperSliceOf is a shortcut for: |
| 1441 |
// |
| 1442 |
// td.Cmp(t, got, td.SuperSliceOf(model, expectedEntries), args...) |
| 1443 |
// |
| 1444 |
// See [SuperSliceOf] for details. |
| 1445 |
// |
| 1446 |
// [SuperSliceOf] optional parameter expectedEntries is here mandatory. |
| 1447 |
// nil value should be passed to mimic its absence in |
| 1448 |
// original [SuperSliceOf] call. |
| 1449 |
// |
| 1450 |
// Returns true if the test is OK, false if it fails. |
| 1451 |
// |
| 1452 |
// If t is a [*T] then its Config field is inherited. |
| 1453 |
// |
| 1454 |
// args... are optional and allow to name the test. This name is |
| 1455 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1456 |
// the first item of args is a string and contains a '%' rune then |
| 1457 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1458 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1459 |
// reason of a potential failure. |
| 1460 |
func CmpSuperSliceOf(t TestingT, got, model any, expectedEntries ArrayEntries, args ...any) bool { |
| 1461 |
t.Helper() |
| 1462 |
return Cmp(t, got, SuperSliceOf(model, expectedEntries), args...) |
| 1463 |
} |
| 1464 |
|
| 1465 |
// CmpTruncTime is a shortcut for: |
| 1466 |
// |
| 1467 |
// td.Cmp(t, got, td.TruncTime(expectedTime, trunc), args...) |
| 1468 |
// |
| 1469 |
// See [TruncTime] for details. |
| 1470 |
// |
| 1471 |
// [TruncTime] optional parameter trunc is here mandatory. |
| 1472 |
// 0 value should be passed to mimic its absence in |
| 1473 |
// original [TruncTime] call. |
| 1474 |
// |
| 1475 |
// Returns true if the test is OK, false if it fails. |
| 1476 |
// |
| 1477 |
// If t is a [*T] then its Config field is inherited. |
| 1478 |
// |
| 1479 |
// args... are optional and allow to name the test. This name is |
| 1480 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1481 |
// the first item of args is a string and contains a '%' rune then |
| 1482 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1483 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1484 |
// reason of a potential failure. |
| 1485 |
func CmpTruncTime(t TestingT, got, expectedTime any, trunc time.Duration, args ...any) bool { |
| 1486 |
t.Helper() |
| 1487 |
return Cmp(t, got, TruncTime(expectedTime, trunc), args...) |
| 1488 |
} |
| 1489 |
|
| 1490 |
// CmpValues is a shortcut for: |
| 1491 |
// |
| 1492 |
// td.Cmp(t, got, td.Values(val), args...) |
| 1493 |
// |
| 1494 |
// See [Values] for details. |
| 1495 |
// |
| 1496 |
// Returns true if the test is OK, false if it fails. |
| 1497 |
// |
| 1498 |
// If t is a [*T] then its Config field is inherited. |
| 1499 |
// |
| 1500 |
// args... are optional and allow to name the test. This name is |
| 1501 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1502 |
// the first item of args is a string and contains a '%' rune then |
| 1503 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1504 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1505 |
// reason of a potential failure. |
| 1506 |
func CmpValues(t TestingT, got, val any, args ...any) bool { |
| 1507 |
t.Helper() |
| 1508 |
return Cmp(t, got, Values(val), args...) |
| 1509 |
} |
| 1510 |
|
| 1511 |
// CmpZero is a shortcut for: |
| 1512 |
// |
| 1513 |
// td.Cmp(t, got, td.Zero(), args...) |
| 1514 |
// |
| 1515 |
// See [Zero] for details. |
| 1516 |
// |
| 1517 |
// Returns true if the test is OK, false if it fails. |
| 1518 |
// |
| 1519 |
// If t is a [*T] then its Config field is inherited. |
| 1520 |
// |
| 1521 |
// args... are optional and allow to name the test. This name is |
| 1522 |
// used in case of failure to qualify the test. If len(args) > 1 and |
| 1523 |
// the first item of args is a string and contains a '%' rune then |
| 1524 |
// [fmt.Fprintf] is used to compose the name, else args are passed to |
| 1525 |
// [fmt.Fprint]. Do not forget it is the name of the test, not the |
| 1526 |
// reason of a potential failure. |
| 1527 |
func CmpZero(t TestingT, got any, args ...any) bool { |
| 1528 |
t.Helper() |
| 1529 |
return Cmp(t, got, Zero(), args...) |
| 1530 |
} |