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

Function test_graph_get_child

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

Source from the content-addressed store, hash-verified

662
663 #[test]
664 fn test_graph_get_child() {
665 let mut graph = AliveGraph::new();
666 graph.push_vertex(AliveVertex::DUMMY);
667
668 let v = GraphNode::ROOT;
669 graph.push_vertex(AliveVertex::new(v));
670 graph.set_last_children_start();
671
672 graph.push_child_to_last(None, VertexId::new(10));
673 graph.push_child_to_last(None, VertexId::new(11));
674
675 let child0 = graph.get_child(VertexId::new(1), 0);
676 assert!(child0.is_some());
677 assert_eq!(child0.unwrap().1, VertexId::new(10));
678
679 let child1 = graph.get_child(VertexId::new(1), 1);
680 assert_eq!(child1.unwrap().1, VertexId::new(11));
681
682 let child2 = graph.get_child(VertexId::new(1), 2);
683 assert!(child2.is_none());
684 }
685
686 #[test]
687 fn test_graph_add_extra_child() {

Callers

nothing calls this directly

Calls 4

push_vertexMethod · 0.80
push_child_to_lastMethod · 0.80
get_childMethod · 0.80

Tested by

no test coverage detected