| 186 | } |
| 187 | |
| 188 | func timeEpsilonCorrect(f func(time.Time) float64, pair model.SamplePair, testTimeEpsilon time.Duration) bool { |
| 189 | minExpected := f(pair.Timestamp.Time().Add(-testTimeEpsilon)) |
| 190 | maxExpected := f(pair.Timestamp.Time().Add(testTimeEpsilon)) |
| 191 | if minExpected > maxExpected { |
| 192 | minExpected, maxExpected = maxExpected, minExpected |
| 193 | } |
| 194 | return minExpected < float64(pair.Value) && float64(pair.Value) < maxExpected |
| 195 | } |
| 196 | |
| 197 | func valueEpsilonCorrect(f func(time.Time) float64, pair model.SamplePair, testEpsilon float64) bool { |
| 198 | return epsilonCorrect(float64(pair.Value), f(pair.Timestamp.Time()), testEpsilon) |