Add unit tests card flipping in both directions
This commit is contained in:
42
src/card.rs
42
src/card.rs
@@ -302,6 +302,20 @@ pub const NW_TRIANGLE: [Cell; 9] = [
|
|||||||
Cell::NW, Cell::Filled, Cell::Filled,
|
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]
|
#[rustfmt::skip]
|
||||||
pub const OCTAGON: [Cell; 9] = [
|
pub const OCTAGON: [Cell; 9] = [
|
||||||
Cell::NW, Cell::Filled, Cell::NE,
|
Cell::NW, Cell::Filled, Cell::NE,
|
||||||
@@ -573,12 +587,36 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn flip_triangle_vertical() {
|
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]
|
#[test]
|
||||||
fn flip_triangle_horizontal() {
|
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]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user