mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed unit test
This commit is contained in:
parent
c78c45ec73
commit
bd7f33eae5
@ -4,15 +4,15 @@ use hashbrown::HashMap;
|
||||
|
||||
// Unneeded cfg(test) here keeps rust-analyzer happy
|
||||
#[cfg(test)]
|
||||
use petgraph::{algo::is_cyclic_undirected, graph::UnGraph};
|
||||
use petgraph::{algo::is_cyclic_directed, graph::DiGraph};
|
||||
|
||||
#[test]
|
||||
fn check_cyclic_skill_deps() {
|
||||
let skill_prereqs =
|
||||
SkillPrerequisitesMap::load_expect_cloned("common.skill_trees.skill_prerequisites").0;
|
||||
let mut graph = UnGraph::new_undirected();
|
||||
let mut graph = DiGraph::new();
|
||||
let mut nodes = HashMap::<Skill, _>::new();
|
||||
let mut add_node = |graph: &mut UnGraph<Skill, _>, node: Skill| {
|
||||
let mut add_node = |graph: &mut DiGraph<Skill, _>, node: Skill| {
|
||||
*nodes.entry(node).or_insert_with(|| graph.add_node(node))
|
||||
};
|
||||
|
||||
@ -28,5 +28,5 @@ fn check_cyclic_skill_deps() {
|
||||
}
|
||||
}
|
||||
|
||||
assert!(!is_cyclic_undirected(&graph));
|
||||
assert!(!is_cyclic_directed(&graph));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user