• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

djeedai / bevy_tweening / 9845148979

08 Jul 2024 06:40PM UTC coverage: 92.536% (-0.2%) from 92.723%
9845148979

Pull #130

github

web-flow
Merge 34890b311 into 235767288
Pull Request #130: Upgrade to Bevy 0.14

30 of 31 new or added lines in 2 files covered. (96.77%)

16 existing lines in 3 files now uncovered.

1587 of 1715 relevant lines covered (92.54%)

1.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.43
/src/test_utils.rs
1
/// Utility to compare floating-point values with a tolerance.
2
pub(crate) fn abs_diff_eq(a: f32, b: f32, tol: f32) -> bool {
1✔
3
    (a - b).abs() < tol
1✔
4
}
5

6
/// Assert that two floating-point quantities are approximately equal.
7
///
8
/// This macro asserts that the absolute difference between the two first
9
/// arguments is strictly less than a tolerance factor, which can be explicitly
10
/// passed as third argument or implicitly defaults to `1e-5`.
11
///
12
/// # Usage
13
///
14
/// ```
15
/// let x = 3.500009;
16
/// assert_approx_eq!(x, 3.5);       // default tolerance 1e-5
17
///
18
/// let x = 3.509;
19
/// assert_approx_eq!(x, 3.5, 0.01); // explicit tolerance
20
/// ```
21
macro_rules! assert_approx_eq {
22
    ($left:expr, $right:expr $(,)?) => {
23
        match (&$left, &$right) {
58✔
24
            (left_val, right_val) => {
58✔
UNCOV
25
                assert!(
×
26
                    abs_diff_eq(*left_val, *right_val, 1e-5),
58✔
27
                    "assertion failed: expected={} actual={} delta={} tol=1e-5(default)",
28
                    left_val,
29
                    right_val,
UNCOV
30
                    (left_val - right_val).abs(),
×
31
                );
32
            }
33
        }
34
    };
35
    ($left:expr, $right:expr, $tol:expr $(,)?) => {
36
        match (&$left, &$right, &$tol) {
37
            (left_val, right_val, tol_val) => {
38
                assert!(
39
                    abs_diff_eq(*left_val, *right_val, *tol_val),
40
                    "assertion failed: expected={} actual={} delta={} tol={}",
41
                    left_val,
42
                    right_val,
43
                    (left_val - right_val).abs(),
44
                    tol_val
45
                );
46
            }
47
        }
48
    };
49
}
50

51
pub(crate) use assert_approx_eq;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc