summaryrefslogtreecommitdiffstats
path: root/htesting/hqt/checkers.go
diff options
context:
space:
mode:
Diffstat (limited to 'htesting/hqt/checkers.go')
-rw-r--r--htesting/hqt/checkers.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/htesting/hqt/checkers.go b/htesting/hqt/checkers.go
index 7655d6a63..bf2cb9428 100644
--- a/htesting/hqt/checkers.go
+++ b/htesting/hqt/checkers.go
@@ -16,6 +16,7 @@ package hqt
import (
"errors"
"fmt"
+ "math"
"reflect"
"strings"
@@ -38,6 +39,11 @@ var IsSameType qt.Checker = &typeChecker{
argNames: []string{"got", "want"},
}
+// IsSameFloat64 asserts that two float64 values are equal within a small delta.
+var IsSameFloat64 = qt.CmpEquals(cmp.Comparer(func(a, b float64) bool {
+ return math.Abs(a-b) < 0.0001
+}))
+
type argNames []string
func (a argNames) ArgNames() []string {