Compare commits
2 Commits
6bbc31304e
...
2024ad6e95
| Author | SHA1 | Date | |
|---|---|---|---|
| 2024ad6e95 | |||
| b3b8d1a814 |
86
src/card.rs
86
src/card.rs
@@ -191,21 +191,101 @@ mod test {
|
||||
assert!(extra_doors.is_none());
|
||||
}
|
||||
|
||||
/// Merging two corner cells together results in the upper cell coming through.
|
||||
/// Merging two triangular [`Cell`]s should prefer the top-most one, *unless*
|
||||
/// they are opposites. See test [`merge_opposite_triangles()`].
|
||||
#[test]
|
||||
fn merge_triangle_and_triangle() {
|
||||
todo!();
|
||||
let mut top = Card::default();
|
||||
top.cells[0] = Cell::NW;
|
||||
|
||||
let mut bottom = Card::default();
|
||||
bottom.cells[0] = Cell::NE;
|
||||
|
||||
let expected = top.clone();
|
||||
|
||||
let (stacked, doors) = bottom.merge(top);
|
||||
assert_eq!(stacked, expected);
|
||||
assert!(doors.is_none());
|
||||
}
|
||||
|
||||
/// Merging a filled cell with anything should result in [`Cell::Filled`].
|
||||
#[test]
|
||||
fn merge_triangle_and_filled() {
|
||||
todo!();
|
||||
let filled = Card {
|
||||
cells: FULL_SQUARE,
|
||||
..Default::default()
|
||||
};
|
||||
let triangle = Card {
|
||||
cells: NW_TRIANGLE,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let expected = filled.clone();
|
||||
|
||||
// Check the merge in both directions.
|
||||
let result_fill_over_tri = triangle.merge(filled);
|
||||
let result_tri_over_fill = filled.merge(triangle);
|
||||
|
||||
assert_eq!(expected, result_fill_over_tri.0);
|
||||
assert_eq!(expected, result_tri_over_fill.0);
|
||||
assert!(result_fill_over_tri.1.is_none());
|
||||
assert!(result_tri_over_fill.1.is_none());
|
||||
}
|
||||
|
||||
/// Merging a NW and SE cell should result in a single [`Cell::Filled`].
|
||||
#[test]
|
||||
fn merge_opposite_triangles() {
|
||||
let mut top = Card::default();
|
||||
top.cells[0] = Cell::NW;
|
||||
|
||||
let mut bottom = Card::default();
|
||||
bottom.cells[0] = Cell::SE;
|
||||
|
||||
let mut expected = Card::default();
|
||||
expected.cells[0] = Cell::Filled;
|
||||
|
||||
let (stacked, doors) = bottom.merge(top);
|
||||
assert_eq!(stacked, expected);
|
||||
assert!(doors.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cut_octagon() {
|
||||
todo!();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cut_triangle() {
|
||||
todo!();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flip_triangle_vertical() {
|
||||
todo!();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flip_triangle_horizontal() {
|
||||
todo!();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transpose_vertical() {
|
||||
todo!();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transpose_horizontal(){
|
||||
todo!();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rotate_clockwise() {
|
||||
todo!();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rotate_counter_clockwise() {
|
||||
todo!();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user