MCPcopy
hub / github.com/expr-lang/expr / TestLess

Function TestLess

internal/testify/assert/assertion_compare_test.go:217–259  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

215}
216
217func TestLess(t *testing.T) {
218 mockT := new(testing.T)
219
220 if !Less(mockT, 1, 2) {
221 t.Error("Less should return true")
222 }
223
224 if Less(mockT, 1, 1) {
225 t.Error("Less should return false")
226 }
227
228 if Less(mockT, 2, 1) {
229 t.Error("Less should return false")
230 }
231
232 // Check error report
233 for _, currCase := range []struct {
234 less interface{}
235 greater interface{}
236 msg string
237 }{
238 {less: "a", greater: "b", msg: `"b" is not less than "a"`},
239 {less: int(1), greater: int(2), msg: `"2" is not less than "1"`},
240 {less: int8(1), greater: int8(2), msg: `"2" is not less than "1"`},
241 {less: int16(1), greater: int16(2), msg: `"2" is not less than "1"`},
242 {less: int32(1), greater: int32(2), msg: `"2" is not less than "1"`},
243 {less: int64(1), greater: int64(2), msg: `"2" is not less than "1"`},
244 {less: uint8(1), greater: uint8(2), msg: `"2" is not less than "1"`},
245 {less: uint16(1), greater: uint16(2), msg: `"2" is not less than "1"`},
246 {less: uint32(1), greater: uint32(2), msg: `"2" is not less than "1"`},
247 {less: uint64(1), greater: uint64(2), msg: `"2" is not less than "1"`},
248 {less: float32(1.23), greater: float32(2.34), msg: `"2.34" is not less than "1.23"`},
249 {less: float64(1.23), greater: float64(2.34), msg: `"2.34" is not less than "1.23"`},
250 {less: uintptr(1), greater: uintptr(2), msg: `"2" is not less than "1"`},
251 {less: time.Time{}, greater: time.Time{}.Add(time.Hour), msg: `"0001-01-01 01:00:00 +0000 UTC" is not less than "0001-01-01 00:00:00 +0000 UTC"`},
252 {less: []byte{1, 1}, greater: []byte{1, 2}, msg: `"[1 2]" is not less than "[1 1]"`},
253 } {
254 out := &outputT{buf: bytes.NewBuffer(nil)}
255 False(t, Less(out, currCase.greater, currCase.less))
256 Contains(t, out.buf.String(), currCase.msg)
257 Contains(t, out.helpers, "github.com/expr-lang/expr/internal/testify/assert.Less")
258 }
259}
260
261func TestLessOrEqual(t *testing.T) {
262 mockT := new(testing.T)

Callers

nothing calls this directly

Calls 6

LessFunction · 0.70
FalseFunction · 0.70
ContainsFunction · 0.70
AddMethod · 0.65
StringMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…