Fixed unit test

This commit is contained in:
Sam
2023-02-22 20:50:03 -05:00
parent c78c45ec73
commit bd7f33eae5

View File

@ -4,15 +4,15 @@ use hashbrown::HashMap;
// Unneeded cfg(test) here keeps rust-analyzer happy // Unneeded cfg(test) here keeps rust-analyzer happy
#[cfg(test)] #[cfg(test)]
use petgraph::{algo::is_cyclic_undirected, graph::UnGraph}; use petgraph::{algo::is_cyclic_directed, graph::DiGraph};
#[test] #[test]
fn check_cyclic_skill_deps() { fn check_cyclic_skill_deps() {
let skill_prereqs = let skill_prereqs =
SkillPrerequisitesMap::load_expect_cloned("common.skill_trees.skill_prerequisites").0; 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 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)) *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));
} }