Rename select_cell to cell

This commit is contained in:
2025-05-28 20:52:17 -05:00
parent ce72a9b3cf
commit bd64b51683

View File

@@ -159,7 +159,7 @@ impl Crossword {
} }
} }
pub fn select_cell(&self, x: usize, y: usize) -> CrosswordCell { pub fn cell(&self, x: usize, y: usize) -> CrosswordCell {
CrosswordCell { CrosswordCell {
x, x,
y, y,
@@ -194,72 +194,72 @@ mod tests {
#[test] #[test]
fn test_north() { fn test_north() {
let crossword = small_test_crossword(); let crossword = small_test_crossword();
assert_eq!(crossword.select_cell(1, 1).n(0), ""); assert_eq!(crossword.cell(1, 1).n(0), "");
assert_eq!(crossword.select_cell(1, 1).n(1), "5"); assert_eq!(crossword.cell(1, 1).n(1), "5");
assert_eq!(crossword.select_cell(1, 1).n(2), "52"); assert_eq!(crossword.cell(1, 1).n(2), "52");
assert_eq!(crossword.select_cell(1, 1).n(3), "52"); assert_eq!(crossword.cell(1, 1).n(3), "52");
} }
#[test] #[test]
fn test_northeast() { fn test_northeast() {
let crossword = small_test_crossword(); let crossword = small_test_crossword();
assert_eq!(crossword.select_cell(1, 1).ne(0), ""); assert_eq!(crossword.cell(1, 1).ne(0), "");
assert_eq!(crossword.select_cell(1, 1).ne(1), "5"); assert_eq!(crossword.cell(1, 1).ne(1), "5");
assert_eq!(crossword.select_cell(1, 1).ne(2), "53"); assert_eq!(crossword.cell(1, 1).ne(2), "53");
assert_eq!(crossword.select_cell(1, 1).ne(3), "53"); assert_eq!(crossword.cell(1, 1).ne(3), "53");
} }
#[test] #[test]
fn test_east() { fn test_east() {
let crossword = small_test_crossword(); let crossword = small_test_crossword();
assert_eq!(crossword.select_cell(1, 1).e(0), ""); assert_eq!(crossword.cell(1, 1).e(0), "");
assert_eq!(crossword.select_cell(1, 1).e(1), "5"); assert_eq!(crossword.cell(1, 1).e(1), "5");
assert_eq!(crossword.select_cell(1, 1).e(2), "56"); assert_eq!(crossword.cell(1, 1).e(2), "56");
assert_eq!(crossword.select_cell(1, 1).e(3), "56"); assert_eq!(crossword.cell(1, 1).e(3), "56");
} }
#[test] #[test]
fn test_southeast() { fn test_southeast() {
let crossword = small_test_crossword(); let crossword = small_test_crossword();
assert_eq!(crossword.select_cell(1, 1).se(0), ""); assert_eq!(crossword.cell(1, 1).se(0), "");
assert_eq!(crossword.select_cell(1, 1).se(1), "5"); assert_eq!(crossword.cell(1, 1).se(1), "5");
assert_eq!(crossword.select_cell(1, 1).se(2), "59"); assert_eq!(crossword.cell(1, 1).se(2), "59");
assert_eq!(crossword.select_cell(1, 1).se(3), "59"); assert_eq!(crossword.cell(1, 1).se(3), "59");
} }
#[test] #[test]
fn test_south() { fn test_south() {
let crossword = small_test_crossword(); let crossword = small_test_crossword();
assert_eq!(crossword.select_cell(1, 1).s(0), ""); assert_eq!(crossword.cell(1, 1).s(0), "");
assert_eq!(crossword.select_cell(1, 1).s(1), "5"); assert_eq!(crossword.cell(1, 1).s(1), "5");
assert_eq!(crossword.select_cell(1, 1).s(2), "58"); assert_eq!(crossword.cell(1, 1).s(2), "58");
assert_eq!(crossword.select_cell(1, 1).s(3), "58"); assert_eq!(crossword.cell(1, 1).s(3), "58");
} }
#[test] #[test]
fn test_southwest() { fn test_southwest() {
let crossword = small_test_crossword(); let crossword = small_test_crossword();
assert_eq!(crossword.select_cell(1, 1).sw(0), ""); assert_eq!(crossword.cell(1, 1).sw(0), "");
assert_eq!(crossword.select_cell(1, 1).sw(1), "5"); assert_eq!(crossword.cell(1, 1).sw(1), "5");
assert_eq!(crossword.select_cell(1, 1).sw(2), "57"); assert_eq!(crossword.cell(1, 1).sw(2), "57");
assert_eq!(crossword.select_cell(1, 1).sw(3), "57"); assert_eq!(crossword.cell(1, 1).sw(3), "57");
} }
#[test] #[test]
fn test_west() { fn test_west() {
let crossword = small_test_crossword(); let crossword = small_test_crossword();
assert_eq!(crossword.select_cell(1, 1).w(0), ""); assert_eq!(crossword.cell(1, 1).w(0), "");
assert_eq!(crossword.select_cell(1, 1).w(1), "5"); assert_eq!(crossword.cell(1, 1).w(1), "5");
assert_eq!(crossword.select_cell(1, 1).w(2), "54"); assert_eq!(crossword.cell(1, 1).w(2), "54");
assert_eq!(crossword.select_cell(1, 1).w(3), "54"); assert_eq!(crossword.cell(1, 1).w(3), "54");
} }
#[test] #[test]
fn test_northwest() { fn test_northwest() {
let crossword = small_test_crossword(); let crossword = small_test_crossword();
assert_eq!(crossword.select_cell(1, 1).nw(0), ""); assert_eq!(crossword.cell(1, 1).nw(0), "");
assert_eq!(crossword.select_cell(1, 1).nw(1), "5"); assert_eq!(crossword.cell(1, 1).nw(1), "5");
assert_eq!(crossword.select_cell(1, 1).nw(2), "51"); assert_eq!(crossword.cell(1, 1).nw(2), "51");
assert_eq!(crossword.select_cell(1, 1).nw(3), "51"); assert_eq!(crossword.cell(1, 1).nw(3), "51");
} }
} }