A deleted intermediate node must be contracted at its actual predecessor. In Hyperfine commit 65 the direct child is downstream of the bypass child; deferring the bypass to that direct child creates a cycle that is absent from the canonical graph.
(
ordered: bool,
reverse_edges: bool,
)
| 968 | // deferring the bypass to that direct child creates a cycle that is absent |
| 969 | // from the canonical graph. |
| 970 | fn bypass_fixture( |
| 971 | ordered: bool, |
| 972 | reverse_edges: bool, |
| 973 | ) -> ( |
| 974 | FaultGraphTxn, |
| 975 | Position<NodeId>, |
| 976 | GraphNode<NodeId>, |
| 977 | GraphNode<NodeId>, |
| 978 | ) { |
| 979 | let mut txn = FaultGraphTxn::default(); |
| 980 | let start = test_pos(1, 0); |
| 981 | let root = start.inode_node(); |
| 982 | let dead = test_node(2, 0, 10); |
| 983 | let bypass = test_node(3, 0, 10); |
| 984 | let direct = test_node(4, 0, 10); |
| 985 | for node in [root, dead, bypass, direct] { |
| 986 | txn.resolve_block(node.start_pos(), node); |
| 987 | txn.resolve_block_end(node.end_pos(), node); |
| 988 | } |
| 989 | for (from, to, flags) in [ |
| 990 | (root, dead, EdgeFlags::BLOCK | EdgeFlags::DELETED), |
| 991 | (root, direct, EdgeFlags::BLOCK), |
| 992 | (dead, bypass, EdgeFlags::BLOCK), |
| 993 | ] { |
| 994 | txn.add_edge(from, flags, to.start_pos()); |
| 995 | txn.add_edge(to, flags | EdgeFlags::PARENT, from.end_pos()); |
| 996 | } |
| 997 | if ordered { |
| 998 | txn.add_edge(bypass, EdgeFlags::BLOCK, direct.start_pos()); |
| 999 | txn.add_edge( |
| 1000 | direct, |
| 1001 | EdgeFlags::PARENT | EdgeFlags::BLOCK, |
| 1002 | bypass.end_pos(), |
| 1003 | ); |
| 1004 | } |
| 1005 | if reverse_edges { |
| 1006 | for edges in txn.edges.values_mut() { |
| 1007 | edges.reverse(); |
| 1008 | } |
| 1009 | } |
| 1010 | (txn, start, bypass, direct) |
| 1011 | } |
| 1012 | |
| 1013 | #[test] |
| 1014 | fn bypass_does_not_reverse_canonical_order() { |
no test coverage detected