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

Function TestIsIncreasing

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

Source from the content-addressed store, hash-verified

6)
7
8func TestIsIncreasing(t *testing.T) {
9 mockT := new(testing.T)
10
11 if !IsIncreasing(mockT, []int{1, 2}) {
12 t.Error("IsIncreasing should return true")
13 }
14
15 if !IsIncreasing(mockT, []int{1, 2, 3, 4, 5}) {
16 t.Error("IsIncreasing should return true")
17 }
18
19 if IsIncreasing(mockT, []int{1, 1}) {
20 t.Error("IsIncreasing should return false")
21 }
22
23 if IsIncreasing(mockT, []int{2, 1}) {
24 t.Error("IsIncreasing should return false")
25 }
26
27 // Check error report
28 for _, currCase := range []struct {
29 collection interface{}
30 msg string
31 }{
32 {collection: []string{"b", "a"}, msg: `"b" is not less than "a"`},
33 {collection: []int{2, 1}, msg: `"2" is not less than "1"`},
34 {collection: []int{2, 1, 3, 4, 5, 6, 7}, msg: `"2" is not less than "1"`},
35 {collection: []int{-1, 0, 2, 1}, msg: `"2" is not less than "1"`},
36 {collection: []int8{2, 1}, msg: `"2" is not less than "1"`},
37 {collection: []int16{2, 1}, msg: `"2" is not less than "1"`},
38 {collection: []int32{2, 1}, msg: `"2" is not less than "1"`},
39 {collection: []int64{2, 1}, msg: `"2" is not less than "1"`},
40 {collection: []uint8{2, 1}, msg: `"2" is not less than "1"`},
41 {collection: []uint16{2, 1}, msg: `"2" is not less than "1"`},
42 {collection: []uint32{2, 1}, msg: `"2" is not less than "1"`},
43 {collection: []uint64{2, 1}, msg: `"2" is not less than "1"`},
44 {collection: []float32{2.34, 1.23}, msg: `"2.34" is not less than "1.23"`},
45 {collection: []float64{2.34, 1.23}, msg: `"2.34" is not less than "1.23"`},
46 } {
47 out := &outputT{buf: bytes.NewBuffer(nil)}
48 False(t, IsIncreasing(out, currCase.collection))
49 Contains(t, out.buf.String(), currCase.msg)
50 }
51}
52
53func TestIsNonIncreasing(t *testing.T) {
54 mockT := new(testing.T)

Callers

nothing calls this directly

Calls 5

IsIncreasingFunction · 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…