From 7e9d8b5889c2aa97ff0e29e1ff232d973d0bef75 Mon Sep 17 00:00:00 2001 From: Ivan Carvalho Date: Sun, 14 May 2023 17:31:14 -0400 Subject: [PATCH] Fix incorrect test case --- rustworkx-core/src/centrality.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rustworkx-core/src/centrality.rs b/rustworkx-core/src/centrality.rs index d454741a9..2866a6d0e 100644 --- a/rustworkx-core/src/centrality.rs +++ b/rustworkx-core/src/centrality.rs @@ -681,7 +681,7 @@ mod test_eigenvector_centrality { macro_rules! assert_almost_equal { ($x:expr, $y:expr, $d:expr) => { - if !($x - $y < $d || $y - $x < $d) { + if ($x - $y).abs() >= $d { panic!("{} != {} within delta of {}", $x, $y, $d); } }; @@ -753,8 +753,7 @@ mod test_eigenvector_centrality { let output: Result>> = eigenvector_centrality(&g, |_| Ok(2.), None, None); let result = output.unwrap().unwrap(); let expected_values: Vec = vec![ - 0.25368793, 0.19576478, 0.32817092, 0.40430835, 0.48199885, 0.15724483, 0.51346196, - 0.32475403, + 0.2140437, 0.2009269, 0.1036383, 0.0972886, 0.3113323, 0.4891686, 0.4420605, 0.6016448, ]; for i in 0..8 { assert_almost_equal!(expected_values[i], result[i], 1e-4);