graph_api_test/index/
vertex_label.rs

1#[cfg(feature = "vertex-label-index")]
2use crate::{assert_elements_eq, populate_graph};
3
4use crate::{Edge, Vertex};
5use graph_api_lib::Graph;
6
7#[cfg(feature = "vertex-label-index")]
8pub fn test_index<T>(graph: &mut T)
9where
10    T: Graph<Vertex = Vertex, Edge = Edge> + graph_api_lib::SupportsVertexLabelIndex,
11{
12    let refs = populate_graph(graph);
13    let collected = graph.walk().vertices(Vertex::person()).collect::<Vec<_>>();
14    assert_elements_eq!(graph, collected, vec![refs.bryn, refs.julia]);
15}
16
17#[cfg(not(feature = "vertex-label-index"))]
18pub fn test_index<T>(_graph: &mut T)
19where
20    T: Graph<Vertex = Vertex, Edge = Edge>,
21{
22}
23
24#[cfg(feature = "vertex-label-index")]
25pub fn test_index_limit<T>(graph: &mut T)
26where
27    T: Graph<Vertex = Vertex, Edge = Edge> + graph_api_lib::SupportsVertexLabelIndex,
28{
29    let refs = populate_graph(graph);
30    let collected = graph
31        .walk()
32        .vertices(Vertex::person().with_limit(1))
33        .collect::<Vec<_>>();
34    assert_elements_eq!(graph, collected, vec![refs.bryn]);
35}
36
37#[cfg(not(feature = "vertex-label-index"))]
38pub fn test_index_limit<T>(_graph: &mut T)
39where
40    T: Graph<Vertex = Vertex, Edge = Edge>,
41{
42}