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

Function test_graph_children_iterator

atomic-core/src/output/alive/graph.rs:637–661  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

635
636 #[test]
637 fn test_graph_children_iterator() {
638 let mut graph = AliveGraph::new();
639 graph.push_vertex(AliveVertex::DUMMY);
640
641 let v = GraphNode::new(
642 NodeId::new(1),
643 ChangePosition::new(0),
644 ChangePosition::new(10),
645 );
646 graph.push_vertex(AliveVertex::new(v));
647 graph.set_last_children_start();
648
649 let edge = SerializedGraphEdge::new(
650 EdgeFlags::BLOCK,
651 Position::new(NodeId::new(2), ChangePosition::new(0)),
652 NodeId::new(1),
653 );
654 graph.push_child_to_last(Some(edge), VertexId::new(2));
655 graph.push_child_to_last(None, VertexId::DUMMY);
656
657 let children: Vec<_> = graph.children(VertexId::new(1)).collect();
658 assert_eq!(children.len(), 2);
659 assert!(children[0].0.is_some());
660 assert!(children[1].0.is_none());
661 }
662
663 #[test]
664 fn test_graph_get_child() {

Callers

nothing calls this directly

Calls 5

push_vertexMethod · 0.80
push_child_to_lastMethod · 0.80
childrenMethod · 0.80
collectMethod · 0.45

Tested by

no test coverage detected