Add test for add_edge() return value
This commit is contained in:
+10
-1
@@ -9,7 +9,7 @@ impl From<Vertex> for usize {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Incidence(usize);
|
pub struct Incidence(usize);
|
||||||
|
|
||||||
struct VertexIncidenceHeader {
|
struct VertexIncidenceHeader {
|
||||||
@@ -136,6 +136,15 @@ mod tests {
|
|||||||
assert_eq!(graph.vertex_count(), 10, "unexpected vertex count");
|
assert_eq!(graph.vertex_count(), 10, "unexpected vertex count");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add_edge() {
|
||||||
|
let mut graph = AppendGraph::new();
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn edge_count_empty() {
|
fn edge_count_empty() {
|
||||||
let graph = AppendGraph::new();
|
let graph = AppendGraph::new();
|
||||||
|
|||||||
Reference in New Issue
Block a user