Comparison
Comparing Ordered Values
Assertions
All links point to https://pkg.go.dev/github.com/go-openapi/testify/v2
This domain exposes 12 functionalities. Generic assertions are marked with a .
Greater
Greater asserts that the first element is strictly greater than the second.
Both elements must be of the same type in the reflect.Kind sense. To compare values that need a type conversion (e.g. float32 against float64), you need to convert types beforehand.
| Signature | Usage |
|---|---|
assert.Greater(t T, e1 any, e2 any, msgAndArgs ...any) bool | package-level function |
assert.Greaterf(t T, e1 any, e2 any, msg string, args ...any) bool | formatted variant |
assert.(*Assertions).Greater(e1 any, e2 any) bool | method variant |
assert.(*Assertions).Greaterf(e1 any, e2 any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
require.Greater(t T, e1 any, e2 any, msgAndArgs ...any) bool | package-level function |
require.Greaterf(t T, e1 any, e2 any, msg string, args ...any) bool | formatted variant |
require.(*Assertions).Greater(e1 any, e2 any) bool | method variant |
require.(*Assertions).Greaterf(e1 any, e2 any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
assertions.Greater(t T, e1 any, e2 any, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#Greater
GreaterOrEqual
GreaterOrEqual asserts that the first element is greater than or equal to the second.
See also Greater.
| Signature | Usage |
|---|---|
assert.GreaterOrEqual(t T, e1 any, e2 any, msgAndArgs ...any) bool | package-level function |
assert.GreaterOrEqualf(t T, e1 any, e2 any, msg string, args ...any) bool | formatted variant |
assert.(*Assertions).GreaterOrEqual(e1 any, e2 any) bool | method variant |
assert.(*Assertions).GreaterOrEqualf(e1 any, e2 any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
require.GreaterOrEqual(t T, e1 any, e2 any, msgAndArgs ...any) bool | package-level function |
require.GreaterOrEqualf(t T, e1 any, e2 any, msg string, args ...any) bool | formatted variant |
require.(*Assertions).GreaterOrEqual(e1 any, e2 any) bool | method variant |
require.(*Assertions).GreaterOrEqualf(e1 any, e2 any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
assertions.GreaterOrEqual(t T, e1 any, e2 any, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#GreaterOrEqual
GreaterOrEqualT[Orderable Ordered]
GreaterOrEqualT asserts that for two elements of the same type, the first element is greater than or equal to the second.
The Ordered type can be any of Go’s cmp.Ordered (strings, numeric types), []byte (uses bytes.Compare) and time.Time (uses time.Time.Compare.
Notice that pointers are not Ordered, but uintptr are. So you can’t call GreaterOrEqualT with [*time.Time].
GreaterOrEqualT ensures type safety at build time. If you need to compare values with a dynamically assigned type, use GreaterOrEqual instead.
To compare values that need a type conversion (e.g. float32 against float64), you need to convert types beforehand.
| Signature | Usage |
|---|---|
assert.GreaterOrEqualT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | package-level function |
assert.GreaterOrEqualTf[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
require.GreaterOrEqualT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | package-level function |
require.GreaterOrEqualTf[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
assertions.GreaterOrEqualT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#GreaterOrEqualT
GreaterT[Orderable Ordered]
GreaterT asserts that for two elements of the same type, the first element is strictly greater than the second.
The Ordered type can be any of Go’s cmp.Ordered (strings, numeric types), []byte (uses bytes.Compare) and time.Time (uses time.Time.Compare.
Notice that pointers are not Ordered, but uintptr are. So you can’t call GreaterT with [*time.Time].
GreaterT ensures type safety at build time. If you need to compare values with a dynamically assigned type, use Greater instead.
To compare values that need a type conversion (e.g. float32 against float64), you need to convert types beforehand.
| Signature | Usage |
|---|---|
assert.GreaterT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | package-level function |
assert.GreaterTf[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
require.GreaterT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | package-level function |
require.GreaterTf[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
assertions.GreaterT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#GreaterT
Less
Less asserts that the first element is strictly less than the second.
Both elements must be of the same type in the reflect.Kind sense. To compare values that need a type conversion (e.g. float32 against float64), you need to convert types beforehand.
| Signature | Usage |
|---|---|
assert.Less(t T, e1 any, e2 any, msgAndArgs ...any) bool | package-level function |
assert.Lessf(t T, e1 any, e2 any, msg string, args ...any) bool | formatted variant |
assert.(*Assertions).Less(e1 any, e2 any) bool | method variant |
assert.(*Assertions).Lessf(e1 any, e2 any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
require.Less(t T, e1 any, e2 any, msgAndArgs ...any) bool | package-level function |
require.Lessf(t T, e1 any, e2 any, msg string, args ...any) bool | formatted variant |
require.(*Assertions).Less(e1 any, e2 any) bool | method variant |
require.(*Assertions).Lessf(e1 any, e2 any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
assertions.Less(t T, e1 any, e2 any, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#Less
LessOrEqual
LessOrEqual asserts that the first element is less than or equal to the second.
| Signature | Usage |
|---|---|
assert.LessOrEqual(t T, e1 any, e2 any, msgAndArgs ...any) bool | package-level function |
assert.LessOrEqualf(t T, e1 any, e2 any, msg string, args ...any) bool | formatted variant |
assert.(*Assertions).LessOrEqual(e1 any, e2 any) bool | method variant |
assert.(*Assertions).LessOrEqualf(e1 any, e2 any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
require.LessOrEqual(t T, e1 any, e2 any, msgAndArgs ...any) bool | package-level function |
require.LessOrEqualf(t T, e1 any, e2 any, msg string, args ...any) bool | formatted variant |
require.(*Assertions).LessOrEqual(e1 any, e2 any) bool | method variant |
require.(*Assertions).LessOrEqualf(e1 any, e2 any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
assertions.LessOrEqual(t T, e1 any, e2 any, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#LessOrEqual
LessOrEqualT[Orderable Ordered]
LessOrEqualT asserts that for two elements of the same type, the first element is less than or equal to the second.
The Ordered type can be any of Go’s cmp.Ordered (strings, numeric types), []byte (uses bytes.Compare) and time.Time (uses time.Time.Compare.
Notice that pointers are not Ordered, but uintptr are. So you can’t call LessOrEqualT with [*time.Time].
LessOrEqualT ensures type safety at build time. If you need to compare values with a dynamically assigned type, use LessOrEqual instead.
To compare values that need a type conversion (e.g. float32 against float64), you should use LessOrEqual instead.
| Signature | Usage |
|---|---|
assert.LessOrEqualT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | package-level function |
assert.LessOrEqualTf[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
require.LessOrEqualT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | package-level function |
require.LessOrEqualTf[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
assertions.LessOrEqualT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#LessOrEqualT
LessT[Orderable Ordered]
LessT asserts that for two elements of the same type, the first element is strictly less than the second.
The Ordered type can be any of Go’s cmp.Ordered (strings, numeric types), []byte (uses bytes.Compare) and time.Time (uses time.Time.Compare.
Notice that pointers are not Ordered, but uintptr are. So you can’t call LessT with [*time.Time].
LessT ensures type safety at build time. If you need to compare values with a dynamically assigned type, use Less instead.
To compare values that need a type conversion (e.g. float32 against float64), you need to convert types beforehand.
| Signature | Usage |
|---|---|
assert.LessT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | package-level function |
assert.LessTf[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
require.LessT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | package-level function |
require.LessTf[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
assertions.LessT[Orderable Ordered](t T, e1 Orderable, e2 Orderable, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#LessT
Negative
Negative asserts that the specified element is strictly negative.
| Signature | Usage |
|---|---|
assert.Negative(t T, e any, msgAndArgs ...any) bool | package-level function |
assert.Negativef(t T, e any, msg string, args ...any) bool | formatted variant |
assert.(*Assertions).Negative(e any) bool | method variant |
assert.(*Assertions).Negativef(e any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
require.Negative(t T, e any, msgAndArgs ...any) bool | package-level function |
require.Negativef(t T, e any, msg string, args ...any) bool | formatted variant |
require.(*Assertions).Negative(e any) bool | method variant |
require.(*Assertions).Negativef(e any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
assertions.Negative(t T, e any, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#Negative
NegativeT[SignedNumber SignedNumeric]
NegativeT asserts that the specified element of a signed numeric type is strictly negative.
| Signature | Usage |
|---|---|
assert.NegativeT[SignedNumber SignedNumeric](t T, e SignedNumber, msgAndArgs ...any) bool | package-level function |
assert.NegativeTf[SignedNumber SignedNumeric](t T, e SignedNumber, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
require.NegativeT[SignedNumber SignedNumeric](t T, e SignedNumber, msgAndArgs ...any) bool | package-level function |
require.NegativeTf[SignedNumber SignedNumeric](t T, e SignedNumber, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
assertions.NegativeT[SignedNumber SignedNumeric](t T, e SignedNumber, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#NegativeT
Positive
Positive asserts that the specified element is strictly positive.
| Signature | Usage |
|---|---|
assert.Positive(t T, e any, msgAndArgs ...any) bool | package-level function |
assert.Positivef(t T, e any, msg string, args ...any) bool | formatted variant |
assert.(*Assertions).Positive(e any) bool | method variant |
assert.(*Assertions).Positivef(e any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
require.Positive(t T, e any, msgAndArgs ...any) bool | package-level function |
require.Positivef(t T, e any, msg string, args ...any) bool | formatted variant |
require.(*Assertions).Positive(e any) bool | method variant |
require.(*Assertions).Positivef(e any, msg string, args ..any) | method formatted variant |
| Signature | Usage |
|---|---|
assertions.Positive(t T, e any, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#Positive
PositiveT[SignedNumber SignedNumeric]
PositiveT asserts that the specified element of a signed numeric type is strictly positive.
| Signature | Usage |
|---|---|
assert.PositiveT[SignedNumber SignedNumeric](t T, e SignedNumber, msgAndArgs ...any) bool | package-level function |
assert.PositiveTf[SignedNumber SignedNumeric](t T, e SignedNumber, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
require.PositiveT[SignedNumber SignedNumeric](t T, e SignedNumber, msgAndArgs ...any) bool | package-level function |
require.PositiveTf[SignedNumber SignedNumeric](t T, e SignedNumber, msg string, args ...any) bool | formatted variant |
| Signature | Usage |
|---|---|
assertions.PositiveT[SignedNumber SignedNumeric](t T, e SignedNumber, msgAndArgs ...any) bool | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#PositiveT
Generated with github.com/go-openapi/testify/codegen/v2