mirror of https://github.com/stretchr/testify.git
time.Duraions are numbers too
parent
b1f989447a
commit
2f1cd6b778
|
@ -886,6 +886,8 @@ func toFloat(x interface{}) (float64, bool) {
|
|||
xf = float64(xn)
|
||||
case float64:
|
||||
xf = float64(xn)
|
||||
case time.Duration:
|
||||
xf = float64(xn)
|
||||
default:
|
||||
xok = false
|
||||
}
|
||||
|
|
|
@ -1045,6 +1045,7 @@ func TestInEpsilon(t *testing.T) {
|
|||
{uint64(100), uint8(101), 0.01},
|
||||
{0.1, -0.1, 2},
|
||||
{0.1, 0, 2},
|
||||
{time.Second, time.Second + time.Millisecond, 0.002},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
|
@ -1063,6 +1064,7 @@ func TestInEpsilon(t *testing.T) {
|
|||
{2.1, "bla-bla", 0},
|
||||
{0.1, -0.1, 1.99},
|
||||
{0, 0.1, 2}, // expected must be different to zero
|
||||
{time.Second, time.Second + 10*time.Millisecond, 0.002},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
|
|
Loading…
Reference in New Issue