Skip to content

Commit

Permalink
test(testutil): Fix value comparison (#15886)
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsStegman authored Sep 16, 2024
1 parent 9a8b502 commit 65999bd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions testutil/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ 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()
}

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:
Expand Down

0 comments on commit 65999bd

Please sign in to comment.