It is more commonly used as CmpLax function than as an operator. It
could be used when, for example, an operator is constructed once
but applied to different, but compatible types as in:
bw:=td.Between(20,30)intValue:=21floatValue:=21.89td.Cmp(t,intValue,bw)// no need to be lax here: same int typestd.Cmp(t,floatValue,td.Lax(bw))// be lax please, as float64 ≠ int
Note that in the latter case, CmpLax could be used as well:
td.CmpLax(t,floatValue,bw)
TypeBehind method returns the greatest convertible or more common
reflect.Type of expectedValue if it is a base type (bool, int*,
uint*, float*, complex*, string), the reflect.Type of
expectedValue otherwise, except if expectedValue is a TestDeep
operator. In this case, it delegates TypeBehind() to the operator.
args… are optional and allow to name the test. This name is
used in case of failure to qualify the test. If len(args) > 1 and
the first item of args is a string and contains a ‘%’ rune then
fmt.Fprintf is used to compose the name, else args are passed to
fmt.Fprint. Do not forget it is the name of the test, not the
reason of a potential failure.
Returns true if the test is OK, false if it fails.
args… are optional and allow to name the test. This name is
used in case of failure to qualify the test. If len(args) > 1 and
the first item of args is a string and contains a ‘%’ rune then
fmt.Fprintf is used to compose the name, else args are passed to
fmt.Fprint. Do not forget it is the name of the test, not the
reason of a potential failure.