Skip to content

Commit

Permalink
Made test more fine grained
Browse files Browse the repository at this point in the history
  • Loading branch information
RaoulLuque committed May 11, 2024
1 parent 096dca4 commit a3e8f81
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions treewidth_heuristic/src/compute_treewidth_upper_bound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,8 @@ mod tests {
}

#[test]
#[should_panic]
fn test_treewidth_heuristic_and_check_result_negative_intersection_weight_heuristic() {
for i in 0..3 {
for i in vec![0, 2] {
for computation_method in COMPUTATION_METHODS {
let test_graph = setup_test_graph(i);
let computed_treewidth = compute_treewidth_upper_bound_not_connected::<
Expand All @@ -261,16 +260,39 @@ mod tests {
false,
);
assert_eq!(
computed_treewidth,
test_graph.treewidth,
computed_treewidth, test_graph.treewidth,
"computation method: {:?}. Test graph {:?}",
computation_method,
i + 1
computation_method, i
);
}
}
}

#[test]
#[should_panic]
fn negative_intersection_weight_heuristic_fails_on_first_test_graph() {
let i = 1;
let computation_method = TreewidthComputationMethod::MSTAndUseTreeStructure;

let test_graph = setup_test_graph(i);
let computed_treewidth = compute_treewidth_upper_bound_not_connected::<
_,
_,
std::hash::BuildHasherDefault<rustc_hash::FxHasher>,
_,
>(
&test_graph.graph,
negative_intersection_heuristic,
computation_method,
false,
);
assert_eq!(
computed_treewidth, test_graph.treewidth,
"computation method: {:?}. Test graph {:?}",
computation_method, i
);
}

#[test]
fn test_treewidth_heuristic_and_check_result_least_difference_weight_heuristic() {
for i in 0..3 {
Expand Down

0 comments on commit a3e8f81

Please sign in to comment.