1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | #ifndef FLUTTER_TESTING_ASSERTIONS_H_ |
6 | #define FLUTTER_TESTING_ASSERTIONS_H_ |
7 | |
8 | #include <type_traits> |
9 | |
10 | namespace flutter { |
11 | namespace testing { |
12 | |
13 | inline bool NumberNear(double a, double b) { |
14 | static const double epsilon = 1e-3; |
15 | return (a > (b - epsilon)) && (a < (b + epsilon)); |
16 | } |
17 | |
18 | } // namespace testing |
19 | } // namespace flutter |
20 | |
21 | #endif // FLUTTER_TESTING_ASSERTIONS_H_ |
22 | |