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

Function TestIsNonIncreasing

internal/testify/assert/assertion_order_test.go:53–96  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

51}
52
53func TestIsNonIncreasing(t *testing.T) {
54 mockT := new(testing.T)
55
56 if !IsNonIncreasing(mockT, []int{2, 1}) {
57 t.Error("IsNonIncreasing should return true")
58 }
59
60 if !IsNonIncreasing(mockT, []int{5, 4, 4, 3, 2, 1}) {
61 t.Error("IsNonIncreasing should return true")
62 }
63
64 if !IsNonIncreasing(mockT, []int{1, 1}) {
65 t.Error("IsNonIncreasing should return true")
66 }
67
68 if IsNonIncreasing(mockT, []int{1, 2}) {
69 t.Error("IsNonIncreasing should return false")
70 }
71
72 // Check error report
73 for _, currCase := range []struct {
74 collection interface{}
75 msg string
76 }{
77 {collection: []string{"a", "b"}, msg: `"a" is not greater than or equal to "b"`},
78 {collection: []int{1, 2}, msg: `"1" is not greater than or equal to "2"`},
79 {collection: []int{1, 2, 7, 6, 5, 4, 3}, msg: `"1" is not greater than or equal to "2"`},
80 {collection: []int{5, 4, 3, 1, 2}, msg: `"1" is not greater than or equal to "2"`},
81 {collection: []int8{1, 2}, msg: `"1" is not greater than or equal to "2"`},
82 {collection: []int16{1, 2}, msg: `"1" is not greater than or equal to "2"`},
83 {collection: []int32{1, 2}, msg: `"1" is not greater than or equal to "2"`},
84 {collection: []int64{1, 2}, msg: `"1" is not greater than or equal to "2"`},
85 {collection: []uint8{1, 2}, msg: `"1" is not greater than or equal to "2"`},
86 {collection: []uint16{1, 2}, msg: `"1" is not greater than or equal to "2"`},
87 {collection: []uint32{1, 2}, msg: `"1" is not greater than or equal to "2"`},
88 {collection: []uint64{1, 2}, msg: `"1" is not greater than or equal to "2"`},
89 {collection: []float32{1.23, 2.34}, msg: `"1.23" is not greater than or equal to "2.34"`},
90 {collection: []float64{1.23, 2.34}, msg: `"1.23" is not greater than or equal to "2.34"`},
91 } {
92 out := &outputT{buf: bytes.NewBuffer(nil)}
93 False(t, IsNonIncreasing(out, currCase.collection))
94 Contains(t, out.buf.String(), currCase.msg)
95 }
96}
97
98func TestIsDecreasing(t *testing.T) {
99 mockT := new(testing.T)

Callers

nothing calls this directly

Calls 5

IsNonIncreasingFunction · 0.70
FalseFunction · 0.70
ContainsFunction · 0.70
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…