Add unit tests card flipping in both directions

This commit is contained in:
2025-08-23 10:08:08 -05:00
parent b7bbadfc51
commit 761729900f

View File

@@ -302,6 +302,20 @@ pub const NW_TRIANGLE: [Cell; 9] = [
Cell::NW, Cell::Filled, Cell::Filled,
];
#[rustfmt::skip]
pub const SW_TRIANGLE: [Cell; 9] = [
Cell::SW, Cell::Filled, Cell::Filled,
Cell::Empty, Cell::SW, Cell::Filled,
Cell::Empty, Cell::Empty, Cell::SW,
];
#[rustfmt::skip]
pub const NE_TRIANGLE: [Cell; 9] = [
Cell::NE, Cell::Empty, Cell::Empty,
Cell::Filled, Cell::NE, Cell::Empty,
Cell::Filled, Cell::Filled, Cell::NE
];
#[rustfmt::skip]
pub const OCTAGON: [Cell; 9] = [
Cell::NW, Cell::Filled, Cell::NE,
@@ -573,12 +587,36 @@ mod test {
#[test]
fn flip_triangle_vertical() {
todo!();
let tri = Card {
cells: NW_TRIANGLE,
..Default::default()
};
let expected = Card {
cells: SW_TRIANGLE,
..Default::default()
};
let result = tri.flip(FlipDir::Vertical);
assert_eq!(result, expected);
}
#[test]
fn flip_triangle_horizontal() {
todo!();
let tri = Card {
cells: NW_TRIANGLE,
..Default::default()
};
let expected = Card {
cells: NE_TRIANGLE,
..Default::default()
};
let result = tri.flip(FlipDir::Horizontal);
assert_eq!(result, expected);
}
#[test]