Change all graph tests to pub to avoid unused-warnings
This commit is contained in:
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
//! Test fixture and test macros for graph topology and algorithm implementations.
|
//! Test fixture and test macros for graph topology and algorithm implementations.
|
||||||
|
|
||||||
pub mod fixtures;
|
pub mod fixtures;
|
||||||
pub(crate) mod graph_topology_addition_deletion_testing;
|
pub mod graph_topology_addition_deletion_testing;
|
||||||
pub(crate) mod graph_topology_addition_testing;
|
pub mod graph_topology_addition_testing;
|
||||||
pub(crate) mod graph_topology_deletion_testing;
|
pub mod graph_topology_deletion_testing;
|
||||||
pub(crate) mod graph_topology_testing;
|
pub mod graph_topology_testing;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ macro_rules! graph_topology_addition_deletion_tests {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delete_vertex_add_vertex<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
pub fn delete_vertex_add_vertex<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -46,7 +46,7 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delete_edge_add_edge<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
pub fn delete_edge_add_edge<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
{
|
{
|
||||||
@@ -60,3 +60,4 @@ where
|
|||||||
);
|
);
|
||||||
assert_eq!(graph.edge_count(), 1, "unexpected edge count after re-add");
|
assert_eq!(graph.edge_count(), 1, "unexpected edge count after re-add");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ macro_rules! graph_topology_addition_tests {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn reserve_vertices_increases_capacity<G: GraphTopologyAddition>() {
|
pub fn reserve_vertices_increases_capacity<G: GraphTopologyAddition>() {
|
||||||
let mut graph = G::default();
|
let mut graph = G::default();
|
||||||
let capacity_before = graph.vertex_capacity();
|
let capacity_before = graph.vertex_capacity();
|
||||||
graph.reserve_vertices(capacity_before + 10);
|
graph.reserve_vertices(capacity_before + 10);
|
||||||
@@ -40,7 +40,7 @@ pub(crate) fn reserve_vertices_increases_capacity<G: GraphTopologyAddition>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn reserve_vertices_prevents_reallocation_on_add<G: GraphTopologyAddition>() {
|
pub fn reserve_vertices_prevents_reallocation_on_add<G: GraphTopologyAddition>() {
|
||||||
let mut graph = G::default();
|
let mut graph = G::default();
|
||||||
graph.reserve_vertices(10);
|
graph.reserve_vertices(10);
|
||||||
let capacity_before = graph.vertex_capacity();
|
let capacity_before = graph.vertex_capacity();
|
||||||
@@ -54,7 +54,7 @@ pub(crate) fn reserve_vertices_prevents_reallocation_on_add<G: GraphTopologyAddi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn reserve_vertices_does_not_affect_edge_capacity<G: GraphTopologyAddition>() {
|
pub fn reserve_vertices_does_not_affect_edge_capacity<G: GraphTopologyAddition>() {
|
||||||
let mut graph = G::default();
|
let mut graph = G::default();
|
||||||
let capacity_before = graph.edge_capacity();
|
let capacity_before = graph.edge_capacity();
|
||||||
graph.reserve_vertices(10);
|
graph.reserve_vertices(10);
|
||||||
@@ -65,7 +65,7 @@ pub(crate) fn reserve_vertices_does_not_affect_edge_capacity<G: GraphTopologyAdd
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn reserve_edges_increases_capacity<G: GraphTopologyAddition>() {
|
pub fn reserve_edges_increases_capacity<G: GraphTopologyAddition>() {
|
||||||
let mut graph = G::default();
|
let mut graph = G::default();
|
||||||
let capacity_before = graph.edge_capacity();
|
let capacity_before = graph.edge_capacity();
|
||||||
graph.reserve_edges(capacity_before + 10);
|
graph.reserve_edges(capacity_before + 10);
|
||||||
@@ -75,7 +75,7 @@ pub(crate) fn reserve_edges_increases_capacity<G: GraphTopologyAddition>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn reserve_edges_prevents_reallocation_on_add<G: GraphTopologyAddition>() {
|
pub fn reserve_edges_prevents_reallocation_on_add<G: GraphTopologyAddition>() {
|
||||||
let mut graph = G::default();
|
let mut graph = G::default();
|
||||||
let v1 = graph.add_vertex();
|
let v1 = graph.add_vertex();
|
||||||
let v2 = graph.add_vertex();
|
let v2 = graph.add_vertex();
|
||||||
@@ -91,7 +91,7 @@ pub(crate) fn reserve_edges_prevents_reallocation_on_add<G: GraphTopologyAdditio
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn reserve_edges_does_not_affect_vertex_capacity<G: GraphTopologyAddition>() {
|
pub fn reserve_edges_does_not_affect_vertex_capacity<G: GraphTopologyAddition>() {
|
||||||
let mut graph = G::default();
|
let mut graph = G::default();
|
||||||
let capacity_before = graph.vertex_capacity();
|
let capacity_before = graph.vertex_capacity();
|
||||||
graph.reserve_edges(10);
|
graph.reserve_edges(10);
|
||||||
@@ -102,7 +102,7 @@ pub(crate) fn reserve_edges_does_not_affect_vertex_capacity<G: GraphTopologyAddi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn add_vertex<G: GraphTopologyAddition>()
|
pub fn add_vertex<G: GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ where
|
|||||||
assert_ne!(graph.add_vertex(), v, "unexpected duplicate vertex");
|
assert_ne!(graph.add_vertex(), v, "unexpected duplicate vertex");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn add_edge<G: GraphTopologyAddition>()
|
pub fn add_edge<G: GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
{
|
{
|
||||||
@@ -122,7 +122,7 @@ where
|
|||||||
assert_ne!(graph.add_edge(v1, v2), e, "unexpected duplicate edge");
|
assert_ne!(graph.add_edge(v1, v2), e, "unexpected duplicate edge");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn vertex_map_new_vertex<G: GraphTopologyAddition>() {
|
pub fn vertex_map_new_vertex<G: GraphTopologyAddition>() {
|
||||||
let mut graph = G::default();
|
let mut graph = G::default();
|
||||||
let mut map = graph.vertex_map(27);
|
let mut map = graph.vertex_map(27);
|
||||||
let v = graph.add_vertex();
|
let v = graph.add_vertex();
|
||||||
@@ -137,7 +137,7 @@ pub(crate) fn vertex_map_new_vertex<G: GraphTopologyAddition>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn edge_map_new_edge<G: GraphTopologyAddition>() {
|
pub fn edge_map_new_edge<G: GraphTopologyAddition>() {
|
||||||
let mut graph = G::default();
|
let mut graph = G::default();
|
||||||
let v1 = graph.add_vertex();
|
let v1 = graph.add_vertex();
|
||||||
let v2 = graph.add_vertex();
|
let v2 = graph.add_vertex();
|
||||||
@@ -150,3 +150,4 @@ pub(crate) fn edge_map_new_edge<G: GraphTopologyAddition>() {
|
|||||||
"unexpected value from map read after write for new edge"
|
"unexpected value from map read after write for new edge"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ macro_rules! graph_topology_deletion_tests {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delete_vertex<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
pub fn delete_vertex<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
||||||
let (mut graph, v) = G::single_vertex();
|
let (mut graph, v) = G::single_vertex();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
graph.vertex_count(),
|
graph.vertex_count(),
|
||||||
@@ -55,7 +55,7 @@ pub(crate) fn delete_vertex<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delete_vertex_loop<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
pub fn delete_vertex_loop<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
||||||
let (mut graph, v, _) = G::loop_edge();
|
let (mut graph, v, _) = G::loop_edge();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
graph.vertex_count(),
|
graph.vertex_count(),
|
||||||
@@ -77,7 +77,7 @@ pub(crate) fn delete_vertex_loop<G: GraphTopologyDeletion + GraphTopologyAdditio
|
|||||||
assert_eq!(graph.edge_count(), 0, "unexpected edge count after delete");
|
assert_eq!(graph.edge_count(), 0, "unexpected edge count after delete");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delete_vertex_invalid_index<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
pub fn delete_vertex_invalid_index<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
||||||
let (mut graph, v) = G::single_vertex();
|
let (mut graph, v) = G::single_vertex();
|
||||||
graph.delete_vertex(v);
|
graph.delete_vertex(v);
|
||||||
let result =
|
let result =
|
||||||
@@ -85,7 +85,7 @@ pub(crate) fn delete_vertex_invalid_index<G: GraphTopologyDeletion + GraphTopolo
|
|||||||
assert!(result.is_err(), "second deletion should panic");
|
assert!(result.is_err(), "second deletion should panic");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delete_vertex_connected<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
pub fn delete_vertex_connected<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -135,7 +135,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delete_edge<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
pub fn delete_edge<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
||||||
let (mut graph, vertices, e) = G::single_edge();
|
let (mut graph, vertices, e) = G::single_edge();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
graph.vertex_count(),
|
graph.vertex_count(),
|
||||||
@@ -180,7 +180,7 @@ pub(crate) fn delete_edge<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delete_edge_loop<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
pub fn delete_edge_loop<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
||||||
let (mut graph, v, e) = G::loop_edge();
|
let (mut graph, v, e) = G::loop_edge();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
graph.vertex_count(),
|
graph.vertex_count(),
|
||||||
@@ -207,7 +207,7 @@ pub(crate) fn delete_edge_loop<G: GraphTopologyDeletion + GraphTopologyAddition>
|
|||||||
assert_eq!(graph.degree(v), 0, "unexpected vertex degree after delete");
|
assert_eq!(graph.degree(v), 0, "unexpected vertex degree after delete");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delete_edge_multiple<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
pub fn delete_edge_multiple<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
||||||
const K: usize = 2;
|
const K: usize = 2;
|
||||||
let (mut graph, vertices, edges) = G::multiple_edges::<K>();
|
let (mut graph, vertices, edges) = G::multiple_edges::<K>();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -257,7 +257,7 @@ pub(crate) fn delete_edge_multiple<G: GraphTopologyDeletion + GraphTopologyAddit
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delete_edge_invalid_index<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
pub fn delete_edge_invalid_index<G: GraphTopologyDeletion + GraphTopologyAddition>() {
|
||||||
let (mut graph, _, e) = G::single_edge();
|
let (mut graph, _, e) = G::single_edge();
|
||||||
graph.delete_edge(e);
|
graph.delete_edge(e);
|
||||||
let result =
|
let result =
|
||||||
@@ -265,7 +265,7 @@ pub(crate) fn delete_edge_invalid_index<G: GraphTopologyDeletion + GraphTopology
|
|||||||
assert!(result.is_err(), "second deletion should panic");
|
assert!(result.is_err(), "second deletion should panic");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn vertices_after_delete<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
pub fn vertices_after_delete<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -297,7 +297,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_vertices_after_delete_edge<
|
pub fn incident_vertices_after_delete_edge<
|
||||||
G: GraphTopologyDeletion + GraphTopologyAddition,
|
G: GraphTopologyDeletion + GraphTopologyAddition,
|
||||||
>()
|
>()
|
||||||
where
|
where
|
||||||
@@ -316,7 +316,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn edges_after_delete<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
pub fn edges_after_delete<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
{
|
{
|
||||||
@@ -344,7 +344,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_edges_after_delete_edge<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
pub fn incident_edges_after_delete_edge<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -378,7 +378,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_edges_after_delete_vertex<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
pub fn incident_edges_after_delete_vertex<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -412,7 +412,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidences_after_delete_vertex<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
pub fn incidences_after_delete_vertex<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -429,7 +429,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidences_after_delete_edge<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
pub fn incidences_after_delete_edge<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -446,7 +446,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidence_cursor_after_delete_vertex<
|
pub fn incidence_cursor_after_delete_vertex<
|
||||||
G: GraphTopologyDeletion + GraphTopologyAddition,
|
G: GraphTopologyDeletion + GraphTopologyAddition,
|
||||||
>()
|
>()
|
||||||
where
|
where
|
||||||
@@ -465,7 +465,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidence_cursor_after_delete_edge<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
pub fn incidence_cursor_after_delete_edge<G: GraphTopologyDeletion + GraphTopologyAddition>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -540,3 +540,4 @@ fn assert_vertex_incidence_cursor<G: GraphTopology>(
|
|||||||
v
|
v
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,17 +62,17 @@ macro_rules! graph_topology_tests {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn vertex_count_empty<G: MakeTestGraph>() {
|
pub fn vertex_count_empty<G: MakeTestGraph>() {
|
||||||
let graph = G::empty();
|
let graph = G::empty();
|
||||||
assert_eq!(graph.vertex_count(), 0, "unexpected vertex count");
|
assert_eq!(graph.vertex_count(), 0, "unexpected vertex count");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn vertex_count<G: MakeTestGraph>() {
|
pub fn vertex_count<G: MakeTestGraph>() {
|
||||||
let (graph, _, _, _) = G::standard();
|
let (graph, _, _, _) = G::standard();
|
||||||
assert_eq!(graph.vertex_count(), 10, "unexpected vertex count");
|
assert_eq!(graph.vertex_count(), 10, "unexpected vertex count");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn vertex_map<G: MakeTestGraph>() {
|
pub fn vertex_map<G: MakeTestGraph>() {
|
||||||
let (graph, v) = G::single_vertex();
|
let (graph, v) = G::single_vertex();
|
||||||
let mut map = graph.vertex_map(27);
|
let mut map = graph.vertex_map(27);
|
||||||
assert_eq!(map[v], 27, "unexpected value from default map read");
|
assert_eq!(map[v], 27, "unexpected value from default map read");
|
||||||
@@ -80,17 +80,17 @@ pub(crate) fn vertex_map<G: MakeTestGraph>() {
|
|||||||
assert_eq!(map[v], 9, "unexpected value from map after write");
|
assert_eq!(map[v], 9, "unexpected value from map after write");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn edge_count_empty<G: MakeTestGraph>() {
|
pub fn edge_count_empty<G: MakeTestGraph>() {
|
||||||
let graph = G::empty();
|
let graph = G::empty();
|
||||||
assert_eq!(graph.edge_count(), 0, "unexpected edge count");
|
assert_eq!(graph.edge_count(), 0, "unexpected edge count");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn edge_count<G: MakeTestGraph>() {
|
pub fn edge_count<G: MakeTestGraph>() {
|
||||||
let (graph, _, _, _) = G::standard();
|
let (graph, _, _, _) = G::standard();
|
||||||
assert_eq!(graph.edge_count(), 18, "unexpected edge count");
|
assert_eq!(graph.edge_count(), 18, "unexpected edge count");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn edge_map<G: MakeTestGraph>() {
|
pub fn edge_map<G: MakeTestGraph>() {
|
||||||
let (graph, _, e) = G::single_edge();
|
let (graph, _, e) = G::single_edge();
|
||||||
let mut map = graph.edge_map(28);
|
let mut map = graph.edge_map(28);
|
||||||
assert_eq!(map[e], 28, "unexpected value from default map read");
|
assert_eq!(map[e], 28, "unexpected value from default map read");
|
||||||
@@ -98,12 +98,12 @@ pub(crate) fn edge_map<G: MakeTestGraph>() {
|
|||||||
assert_eq!(map[e], 8, "unexpected value from map after write");
|
assert_eq!(map[e], 8, "unexpected value from map after write");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn degree_zero<G: MakeTestGraph>() {
|
pub fn degree_zero<G: MakeTestGraph>() {
|
||||||
let (graph, v) = G::single_vertex();
|
let (graph, v) = G::single_vertex();
|
||||||
assert_eq!(graph.degree(v), 0, "unexpected non-zero degree");
|
assert_eq!(graph.degree(v), 0, "unexpected non-zero degree");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn degree<G: MakeTestGraph>()
|
pub fn degree<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn loop_edge<G: MakeTestGraph>() {
|
pub fn loop_edge<G: MakeTestGraph>() {
|
||||||
let (graph, v, _) = G::loop_edge();
|
let (graph, v, _) = G::loop_edge();
|
||||||
assert_eq!(graph.vertex_count(), 1, "unexpected vertex count");
|
assert_eq!(graph.vertex_count(), 1, "unexpected vertex count");
|
||||||
assert_eq!(graph.edge_count(), 1, "unexpected edge count");
|
assert_eq!(graph.edge_count(), 1, "unexpected edge count");
|
||||||
@@ -130,7 +130,7 @@ pub(crate) fn loop_edge<G: MakeTestGraph>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn multiple_edges<G: MakeTestGraph>()
|
pub fn multiple_edges<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -156,7 +156,7 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn are_adjacent_vertex_self<G: MakeTestGraph>() {
|
pub fn are_adjacent_vertex_self<G: MakeTestGraph>() {
|
||||||
let (graph, v) = G::single_vertex();
|
let (graph, v) = G::single_vertex();
|
||||||
assert!(
|
assert!(
|
||||||
!graph.are_adjacent(v, v),
|
!graph.are_adjacent(v, v),
|
||||||
@@ -164,7 +164,7 @@ pub(crate) fn are_adjacent_vertex_self<G: MakeTestGraph>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn are_adjacent_single_edge<G: MakeTestGraph>() {
|
pub fn are_adjacent_single_edge<G: MakeTestGraph>() {
|
||||||
let (graph, vertices, _) = G::single_edge();
|
let (graph, vertices, _) = G::single_edge();
|
||||||
assert!(
|
assert!(
|
||||||
graph.are_adjacent(vertices[0], vertices[1]),
|
graph.are_adjacent(vertices[0], vertices[1]),
|
||||||
@@ -176,7 +176,7 @@ pub(crate) fn are_adjacent_single_edge<G: MakeTestGraph>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn are_adjacent<G: MakeTestGraph>()
|
pub fn are_adjacent<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -221,7 +221,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn vertices_empty<G: MakeTestGraph>() {
|
pub fn vertices_empty<G: MakeTestGraph>() {
|
||||||
let graph = G::empty();
|
let graph = G::empty();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
graph.vertices().count(),
|
graph.vertices().count(),
|
||||||
@@ -230,7 +230,7 @@ pub(crate) fn vertices_empty<G: MakeTestGraph>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn vertices<G: MakeTestGraph>()
|
pub fn vertices<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -245,7 +245,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn adjacent_vertices_empty<G: MakeTestGraph>() {
|
pub fn adjacent_vertices_empty<G: MakeTestGraph>() {
|
||||||
let (graph, v) = G::single_vertex();
|
let (graph, v) = G::single_vertex();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
graph.adjacent_vertices(v).count(),
|
graph.adjacent_vertices(v).count(),
|
||||||
@@ -254,7 +254,7 @@ pub(crate) fn adjacent_vertices_empty<G: MakeTestGraph>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn adjacent_vertices<G: MakeTestGraph>()
|
pub fn adjacent_vertices<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -292,7 +292,7 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn adjacent_vertices_loop_edge<G: MakeTestGraph>()
|
pub fn adjacent_vertices_loop_edge<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -311,7 +311,7 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn adjacent_vertices_multiple_edges<G: MakeTestGraph>()
|
pub fn adjacent_vertices_multiple_edges<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
{
|
{
|
||||||
@@ -336,7 +336,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_vertices_single_edge<G: MakeTestGraph>()
|
pub fn incident_vertices_single_edge<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -349,7 +349,7 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_vertices_loop_edge<G: MakeTestGraph>()
|
pub fn incident_vertices_loop_edge<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -362,7 +362,7 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_vertices_multiple_edges<G: MakeTestGraph>()
|
pub fn incident_vertices_multiple_edges<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -383,7 +383,7 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_vertices<G: MakeTestGraph>()
|
pub fn incident_vertices<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -398,7 +398,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn edges_empty<G: MakeTestGraph>() {
|
pub fn edges_empty<G: MakeTestGraph>() {
|
||||||
let graph = G::empty();
|
let graph = G::empty();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
graph.edges().count(),
|
graph.edges().count(),
|
||||||
@@ -407,7 +407,7 @@ pub(crate) fn edges_empty<G: MakeTestGraph>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn edges<G: MakeTestGraph>()
|
pub fn edges<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
{
|
{
|
||||||
@@ -422,7 +422,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_edges_empty<G: MakeTestGraph>() {
|
pub fn incident_edges_empty<G: MakeTestGraph>() {
|
||||||
let (graph, v) = G::single_vertex();
|
let (graph, v) = G::single_vertex();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
graph.incident_edges(v).count(),
|
graph.incident_edges(v).count(),
|
||||||
@@ -431,7 +431,7 @@ pub(crate) fn incident_edges_empty<G: MakeTestGraph>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_edges<G: MakeTestGraph>()
|
pub fn incident_edges<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -461,7 +461,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_edges_loop_edge<G: MakeTestGraph>()
|
pub fn incident_edges_loop_edge<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
{
|
{
|
||||||
@@ -480,7 +480,7 @@ where
|
|||||||
assert_eq!(iter.next(), None, "too many incident edges from iterator");
|
assert_eq!(iter.next(), None, "too many incident edges from iterator");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_edges_multiple_edges<G: MakeTestGraph>()
|
pub fn incident_edges_multiple_edges<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -505,7 +505,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidences_empty<G: MakeTestGraph>() {
|
pub fn incidences_empty<G: MakeTestGraph>() {
|
||||||
let (graph, v) = G::single_vertex();
|
let (graph, v) = G::single_vertex();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
graph.incidences(v).count(),
|
graph.incidences(v).count(),
|
||||||
@@ -514,7 +514,7 @@ pub(crate) fn incidences_empty<G: MakeTestGraph>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidences<G: MakeTestGraph>()
|
pub fn incidences<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -547,7 +547,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidences_edge_consistency<G: MakeTestGraph>()
|
pub fn incidences_edge_consistency<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -580,7 +580,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidences_loop_edge<G: MakeTestGraph>()
|
pub fn incidences_loop_edge<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -604,7 +604,7 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidences_multiple_edges<G: MakeTestGraph>()
|
pub fn incidences_multiple_edges<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -641,7 +641,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidence_cursor_empty<G: MakeTestGraph>()
|
pub fn incidence_cursor_empty<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -655,7 +655,7 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidence_cursor<G: MakeTestGraph>()
|
pub fn incidence_cursor<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -683,7 +683,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidence_cursor_loop_edge<G: MakeTestGraph>()
|
pub fn incidence_cursor_loop_edge<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -703,7 +703,7 @@ where
|
|||||||
assert_eq!(cursor.next(&graph), None, "too many incidences from cursor");
|
assert_eq!(cursor.next(&graph), None, "too many incidences from cursor");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidence_cursor_multiple_edges<G: MakeTestGraph>()
|
pub fn incidence_cursor_multiple_edges<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -740,7 +740,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incidence_cursor_copy<G: MakeTestGraph>() {
|
pub fn incidence_cursor_copy<G: MakeTestGraph>() {
|
||||||
let (graph, vertices, _) = G::two_edge_path();
|
let (graph, vertices, _) = G::two_edge_path();
|
||||||
let mut c1 = graph.incidence_cursor(vertices[1]);
|
let mut c1 = graph.incidence_cursor(vertices[1]);
|
||||||
assert!(c1.next(&graph).is_some(), "expected first incidence");
|
assert!(c1.next(&graph).is_some(), "expected first incidence");
|
||||||
@@ -763,7 +763,7 @@ pub(crate) fn incidence_cursor_copy<G: MakeTestGraph>() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_vertices_incidences_consistency<G: MakeTestGraph>()
|
pub fn incident_vertices_incidences_consistency<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -783,7 +783,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn incident_edges_incidences_consistency<G: MakeTestGraph>()
|
pub fn incident_edges_incidences_consistency<G: MakeTestGraph>()
|
||||||
where
|
where
|
||||||
G::Vertex: Debug,
|
G::Vertex: Debug,
|
||||||
G::Edge: Debug,
|
G::Edge: Debug,
|
||||||
@@ -804,3 +804,4 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user