test(testutil): Fix value comparison (#15886)

This commit is contained in:
Lars Stegman 2024-09-16 18:26:18 +02:00 committed by GitHub
parent 9a8b5022e0
commit 65999bdab6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -61,7 +61,7 @@ func lessFunc(lhs, rhs *metricDiff) bool {
if lhs.Fields[i].Value != rhs.Fields[i].Value {
ltype := reflect.TypeOf(lhs.Fields[i].Value)
rtype := reflect.TypeOf(lhs.Fields[i].Value)
rtype := reflect.TypeOf(rhs.Fields[i].Value)
if ltype.Kind() != rtype.Kind() {
return ltype.Kind() < rtype.Kind()
@ -69,13 +69,13 @@ func lessFunc(lhs, rhs *metricDiff) bool {
switch v := lhs.Fields[i].Value.(type) {
case int64:
return v < lhs.Fields[i].Value.(int64)
return v < rhs.Fields[i].Value.(int64)
case uint64:
return v < lhs.Fields[i].Value.(uint64)
return v < rhs.Fields[i].Value.(uint64)
case float64:
return v < lhs.Fields[i].Value.(float64)
return v < rhs.Fields[i].Value.(float64)
case string:
return v < lhs.Fields[i].Value.(string)
return v < rhs.Fields[i].Value.(string)
case bool:
return !v
default: