Documentation ¶
Index ¶
- func Args2Pairs(args ...string) [][2]string
- func AssertContains[T comparable, E ~[]T](needle T, haystack E) bool
- func AssertDeepEqual[T any](got, want T) bool
- func AssertEqual[T comparable](got, want T) bool
- func AssertGreaterThan[T Ordered](got, want T) bool
- func AssertLessThan[T Ordered](got, want T) bool
- func AssertNotContains[T comparable, E ~[]T](needle T, haystack E) bool
- func AssertNotDeepEqual[T any](got, want T) bool
- func AssertNotEqual[T comparable](got, want T) bool
- func AssertStringEqualFold(args ...string) bool
- func AssertStringHasPrefix(args ...string) bool
- func AssertStringHasSuffix(args ...string) bool
- func AssertTheEmptyString(args ...string) bool
- func CheckPairs[T any](args ...T) bool
- func Contains[T comparable, E ~[]T](needle T, haystack E) bool
- func Fields2String[T any](args ...T) []string
- func Join[T any, E ~[]T](elems E, sep string) string
- func Len[T any](elems T) int
- func TRun[T comparable](t *testing.T, name, arg string, got, want T)
- func TRunDeep[T any](t *testing.T, name, arg string, got, want T)
- func TRunEqual[T comparable](t *testing.T, name, arg string, got, want T)
- func ToFields(elems ...string) []string
- type Ordered
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Args2Pairs ¶
Args2Pairs returns a slice of string pairs from a standard slice of strings. Whitespace is trimmed and normalized.
Args2Pairs will panic if the number of arguments is less than 2 or not a multiple of 2.
func AssertContains ¶
func AssertContains[T comparable, E ~[]T](needle T, haystack E) bool
func AssertDeepEqual ¶
func AssertEqual ¶
func AssertEqual[T comparable](got, want T) bool
func AssertGreaterThan ¶
func AssertLessThan ¶
func AssertNotContains ¶
func AssertNotContains[T comparable, E ~[]T](needle T, haystack E) bool
func AssertNotDeepEqual ¶
func AssertNotEqual ¶
func AssertNotEqual[T comparable](got, want T) bool
func AssertStringEqualFold ¶
AssertStringEqualFold returns true if all string pairs have equal folding.
EqualFold reports whether two strings, interpreted as UTF-8 strings, are equal under Unicode case-folding, which is a more general form of case-insensitivity.
Only pairs of args are considered; number of args must be a positive integer multiple of two.
func AssertStringHasPrefix ¶
AssertStringHasPrefix returns true if all string arguments have the given prefix. args[0] must contain the prefix being tested.
func AssertStringHasSuffix ¶
AssertStringHasSuffix returns true if all string arguments have the given suffix. args[0] must contain the suffix being tested.
func AssertTheEmptyString ¶
AssertTheEmptyString returns true if all string arguments are The Empty String.
func CheckPairs ¶
CheckPairs returns true if the given args slice contains an even number of elements.
func Contains ¶
func Contains[T comparable, E ~[]T](needle T, haystack E) bool
Contains returns true if haystack contains needle.
func Fields2String ¶
Fields2String returns a list of string representations of a variadic list of args.
func Join ¶
Join concatenates the string representations of a variadic list of elements to create a single string. The separator string sep is placed between elements in the resulting string.
func Len ¶
Len returns the length of any arbitrary argument. The method used depends on the type of argument and it may not give the most expected results:
for types Array, Pointer to array, Slice, Map, String, and Channel, the builtin len() function is used and will return the number of elements in the collection as described in the standard library:
Array: the number of elements in v. Pointer to array: the number of elements in *v (even if v is nil). Slice, or map: the number of elements in v; if v is nil, len(v) is zero. String: the number of bytes in v. Channel: the number of elements queued (unread) in the channel buffer; if v is nil, len(v) is zero.
For boolean values, the length is 1. For pointer types, the value returned is based on the underlying value. For other types, it returns the length of the string representation of the argument using the fmt package.
Types ¶
type Ordered ¶
type Ordered constraints.Ordered
Directories ¶
Path | Synopsis |
---|---|
sample_benchmarks/fib/fib
Package fib contains sample benchmarks for Fibonacci numbers.
|
Package fib contains sample benchmarks for Fibonacci numbers. |
cmd
|
|