use crate::decompose::Bisection;
#[test]
fn a_side_bit_vector_shorter_than_the_subset_is_not_a_split() {
let vars = [10u32, 11, 12, 13];
assert!(
Bisection::from_side_bits(&vars, &[0, 1]).is_none(),
"two bits say nothing about the last two variables",
);
assert!(
Bisection::from_side_bits(&vars, &[0, 1, 0, 1, 0]).is_none(),
"a bit past the end of the subset belongs to another question",
);
assert!(
Bisection::from_side_bits(&vars, &[]).is_none(),
"no bits at all is no split",
);
let split = Bisection::from_side_bits(&vars, &[0, 1, 1, 0]).expect("one bit per variable");
assert_eq!(split.left, vec![10, 13]);
assert_eq!(split.right, vec![11, 12]);
}
#[test]
fn every_variable_on_one_side_is_not_a_split() {
let vars = [10u32, 11, 12];
assert!(Bisection::from_side_bits(&vars, &[0, 0, 0]).is_none());
assert!(Bisection::from_side_bits(&vars, &[1, 1, 1]).is_none());
assert!(Bisection::from_side_bits(&vars, &[0, 0, 1]).is_some());
}