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

Function TestObjectsAreEqualValues

internal/testify/assert/assertions_test.go:140–174  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

138}
139
140func TestObjectsAreEqualValues(t *testing.T) {
141 now := time.Now()
142
143 cases := []struct {
144 expected interface{}
145 actual interface{}
146 result bool
147 }{
148 {uint32(10), int32(10), true},
149 {0, nil, false},
150 {nil, 0, false},
151 {now, now.In(time.Local), false}, // should not be time zone independent
152 {int(270), int8(14), false}, // should handle overflow/underflow
153 {int8(14), int(270), false},
154 {[]int{270, 270}, []int8{14, 14}, false},
155 {complex128(1e+100 + 1e+100i), complex64(complex(math.Inf(0), math.Inf(0))), false},
156 {complex64(complex(math.Inf(0), math.Inf(0))), complex128(1e+100 + 1e+100i), false},
157 {complex128(1e+100 + 1e+100i), 270, false},
158 {270, complex128(1e+100 + 1e+100i), false},
159 {complex128(1e+100 + 1e+100i), 3.14, false},
160 {3.14, complex128(1e+100 + 1e+100i), false},
161 {complex128(1e+10 + 1e+10i), complex64(1e+10 + 1e+10i), true},
162 {complex64(1e+10 + 1e+10i), complex128(1e+10 + 1e+10i), true},
163 }
164
165 for _, c := range cases {
166 t.Run(fmt.Sprintf("ObjectsAreEqualValues(%#v, %#v)", c.expected, c.actual), func(t *testing.T) {
167 res := ObjectsAreEqualValues(c.expected, c.actual)
168
169 if res != c.result {
170 t.Errorf("ObjectsAreEqualValues(%#v, %#v) should return %#v", c.expected, c.actual, c.result)
171 }
172 })
173 }
174}
175
176type Nested struct {
177 Exported interface{}

Callers

nothing calls this directly

Calls 5

ObjectsAreEqualValuesFunction · 0.85
InMethod · 0.80
RunMethod · 0.80
SprintfMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…