Refactor graph creation in all tests into new internal MakeTestGraph trait

This large refactor allows future re-use of the existing tests for `FrozenGraph`, which does not implement `GraphTopologyAddition`, but instead has to convert from a different graph which does.

- Fix tests for `GraphTopologyDeletion` hard-coding Graph instead of using the trait.
- Fix some tests silently depending on macro call site uses.
- Change `GraphTopologyAddition` tests to use `Default::default` instead of `new`.
- Add new tests for `GraphTopology::vertex_map` and `edge_map` that also depend on `GraphTopologyAddition`, removing these dependencies from the existing tests.
- Add new test macro `graph_topology_addition_deletion_tests` for tests that need deletion and addition.
This commit is contained in:
2026-08-29 22:38:27 +02:00
parent 1185e3b667
commit 7fbd5eed9d
12 changed files with 509 additions and 590 deletions
+7 -3
View File
@@ -239,12 +239,16 @@ impl GraphTopologyAddition for AppendGraph {
}
#[cfg(test)]
mod tests {
use super::*;
mod trait_tests {
use super::AppendGraph;
crate::graph_topology_test_fixtures!(AppendGraph);
crate::graph_topology_tests!(AppendGraph);
crate::graph_topology_addition_tests!(AppendGraph);
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn incident_vertices_paired_index() {
+8 -3
View File
@@ -378,13 +378,18 @@ impl GraphTopologyDeletion for Graph {
}
#[cfg(test)]
mod tests {
use super::*;
mod trait_tests {
use super::Graph;
crate::graph_topology_test_fixtures!(Graph);
crate::graph_topology_tests!(Graph);
crate::graph_topology_addition_tests!(Graph);
crate::graph_topology_deletion_tests!(Graph);
crate::graph_topology_addition_deletion_tests!(Graph);
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn incident_vertices_paired_index() {