Repository: fujiapple852/trippy (language: rust)

Issue:
Fix unit tests on i386
Fix tests which fail on i386

https://buildd.debian.org/status/fetch.php?pkg=trippy&arch=i386&ver=0.11.0%2Bdfsg-1&stamp=1727294503&raw=0

```
state::tests::test_scenario::file_ipv4_3probes_3hops_completed_yaml_expects stdout ----
thread 'state::tests::test_scenario::file_ipv4_3probes_3hops_completed_yaml_expects' panicked at crates/trippy-core/src/state.rs:862:47:
assertion `left == right` failed
  left: 781.6666666666666
 right: 781.6666666666665

---- state::tests::test_scenario::file_ipv4_nat_yaml_expects stdout ----
thread 'state::tests::test_scenario::file_ipv4_nat_yaml_expects' panicked at crates/trippy-core/src/state.rs:862:47:
assertion `left == right` failed
  left: 781.6666666666666
 right: 781.6666666666665


failures:
    state::tests::test_scenario::file_ipv4_3probes_3hops_completed_yaml_expects
    state::tests::test_scenario::file_ipv4_nat_yaml_expects
```


Discussion / hints:
I will look for it, I think there is an approximately equal assert you can use instead.
I don't recall where I saw it. I thought it was std but can't find it. I guess I was mistaken. There are lots of options for float equality but I thought there was one in std, which I can't find. It's easy to find options but let me know if you want me to point out a few.

Fix patch:
diff --git a/crates/trippy-core/src/state.rs b/crates/trippy-core/src/state.rs
index 5ce6fc6d8..9e8bf0aae 100644
--- a/crates/trippy-core/src/state.rs
+++ b/crates/trippy-core/src/state.rs
@@ -856,10 +856,12 @@ mod tests {
         }
     }
 
-    #[allow(clippy::float_cmp)]
     fn assert_eq_optional(actual: Option<f64>, expected: Option<f64>) {
         match (actual, expected) {
-            (Some(actual), Some(expected)) => assert_eq!(actual, expected),
+            (Some(actual), Some(expected)) if (expected - actual).abs() < f64::EPSILON => {}
+            (Some(actual), Some(expected)) => {
+                panic!("expected {expected:?} did not match actual {actual:?}")
+            }
             (Some(_), None) => panic!("actual {actual:?} but not expected"),
             (None, Some(_)) => panic!("expected {expected:?} but no actual"),
             (None, None) => {}


Test patch: