Skip to content

Commit

Permalink
Relaxing float comparison on fuzz testing (#6342)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanprot authored Nov 16, 2024
1 parent 7c973ee commit 0eab788
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion integration/query_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,8 @@ var comparer = cmp.Comparer(func(x, y model.Value) bool {
}
compareFloats := func(l, r float64) bool {
const epsilon = 1e-6
return cmp.Equal(l, r, cmpopts.EquateNaNs(), cmpopts.EquateApprox(0, epsilon))
const fraction = 1.e-10 // 0.00000001%
return cmp.Equal(l, r, cmpopts.EquateNaNs(), cmpopts.EquateApprox(fraction, epsilon))
}
compareMetrics := func(l, r model.Metric) bool {
return l.Equal(r)
Expand Down

0 comments on commit 0eab788

Please sign in to comment.