Add cut test on octagon for all CutLines

This commit is contained in:
2025-08-23 09:56:38 -05:00
parent e59b65e034
commit b7bbadfc51

View File

@@ -461,7 +461,109 @@ mod test {
#[test]
fn cut_octagon() {
todo!();
// Original octagon
let octagon = Card {
cells: OCTAGON,
..Default::default()
};
// Pairs of each different slice option
let vert_left_pair = (
Card {
#[rustfmt::skip]
cells: [
Cell::NW, Cell::Empty, Cell::Empty,
Cell::Filled, Cell::Empty, Cell::Empty,
Cell::SW, Cell::Empty, Cell::Empty,
],
..Default::default()
},
Card {
#[rustfmt::skip]
cells: [
Cell::Empty, Cell::Filled, Cell::NE,
Cell::Empty, Cell::Filled, Cell::Filled,
Cell::Empty, Cell::Filled, Cell::SE,
],
..Default::default()
},
);
let vert_right_pair = (
Card {
#[rustfmt::skip]
cells: [
Cell::NW, Cell::Filled, Cell::Empty,
Cell::Filled, Cell::Filled, Cell::Empty,
Cell::SW, Cell::Filled, Cell::Empty,
],
..Default::default()
},
Card {
#[rustfmt::skip]
cells: [
Cell::Empty, Cell::Empty, Cell::NE,
Cell::Empty, Cell::Empty, Cell::Filled,
Cell::Empty, Cell::Empty, Cell::SE,
],
..Default::default()
},
);
let horiz_top_pair = (
Card {
#[rustfmt::skip]
cells: [
Cell::NW, Cell::Filled, Cell::NE,
Cell::Empty, Cell::Empty, Cell::Empty,
Cell::Empty, Cell::Empty, Cell::Empty,
],
..Default::default()
},
Card {
#[rustfmt::skip]
cells: [
Cell::Empty, Cell::Empty, Cell::Empty,
Cell::Filled, Cell::Filled, Cell::Filled,
Cell::SW, Cell::Filled, Cell::SE,
],
..Default::default()
},
);
let horiz_bottom_pair = (
Card {
#[rustfmt::skip]
cells: [
Cell::NW, Cell::Filled, Cell::NE,
Cell::Filled, Cell::Filled, Cell::Filled,
Cell::Empty, Cell::Empty, Cell::Empty,
],
..Default::default()
},
Card {
#[rustfmt::skip]
cells: [
Cell::Empty, Cell::Empty, Cell::Empty,
Cell::Empty, Cell::Empty, Cell::Empty,
Cell::SW, Cell::Filled, Cell::SE,
],
..Default::default()
},
);
// Run tests
let result_vleft = octagon.clone().cut(CutLine::VertLeft);
assert_eq!(result_vleft, vert_left_pair);
let result_vright = octagon.clone().cut(CutLine::VertRight);
assert_eq!(result_vright, vert_right_pair);
let result_hupper = octagon.clone().cut(CutLine::HorizUpper);
assert_eq!(result_hupper, horiz_top_pair);
let result_hlower = octagon.cut(CutLine::HorizLower);
assert_eq!(result_hlower, horiz_bottom_pair);
}
#[test]