Documentation
¶
Index ¶
- Variables
- func Author() string
- func Compare(x, y interface{}, op string) error
- func Contains(t *testing.T, got, exp interface{}, args ...interface{})
- func Equal(t *testing.T, got, exp interface{}, args ...interface{})
- func False(t *testing.T, got interface{}, args ...interface{})
- func Ge(t *testing.T, got, exp interface{}, args ...interface{})
- func Gt(t *testing.T, got, exp interface{}, args ...interface{})
- func If(c bool, x, y interface{}) interface{}
- func IsContains(array interface{}, value interface{}) bool
- func IsGe(x, y interface{}) bool
- func IsGt(x, y interface{}) bool
- func IsLe(x, y interface{}) bool
- func IsLt(x, y interface{}) bool
- func IsMatch(r interface{}, v interface{}) bool
- func IsZero(v interface{}) bool
- func Le(t *testing.T, got, exp interface{}, args ...interface{})
- func Len(t *testing.T, got interface{}, exp int, args ...interface{})
- func Length(v interface{}) int
- func License() string
- func Lt(t *testing.T, got, exp interface{}, args ...interface{})
- func Match(t *testing.T, got, exp interface{}, args ...interface{})
- func Nil(t *testing.T, got interface{}, args ...interface{})
- func NotContains(t *testing.T, got, exp interface{}, args ...interface{})
- func NotEqual(t *testing.T, got, exp interface{}, args ...interface{})
- func NotLen(t *testing.T, got interface{}, exp int, args ...interface{})
- func NotMatch(t *testing.T, got, exp interface{}, args ...interface{})
- func NotNil(t *testing.T, got interface{}, args ...interface{})
- func NotPanic(t *testing.T, fn func(), args ...interface{})
- func NotZero(t *testing.T, got interface{}, args ...interface{})
- func Panic(t *testing.T, fn func(), args ...interface{})
- func ToFloat64(v interface{}) (float64, error)
- func ToInt64(v interface{}) (int64, error)
- func ToUint64(v interface{}) (uint64, error)
- func True(t *testing.T, got interface{}, args ...interface{})
- func Version() string
- func Zero(t *testing.T, got interface{}, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
var CMP = struct { LT string LE string GT string GE string }{ "<", "<=", ">", ">=", }
CMP is compare operation
var ErrGreater = errors.New("left is greater then right")
ErrGreater is expect to be less error
var ErrInvalid = errors.New("value if invalid")
ErrInvalid is value invalid for operation
var ErrLess = errors.New("left is less the right")
ErrLess is expect to be greater error
Functions ¶
func Compare ¶
Compare compare x and y, by operation It returns nil for true, ErrInvalid for invalid operation, err for false
Compare(1, 2, ">") // number compare -> true Compare("a", "a", ">=") // string compare -> true Compare([]string{"a", "b"}, []string{"a"}, "<") // slice len compare -> false
func If ¶
func If(c bool, x, y interface{}) interface{}
If returns x if c is true, else y
z = If(c, x, y)
equal to:
z = c ? x : y
func IsContains ¶
func IsContains(array interface{}, value interface{}) bool
IsContains returns whether value is within array
func IsGe ¶
func IsGe(x, y interface{}) bool
IsGe returns if x greater than or equal to y, value invalid will returns false
func IsGt ¶
func IsGt(x, y interface{}) bool
IsGt returns if x greater than y, value invalid will returns false
func IsLe ¶
func IsLe(x, y interface{}) bool
IsLe returns if x less than or equal to y, value invalid will returns false
func IsLt ¶
func IsLt(x, y interface{}) bool
IsLt returns if x less than y, value invalid will returns false
func IsMatch ¶
func IsMatch(r interface{}, v interface{}) bool
IsMatch returns if value v contains any match of pattern r
IsMatch(regexp.MustCompile("v\d+"), "v100") IsMatch("v\d+", "v100") IsMatch("\d+\.\d+", 100.1)
func NotContains ¶
NotContains assert test value to be contains
Types ¶
This section is empty.