Refactor tests: use MakeTestGraph in model-specific tests, deconstruct vertex arrays where useful, adjust local variable names
This commit is contained in:
@@ -77,12 +77,12 @@ pub fn reserve_edges_increases_capacity<G: GraphTopologyAddition>() {
|
||||
|
||||
pub fn reserve_edges_prevents_reallocation_on_add<G: GraphTopologyAddition>() {
|
||||
let mut graph = G::default();
|
||||
let v1 = graph.add_vertex();
|
||||
let v2 = graph.add_vertex();
|
||||
let u = graph.add_vertex();
|
||||
let v = graph.add_vertex();
|
||||
graph.reserve_edges(10);
|
||||
let capacity_before = graph.edge_capacity();
|
||||
for _ in 0..10 {
|
||||
graph.add_edge(v1, v2);
|
||||
graph.add_edge(u, v);
|
||||
}
|
||||
assert_eq!(
|
||||
graph.edge_capacity(),
|
||||
@@ -116,10 +116,10 @@ where
|
||||
G::Edge: Debug,
|
||||
{
|
||||
let mut graph = G::default();
|
||||
let v1 = graph.add_vertex();
|
||||
let v2 = graph.add_vertex();
|
||||
let e = graph.add_edge(v1, v2);
|
||||
assert_ne!(graph.add_edge(v1, v2), e, "unexpected duplicate edge");
|
||||
let u = graph.add_vertex();
|
||||
let v = graph.add_vertex();
|
||||
let e = graph.add_edge(u, v);
|
||||
assert_ne!(graph.add_edge(u, v), e, "unexpected duplicate edge");
|
||||
}
|
||||
|
||||
pub fn vertex_map_new_vertex<G: GraphTopologyAddition>() {
|
||||
@@ -139,10 +139,10 @@ pub fn vertex_map_new_vertex<G: GraphTopologyAddition>() {
|
||||
|
||||
pub fn edge_map_new_edge<G: GraphTopologyAddition>() {
|
||||
let mut graph = G::default();
|
||||
let v1 = graph.add_vertex();
|
||||
let v2 = graph.add_vertex();
|
||||
let u = graph.add_vertex();
|
||||
let v = graph.add_vertex();
|
||||
let mut map = graph.edge_map(28);
|
||||
let e = graph.add_edge(v1, v2);
|
||||
let e = graph.add_edge(u, v);
|
||||
assert_eq!(map[e], 28);
|
||||
map[e] = 8;
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user