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

Function TestGreater

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

Source from the content-addressed store, hash-verified

127}
128
129func TestGreater(t *testing.T) {
130 mockT := new(testing.T)
131
132 if !Greater(mockT, 2, 1) {
133 t.Error("Greater should return true")
134 }
135
136 if Greater(mockT, 1, 1) {
137 t.Error("Greater should return false")
138 }
139
140 if Greater(mockT, 1, 2) {
141 t.Error("Greater should return false")
142 }
143
144 // Check error report
145 for _, currCase := range []struct {
146 less interface{}
147 greater interface{}
148 msg string
149 }{
150 {less: "a", greater: "b", msg: `"a" is not greater than "b"`},
151 {less: int(1), greater: int(2), msg: `"1" is not greater than "2"`},
152 {less: int8(1), greater: int8(2), msg: `"1" is not greater than "2"`},
153 {less: int16(1), greater: int16(2), msg: `"1" is not greater than "2"`},
154 {less: int32(1), greater: int32(2), msg: `"1" is not greater than "2"`},
155 {less: int64(1), greater: int64(2), msg: `"1" is not greater than "2"`},
156 {less: uint8(1), greater: uint8(2), msg: `"1" is not greater than "2"`},
157 {less: uint16(1), greater: uint16(2), msg: `"1" is not greater than "2"`},
158 {less: uint32(1), greater: uint32(2), msg: `"1" is not greater than "2"`},
159 {less: uint64(1), greater: uint64(2), msg: `"1" is not greater than "2"`},
160 {less: float32(1.23), greater: float32(2.34), msg: `"1.23" is not greater than "2.34"`},
161 {less: float64(1.23), greater: float64(2.34), msg: `"1.23" is not greater than "2.34"`},
162 {less: uintptr(1), greater: uintptr(2), msg: `"1" is not greater than "2"`},
163 {less: time.Time{}, greater: time.Time{}.Add(time.Hour), msg: `"0001-01-01 00:00:00 +0000 UTC" is not greater than "0001-01-01 01:00:00 +0000 UTC"`},
164 {less: []byte{1, 1}, greater: []byte{1, 2}, msg: `"[1 1]" is not greater than "[1 2]"`},
165 } {
166 out := &outputT{buf: bytes.NewBuffer(nil)}
167 False(t, Greater(out, currCase.less, currCase.greater))
168 Contains(t, out.buf.String(), currCase.msg)
169 Contains(t, out.helpers, "github.com/expr-lang/expr/internal/testify/assert.Greater")
170 }
171}
172
173func TestGreaterOrEqual(t *testing.T) {
174 mockT := new(testing.T)

Callers

nothing calls this directly

Calls 6

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