MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / bypass_fixture

Function bypass_fixture

atomic-core/src/output/alive/retrieve/tests.rs:970–1011  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

968// deferring the bypass to that direct child creates a cycle that is absent
969// from the canonical graph.
970fn 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]
1014fn bypass_does_not_reverse_canonical_order() {

Calls 9

test_posFunction · 0.85
inode_nodeMethod · 0.80
resolve_blockMethod · 0.80
resolve_block_endMethod · 0.80
test_nodeFunction · 0.70
start_posMethod · 0.45
end_posMethod · 0.45
add_edgeMethod · 0.45
reverseMethod · 0.45

Tested by

no test coverage detected