graph_api_test/index/
vertex_label.rs

1use crate::{Edge, Vertex, assert_elements_eq, populate_graph};
2use graph_api_lib::{Graph, SupportsVertexLabelIndex};
3
4pub fn test_index<T>(graph: &mut T)
5where
6    T: Graph<Vertex = Vertex, Edge = Edge> + SupportsVertexLabelIndex,
7{
8    let refs = populate_graph(graph);
9    let collected = graph.walk().vertices(Vertex::person()).collect::<Vec<_>>();
10    assert_elements_eq!(graph, collected, vec![refs.bryn, refs.julia]);
11}
12
13pub fn test_index_limit<T>(graph: &mut T)
14where
15    T: Graph<Vertex = Vertex, Edge = Edge> + SupportsVertexLabelIndex,
16{
17    let refs = populate_graph(graph);
18    let collected = graph
19        .walk()
20        .vertices(Vertex::person().with_limit(1))
21        .collect::<Vec<_>>();
22    assert_elements_eq!(graph, collected, vec![refs.bryn]);
23}