graph_api_test/steps/
collect.rs

1use crate::{Edge, Vertex, assert_elements_eq, populate_graph};
2use graph_api_lib::{EdgeSearch, Graph};
3
4pub fn test_edges_collect<T>(graph: &mut T)
5where
6    T: Graph<Vertex = Vertex, Edge = Edge>,
7{
8    let refs = populate_graph(graph);
9    let collected = graph
10        .walk()
11        .vertices_by_id(vec![refs.bryn])
12        .edges(EdgeSearch::scan().outgoing())
13        .collect::<Vec<_>>();
14    assert_elements_eq!(
15        graph,
16        collected,
17        vec![refs.bryn_knows_julia, refs.bryn_created_graph_api]
18    );
19}
20
21pub fn test_vertices_collect<T>(graph: &mut T)
22where
23    T: Graph<Vertex = Vertex, Edge = Edge>,
24{
25    let refs = populate_graph(graph);
26    let collected = graph
27        .walk()
28        .vertices_by_id(vec![refs.bryn, refs.julia])
29        .collect::<Vec<_>>();
30    assert_elements_eq!(graph, collected, vec![refs.bryn, refs.julia]);
31}