testes

package
v0.0.0-...-24ca9bf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Args2Pairs

func Args2Pairs(args ...string) [][2]string

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 AssertDeepEqual[T any](got, want T) bool

func AssertEqual

func AssertEqual[T comparable](got, want T) bool

func AssertGreaterThan

func AssertGreaterThan[T Ordered](got, want T) bool

func AssertLessThan

func AssertLessThan[T Ordered](got, want T) bool

func AssertNotContains

func AssertNotContains[T comparable, E ~[]T](needle T, haystack E) bool

func AssertNotDeepEqual

func AssertNotDeepEqual[T any](got, want T) bool

func AssertNotEqual

func AssertNotEqual[T comparable](got, want T) bool

func AssertStringEqualFold

func AssertStringEqualFold(args ...string) bool

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

func AssertStringHasPrefix(args ...string) bool

AssertStringHasPrefix returns true if all string arguments have the given prefix. args[0] must contain the prefix being tested.

func AssertStringHasSuffix

func AssertStringHasSuffix(args ...string) bool

AssertStringHasSuffix returns true if all string arguments have the given suffix. args[0] must contain the suffix being tested.

func AssertTheEmptyString

func AssertTheEmptyString(args ...string) bool

AssertTheEmptyString returns true if all string arguments are The Empty String.

func CheckPairs

func CheckPairs[T any](args ...T) bool

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

func Fields2String[T any](args ...T) []string

Fields2String returns a list of string representations of a variadic list of args.

func Join

func Join[T any, E ~[]T](elems E, sep string) string

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

func Len[T any](elems T) int

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.

func TRun

func TRun[T comparable](t *testing.T, name, arg string, got, want T)

func TRunDeep

func TRunDeep[T any](t *testing.T, name, arg string, got, want T)

func TRunEqual

func TRunEqual[T comparable](t *testing.T, name, arg string, got, want T)

func ToFields

func ToFields(elems ...string) []string

ToFields cleans and normalizes whitespace in a slice of strings.

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL