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:641–661  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

639
640 #[test]
641 fn test_graph_get_child() {
642 let mut graph = AliveGraph::new();
643 graph.push_vertex(AliveVertex::DUMMY);
644
645 let v = GraphNode::ROOT;
646 graph.push_vertex(AliveVertex::new(v));
647 graph.set_last_children_start();
648
649 graph.push_child_to_last(None, VertexId::new(10));
650 graph.push_child_to_last(None, VertexId::new(11));
651
652 let child0 = graph.get_child(VertexId::new(1), 0);
653 assert!(child0.is_some());
654 assert_eq!(child0.unwrap().1, VertexId::new(10));
655
656 let child1 = graph.get_child(VertexId::new(1), 1);
657 assert_eq!(child1.unwrap().1, VertexId::new(11));
658
659 let child2 = graph.get_child(VertexId::new(1), 2);
660 assert!(child2.is_none());
661 }
662
663 #[test]
664 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