Within Delta Checker for floats
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gocheck |
New
|
Undecided
|
Unassigned |
Bug Description
How about including a Within checker, something like what follows?
Here's an example of it in use: https:/
type withinChecker struct {
*CheckerInfo
}
var Within Checker = &withinChecker{
&CheckerInfo{
}
func (c *withinChecker) Check(params []interface{}, names []string) (result bool, error string) {
obtained, ok := params[0].(float64)
if !ok {
return false, "obtained must be a float64"
}
delta, ok := params[1].(float64)
if !ok {
return false, "delta must be a float64"
}
expected, ok := params[2].(float64)
if !ok {
return false, "expected must be a float64"
}
return math.Abs(
}